36 #ifndef NEKTAR_LIB_LIBUTILITIES_BASSICUTILS_VECTORMATH_HPP
37 #define NEKTAR_LIB_LIBUTILITIES_BASSICUTILS_VECTORMATH_HPP
61 const int incy, T*z,
const int incz);
66 T *y,
const int incy);
70 const int incy, T*z,
const int incz);
74 const int incx, T *y,
const int incy);
78 const int incy, T *z,
const int incz);
82 const int incx, T *y,
const int incy);
86 const int incy, T *z,
const int incz);
95 template<
class T>
void Vlog(
int n,
const T *x,
const int incx,
107 template<
class T>
void Vexp(
int n,
const T *x,
const int incx,
108 T *y,
const int incy)
118 template<
class T>
void Vpow(
int n,
const T *x,
const int incx,
119 const T f, T *y,
const int incy)
132 T *y,
const int incy);
136 T *y,
const int incy);
142 const T *w,
const int incw,
143 const T *x,
const int incx,
144 const T *y,
const int incy,
145 T *z,
const int incz);
149 const int incx,
const T *y,
const int incy,
150 T *z,
const int incz);
154 const int incx,
const T *y,
const int incy,
155 T *z,
const int incz);
159 const int incx,
const T *y,
const int incy,
160 T *z,
const int incz);
165 const T* v,
int incv,
166 const T* w,
int incw,
167 const T* x,
int incx,
168 const T* y,
int incy,
173 const T* v,
int incv,
174 const T* w,
int incw,
175 const T* x,
int incx,
176 const T* y,
int incy,
182 const T* x,
int incx,
184 const T* y,
int incy,
191 const T* v,
int incv,
192 const T* w,
int incw,
193 const T* x,
int incx,
263 const T *w,
const int incw,
264 const T *x,
const int incx);
274 const T *w,
const int incw,
275 const T *x,
const int incx,
276 const int *y,
const int incy);
283 T *y,
const int incy);
290 #endif //VECTORMATH_HPP
void Vpow(int n, const T *x, const int incx, const T f, T *y, const int incy)
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
#define sign(a, b)
return the sign(b)*a
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
int Imin(int n, const T *x, const int incx)
Return the index of the minimum element in x.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
void Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
int Imax(int n, const T *x, const int incx)
Return the index of the maximum element in x.
void Reverse(int n, const T *x, const int incx, T *y, const int incy)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
T ran2(long *idum)
Generates a number from ~Normal(0,1)
#define LIB_UTILITIES_EXPORT
int Nnan(int n, const T *x, const int incx)
Return number of NaN elements of x.
void Vexp(int n, const T *x, const int incx, T *y, const int incy)
void Svtvm(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x - y
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
void Neg(int n, T *x, const int incx)
Negate x = -x.
void Assmb(int n, const T *x, const int *y, T *z)
Assemble z[y[i]] += x[i]; z should be zero'd first.
void Vvtvvtm(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtm (vector times vector minus vector times vector):
T Vamax(int n, const T *x, const int incx)
Return the maximum absolute element in x called vamax to avoid conflict with max. ...
int Iamax(int n, const T *x, const int incx)
Return the index of the maximum absolute element in x.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
T Dot(int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
void Vstvpp(int n, const T alpha, const T *v, int incv, const T *w, int incw, const T *x, int incx, T *z, int incz)
Vstvpp (scalar times vector plus vector plus vector):
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
void Vvtvm(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvm (vector times vector plus vector): z = w*x - y
T Dot2(int n, const T *w, const T *x, const int *y)
vvtvp (vector times vector times vector): z = w*x*y
void FillWhiteNoise(int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.
void Vlog(int n, const T *x, const int incx, T *y, const int incy)
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector):
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.