36 #ifndef NEKTAR_LIB_LIBUTILITIES_BASSICUTILS_VECTORMATH_HPP
37 #define NEKTAR_LIB_LIBUTILITIES_BASSICUTILS_VECTORMATH_HPP
58 int n,
const T eps, T *x,
const int incx,
int seed = 9999);
62 const int incy, T*z,
const int incz);
67 T *y,
const int incy);
71 const int incy, T*z,
const int incz);
75 const int incx, T *y,
const int incy);
79 const int incy, T *z,
const int incz);
83 const int incx, T *y,
const int incy);
87 const int incy, T *z,
const int incz);
96 template<
class T>
void Vlog(
int n,
const T *x,
const int incx,
108 template<
class T>
void Vexp(
int n,
const T *x,
const int incx,
109 T *y,
const int incy)
119 template<
class T>
void Vpow(
int n,
const T *x,
const int incx,
120 const T f, T *y,
const int incy)
133 T *y,
const int incy);
137 T *y,
const int incy);
143 const T *w,
const int incw,
144 const T *x,
const int incx,
145 const T *y,
const int incy,
146 T *z,
const int incz);
150 const int incx,
const T *y,
const int incy,
151 T *z,
const int incz);
155 const int incx,
const T *y,
const int incy,
156 T *z,
const int incz);
160 const int incx,
const T *y,
const int incy,
161 T *z,
const int incz);
166 const T* v,
int incv,
167 const T* w,
int incw,
168 const T* x,
int incx,
169 const T* y,
int incy,
174 const T* v,
int incv,
175 const T* w,
int incw,
176 const T* x,
int incx,
177 const T* y,
int incy,
183 const T* x,
int incx,
185 const T* y,
int incy,
192 const T* v,
int incv,
193 const T* w,
int incw,
194 const T* x,
int incx,
264 const T *w,
const int incw,
265 const T *x,
const int incx);
275 const T *w,
const int incw,
276 const T *x,
const int incx,
277 const int *y,
const int incy);
284 T *y,
const int incy);
291 #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.