cwVectOps.h : Added 'scale_add()'
This commit is contained in:
parent
2d0c59a8fa
commit
5de1851c66
23
cwVectOps.h
23
cwVectOps.h
@ -138,6 +138,11 @@ namespace cw
|
|||||||
return v[mi];
|
return v[mi];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==================================================================================================================
|
||||||
|
// misc
|
||||||
|
//
|
||||||
|
|
||||||
template< typename T0, typename T1 >
|
template< typename T0, typename T1 >
|
||||||
T0 mac( const T0* v0, const T1* v1, unsigned n )
|
T0 mac( const T0* v0, const T1* v1, unsigned n )
|
||||||
{
|
{
|
||||||
@ -147,6 +152,24 @@ namespace cw
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template< typename T0, typename T1 >
|
||||||
|
T0* scale_add( T0* v0, T0 scale_0, const T1* v1, T1 scale_1, unsigned n )
|
||||||
|
{
|
||||||
|
for(unsigned i=0; i<n; ++i)
|
||||||
|
v0[i] = (v0[i] * scale_0) + (v1[i] * scale_1);
|
||||||
|
|
||||||
|
return v0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template< typename T0, typename T1, typename T2 >
|
||||||
|
T0* scale_add( T0* v0, const T1* v1, T1 scale_1, const T2* v2, T2 scale_2, unsigned n )
|
||||||
|
{
|
||||||
|
for(unsigned i=0; i<n; ++i)
|
||||||
|
v0[i] = (v1[i] * scale_1) + (v2[i] * scale_2);
|
||||||
|
|
||||||
|
return v0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//==================================================================================================================
|
//==================================================================================================================
|
||||||
// absolute value
|
// absolute value
|
||||||
|
Loading…
Reference in New Issue
Block a user