Nektar++
Vmath Namespace Reference

## Functions

template<class T >
void Fill (int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
template void Fill (int n, const Nektar::NekDouble alpha, Nektar::NekDouble *x, const int incx)
template<class T >
ran2 (long *idum)
Generates a number from ~Normal(0,1)
template<class T >
void FillWhiteNoise (int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.
template void FillWhiteNoise (int n, const Nektar::NekDouble eps, Nektar::NekDouble *x, const int incx, int outseed)
template<class T >
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.
template void Vmul (int n, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
void Smul (int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
template void Smul (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
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.
template void Vdiv (int n, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
void Sdiv (int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/y.
template void Sdiv (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
void Vadd (int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
template void Vadd (int n, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
void Sadd (int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
template void Sadd (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
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.
template void Vsub (int n, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
void Zero (int n, T *x, const int incx)
Zero vector.
template void Zero (int n, Nektar::NekDouble *x, const int incx)
template void Zero (int n, int *x, const int incx)
template void Zero (int n, long *x, const int incx)
template<class T >
void Neg (int n, T *x, const int incx)
Negate x = -x.
template void Neg (int n, Nektar::NekDouble *x, const int incx)
template<class T >
void Vsqrt (int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
template void Vsqrt (int n, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
void Vabs (int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
template void Vabs (int n, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
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
template void Vvtvp (int n, const Nektar::NekDouble *w, const int incw, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
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
template void Vvtvm (int n, const Nektar::NekDouble *w, const int incw, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
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
template void Svtvp (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
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
template void Svtvm (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, const int incx, const Nektar::NekDouble *y, const int incy, Nektar::NekDouble *z, const int incz)
template<class T >
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):
template void Vvtvvtp (int n, const Nektar::NekDouble *v, int incv, const Nektar::NekDouble *w, int incw, const Nektar::NekDouble *x, int incx, const Nektar::NekDouble *y, int incy, Nektar::NekDouble *z, int incz)
template<class T >
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):
template void Vvtvvtm (int n, const Nektar::NekDouble *v, int incv, const Nektar::NekDouble *w, int incw, const Nektar::NekDouble *x, int incx, const Nektar::NekDouble *y, int incy, Nektar::NekDouble *z, int incz)
template<class T >
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):
template void Svtsvtp (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *x, int incx, const Nektar::NekDouble beta, const Nektar::NekDouble *y, int incy, Nektar::NekDouble *z, int incz)
template<class T >
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):
template void Vstvpp (int n, const Nektar::NekDouble alpha, const Nektar::NekDouble *v, int incv, const Nektar::NekDouble *w, int incw, const Nektar::NekDouble *x, int incx, Nektar::NekDouble *z, int incz)
template<class T >
void Gathr (int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
template void Gathr (int n, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
void Gathr (int n, const T *sign, const T *x, const int *y, T *z)
Gather vector z[i] = sign[i]*x[y[i]].
template void Gathr (int n, const Nektar::NekDouble *sign, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
void Scatr (int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
template void Scatr (int n, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
void Scatr (int n, const T *sign, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = sign[i]*x[i].
template void Scatr (int n, const Nektar::NekDouble *sign, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
void Assmb (int n, const T *x, const int *y, T *z)
Assemble z[y[i]] += x[i]; z should be zero'd first.
template void Assmb (int n, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
void Assmb (int n, const T *sign, const T *x, const int *y, T *z)
Assemble z[y[i]] += sign[i]*x[i]; z should be zero'd first.
template void Assmb (int n, const Nektar::NekDouble *sign, const Nektar::NekDouble *x, const int *y, Nektar::NekDouble *z)
template<class T >
Vsum (int n, const T *x, const int incx)
Subtract return sum(x)
template Nektar::NekDouble Vsum (int n, const Nektar::NekDouble *x, const int incx)
template int Vsum (int n, const int *x, const int incx)
template<class T >
int Imax (int n, const T *x, const int incx)
Return the index of the maximum element in x.
template int Imax (int n, const Nektar::NekDouble *x, const int incx)
template int Imax (int n, const int *x, const int incx)
template<class T >
Vmax (int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
template Nektar::NekDouble Vmax (int n, const Nektar::NekDouble *x, const int incx)
template int Vmax (int n, const int *x, const int incx)
template<class T >
int Iamax (int n, const T *x, const int incx)
Return the index of the maximum absolute element in x.
template int Iamax (int n, const Nektar::NekDouble *x, const int incx)
template<class T >
Vamax (int n, const T *x, const int incx)
Return the maximum absolute element in x called vamax to avoid conflict with max.
template Nektar::NekDouble Vamax (int n, const Nektar::NekDouble *x, const int incx)
template<class T >
int Imin (int n, const T *x, const int incx)
Return the index of the minimum element in x.
template int Imin (int n, const Nektar::NekDouble *x, const int incx)
template<class T >
Vmin (int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
template Nektar::NekDouble Vmin (int n, const Nektar::NekDouble *x, const int incx)
template int Vmin (int n, const int *x, const int incx)
template<class T >
Dot (int n, const T *w, const T *x)
vvtvp (vector times vector times vector): z = w*x*y
template Nektar::NekDouble Dot (int n, const Nektar::NekDouble *w, const Nektar::NekDouble *x)
template<class T >
Dot (int n, const T *w, const int incw, const T *x, const int incx)
vvtvp (vector times vector times vector): z = w*x*y
template Nektar::NekDouble Dot (int n, const Nektar::NekDouble *w, const int incw, const Nektar::NekDouble *x, const int incx)
template<class T >
Dot2 (int n, const T *w, const T *x, const int *y)
vvtvp (vector times vector times vector): z = w*x*y
template Nektar::NekDouble Dot2 (int n, const Nektar::NekDouble *w, const Nektar::NekDouble *x, const int *y)
template<class T >
Dot2 (int n, const T *w, const int incw, const T *x, const int incx, const int *y, const int incy)
vvtvp (vector times vector times vector): z = w*x*y
template Nektar::NekDouble Dot2 (int n, const Nektar::NekDouble *w, const int incw, const Nektar::NekDouble *x, const int incx, const int *y, const int incy)
template<typename T >
void Vcopy (int n, const T *x, const int incx, T *y, const int incy)
template void Vcopy (int n, const int *x, const int incx, int *y, const int incy)
template void Vcopy (int n, const unsigned int *x, const int incx, unsigned int *y, const int incy)
template void Vcopy (int n, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
void Reverse (int n, const T *x, const int incx, T *y, const int incy)
template void Reverse (int n, const Nektar::NekDouble *x, const int incx, Nektar::NekDouble *y, const int incy)
template<class T >
void Vlog (int n, const T *x, const int incx, T *y, const int incy)
template<class T >
void Vexp (int n, const T *x, const int incx, T *y, const int incy)
template<class T >
void Vpow (int n, const T *x, const int incx, const T f, T *y, const int incy)
template<class T >
void Fill (int n, const T alpha, Array< OneD, T > &x, const int incx)
Fill a vector with a constant value.
template<class T >
void FillWhiteNoise (int n, const T eps, Array< OneD, T > &x, const int incx, int outseed)
template<class T >
void Vmul (int n, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
Multiply vector z = x*y.
template<class T >
void Vmul (int n, const Array< TwoD, NekDouble >::const_reference &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
template<class T >
void Smul (int n, const T alpha, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
Scalar multiply y = alpha*y.
template<class T >
void Vdiv (int n, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
Multiply vector z = x/y.
template<class T >
void Sdiv (int n, const T alpha, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
Scalar multiply y = alpha/y.
template<class T >
void Vadd (int n, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
template<class T >
void Sadd (int n, const T alpha, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
Add vector y = alpha + x.
template<class T >
void Vsub (int n, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
Subtract vector z = x-y.
template<class T >
void Zero (int n, Array< OneD, T > &x, const int incx)
Zero vector.
template<class T >
void Neg (int n, Array< OneD, T > &x, const int incx)
Negate x = -x.
template<class T >
void Vlog (int n, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
template<class T >
void Vexp (int n, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
template<class T >
void Vpow (int n, const Array< OneD, const T > &x, const int incx, const T f, Array< OneD, T > &y, const int incy)
template<class T >
void Vsqrt (int n, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
sqrt y = sqrt(x)
template<class T >
void Vabs (int n, const Array< OneD, const T > &x, const int incx, Array< OneD, T > &y, const int incy)
vabs: y = |x|
template<class T >
void Vvtvp (int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
template<class T >
void Vvtvp (int n, const Array< TwoD, NekDouble >::const_reference &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
template<class T >
void Svtvp (int n, const T alpha, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
template<class T >
void Svtvm (int n, const T alpha, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
template<class T >
void Vvtvm (int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
vvtvm (vector times vector minus vector): z = w*x - y
template<class T >
void Vvtvvtp (int n, const Array< OneD, const T > &v, int incv, const Array< OneD, const T > &w, int incw, const Array< OneD, const T > &x, int incx, const Array< OneD, const T > &y, int incy, Array< OneD, T > &z, int incz)
vvtvvtp (vector times vector plus vector times vector): z = v*w + y*z
template<class T >
void Svtsvtp (int n, const T alpha, const Array< OneD, const T > &x, const int incx, const T beta, const Array< OneD, const T > &y, const int incy, Array< OneD, T > &z, const int incz)
svtsvtp (scalar times vector plus scalar times vector): z = alpha*x + beta*y
template<class T >
void Gathr (int n, const Array< OneD, const T > &x, const Array< OneD, const int > &y, Array< OneD, T > &z)
Gather vector z[i] = x[y[i]].
template<class T >
void Scatr (int n, const Array< OneD, const T > &x, const Array< OneD, const int > &y, Array< OneD, T > &z)
Scatter vector z[y[i]] = x[i].
template<class T >
void Assmb (int n, const Array< OneD, T > &x, const Array< OneD, int > &y, Array< OneD, T > &z)
Assemble z[y[i]] += x[i]; z should be zero'd first.
template<class T >
Vsum (int n, const Array< OneD, const T > &x, const int incx)
Subtract return sum(x)
template<class T >
int Imax (int n, const Array< OneD, const T > &x, const int incx)
Return the index of the maximum element in x.
template<class T >
Vmax (int n, const Array< OneD, const T > &x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
template<class T >
int Iamax (int n, const Array< OneD, const T > &x, const int incx)
Return the index of the maximum absolute element in x.
template<class T >
Vamax (int n, const Array< OneD, const T > &x, const int incx)
Return the maximum absolute element in x called vamax to avoid conflict with max.
template<class T >
int Imin (int n, const Array< OneD, const T > &x, const int incx)
Return the index of the minimum element in x.
template<class T >
Vmin (int n, const Array< OneD, const T > &x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
template<class T >
Dot (int n, const Array< OneD, const T > &w, const Array< OneD, const T > &x)
template<class T >
Dot (int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx)
template<class T >
Dot2 (int n, const Array< OneD, const T > &w, const Array< OneD, const T > &x, const Array< OneD, const int > &y)
template<class T >
Ddot (int n, const Array< OneD, const T > &w, const int incw, const Array< OneD, const T > &x, const int incx, const Array< OneD, const int > &y, const int incy)
template<class T >
void Vcopy (int n, const Array< OneD, const T > &x, int incx, Array< OneD, T > &y, int const incy)
template<class T >
void Reverse (int n, const Array< OneD, const T > &x, int incx, Array< OneD, T > &y, int const incy)

## Function Documentation

template<class T >
 void Vmath::Assmb ( int n, const Array< OneD, T > & x, const Array< OneD, int > & y, Array< OneD, T > & z )

Assemble z[y[i]] += x[i]; z should be zero'd first.

Definition at line 317 of file VmathArray.hpp.

References ASSERTL1, and Assmb().

{
ASSERTL1(n <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Assmb(n,&x[0],&y[0],&z[0]);
}
template<class T >
 void Vmath::Assmb ( int n, const T * x, const int * y, T * z )

Assemble z[y[i]] += x[i]; z should be zero'd first.

Definition at line 683 of file Vmath.cpp.

{
while (n--)
{
*(z + *(y++)) += *(x++);
}
}
 template void Vmath::Assmb ( int n, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 void Vmath::Assmb ( int n, const T * sign, const T * x, const int * y, T * z )

Assemble z[y[i]] += sign[i]*x[i]; z should be zero'd first.

Definition at line 696 of file Vmath.cpp.

{
while (n--)
{
*(z + *(y++)) += *(sign++) * (*(x++));
}
}
 template void Vmath::Assmb ( int n, const Nektar::NekDouble * sign, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 T Vmath::Ddot ( int n, const Array< OneD, const T > & w, const int incw, const Array< OneD, const T > & x, const int incx, const Array< OneD, const int > & y, const int incy )

Definition at line 426 of file VmathArray.hpp.

References ASSERTL1, and Dot2().

{
ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
return Dot2(n,&w[0],incw,&x[0],incx,&y[0],incy);
}
template<class T >
 T Vmath::Dot ( int n, const Array< OneD, const T > & w, const Array< OneD, const T > & x )

Definition at line 391 of file VmathArray.hpp.

References ASSERTL1, and Dot().

{
ASSERTL1(n <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Dot(n,&w[0],&x[0]);
}
template<class T >
 T Vmath::Dot ( int n, const Array< OneD, const T > & w, const int incw, const Array< OneD, const T > & x, const int incx )

Definition at line 402 of file VmathArray.hpp.

References ASSERTL1, and Dot().

{
ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Dot(n,&w[0],incw,&x[0],incx);
}
template<class T >
 T Vmath::Dot ( int n, const T * w, const T * x )

vvtvp (vector times vector times vector): z = w*x*y

Definition at line 865 of file Vmath.cpp.

{
T sum = 0;
while( n-- )
{
sum += (*w) * (*x);
++w;
++x;
}
return sum;
}
 template Nektar::NekDouble Vmath::Dot ( int n, const Nektar::NekDouble * w, const Nektar::NekDouble * x )
template<class T >
 T Vmath::Dot ( int n, const T * w, const int incw, const T * x, const int incx )

vvtvp (vector times vector times vector): z = w*x*y

Definition at line 885 of file Vmath.cpp.

{
T sum = 0;
while( n-- )
{
sum += (*w) * (*x);
w += incw;
x += incx;
}
return sum;
}
 template Nektar::NekDouble Vmath::Dot ( int n, const Nektar::NekDouble * w, const int incw, const Nektar::NekDouble * x, const int incx )
template<class T >
 T Vmath::Dot2 ( int n, const Array< OneD, const T > & w, const Array< OneD, const T > & x, const Array< OneD, const int > & y )

Definition at line 413 of file VmathArray.hpp.

References ASSERTL1, and Dot2().

{
ASSERTL1(n <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n <= y.num_elements()+y.GetOffset(),"Array out of bounds");
return Dot2(n,&w[0],&x[0],&y[0]);
}
template<class T >
 T Vmath::Dot2 ( int n, const T * w, const T * x, const int * y )

vvtvp (vector times vector times vector): z = w*x*y

Definition at line 905 of file Vmath.cpp.

{
T sum = 0;
while( n-- )
{
sum += (*y == 1 ? (*w) * (*x) : 0 );
++w;
++x;
++y;
}
return sum;
}
 template Nektar::NekDouble Vmath::Dot2 ( int n, const Nektar::NekDouble * w, const Nektar::NekDouble * x, const int * y )
template<class T >
 T Vmath::Dot2 ( int n, const T * w, const int incw, const T * x, const int incx, const int * y, const int incy )

vvtvp (vector times vector times vector): z = w*x*y

Definition at line 929 of file Vmath.cpp.

{
T sum = 0;
while( n-- )
{
sum += (*y == 1 ? (*w) * (*x) : 0.0 );
w += incw;
x += incx;
y += incy;
}
return sum;
}
 template Nektar::NekDouble Vmath::Dot2 ( int n, const Nektar::NekDouble * w, const int incw, const Nektar::NekDouble * x, const int incx, const int * y, const int incy )
template<class T >
 void Vmath::Fill ( int n, const T alpha, T * x, const int incx )
template<class T >
 void Vmath::Fill ( int n, const T alpha, Array< OneD, T > & x, const int incx )

Fill a vector with a constant value.

Definition at line 48 of file VmathArray.hpp.

References ASSERTL1, and Fill().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Out of bounds");
Fill(n,alpha,&x[0],incx);
}
 template void Vmath::Fill ( int n, const Nektar::NekDouble alpha, Nektar::NekDouble * x, const int incx )
template<class T >
 void Vmath::FillWhiteNoise ( int n, const T eps, Array< OneD, T > & x, const int incx, int outseed )

Definition at line 56 of file VmathArray.hpp.

References ASSERTL1, and FillWhiteNoise().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Out of bounds");
FillWhiteNoise(n,eps,&x[0],incx,outseed);
}
template<class T >
 void Vmath::FillWhiteNoise ( int n, const T eps, T * x, const int incx, int outseed )

Fills a vector with white noise.

Definition at line 137 of file Vmath.cpp.

{
while( n-- )
{
static int iset = 0;
static T gset;
long seed = long(outseed);
T fac, rsq, v1, v2;
if (iset == 0) {
do {
v1 = 2.0 * ran2<T> (&seed) - 1.0;
v2 = 2.0 * ran2<T> (&seed) - 1.0;
rsq = v1*v1 + v2*v2;
} while (rsq >= 1.0 || rsq == 0.0);
fac = sqrt(-2.0 * log (rsq) / rsq);
gset = v1 * fac;
iset = 1;
*x = eps * v2 * fac;
} else {
iset = 0;
*x = eps * gset;
}
x += incx;
}
}
 template void Vmath::FillWhiteNoise ( int n, const Nektar::NekDouble eps, Nektar::NekDouble * x, const int incx, int outseed )
template<class T >
 void Vmath::Gathr ( int n, const Array< OneD, const T > & x, const Array< OneD, const int > & y, Array< OneD, T > & z )

Gather vector z[i] = x[y[i]].

Definition at line 296 of file VmathArray.hpp.

References ASSERTL1, and Gathr().

{
ASSERTL1(n <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Gathr(n,&x[0],&y[0],&z[0]);
}
template<class T >
 void Vmath::Gathr ( int n, const T * x, const int * y, T * z )

Gather vector z[i] = x[y[i]].

Definition at line 627 of file Vmath.cpp.

{
while (n--)
{
*z++ = *(x + *y++);
}
return;
}
 template void Vmath::Gathr ( int n, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 void Vmath::Gathr ( int n, const T * sign, const T * x, const int * y, T * z )

Gather vector z[i] = sign[i]*x[y[i]].

Definition at line 642 of file Vmath.cpp.

{
while (n--)
{
*z++ = *(sign++) * (*(x + *y++));
}
return;
}
 template void Vmath::Gathr ( int n, const Nektar::NekDouble * sign, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 int Vmath::Iamax ( int n, const Array< OneD, const T > & x, const int incx )

Return the index of the maximum absolute element in x.

Definition at line 355 of file VmathArray.hpp.

References ASSERTL1, and Iamax().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Iamax(n,&x[0],incx);
}
template<class T >
 int Vmath::Iamax ( int n, const T * x, const int incx )

Return the index of the maximum absolute element in x.

Definition at line 774 of file Vmath.cpp.

Referenced by Iamax().

{
int i, indx = ( n > 0 ) ? 0 : -1;
T xmax = *x;
T xm;
for (i = 0; i < n; i++)
{
xm = (*x > 0)? *x: -*x;
if (xm > xmax)
{
xmax = xm;
indx = i;
}
x += incx;
}
return indx;
}
 template int Vmath::Iamax ( int n, const Nektar::NekDouble * x, const int incx )
template<class T >
 int Vmath::Imax ( int n, const Array< OneD, const T > & x, const int incx )

Return the index of the maximum element in x.

Definition at line 338 of file VmathArray.hpp.

References ASSERTL1, and Imax().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Imax(n,&x[0],incx);
}
template<class T >
 int Vmath::Imax ( int n, const T * x, const int incx )

Return the index of the maximum element in x.

Definition at line 729 of file Vmath.cpp.

{
int i, indx = ( n > 0 ) ? 0 : -1;
T xmax = *x;
for (i = 0; i < n; i++)
{
if (*x > xmax)
{
xmax = *x;
indx = i;
}
x += incx;
}
return indx;
}
 template int Vmath::Imax ( int n, const Nektar::NekDouble * x, const int incx )
 template int Vmath::Imax ( int n, const int * x, const int incx )
template<class T >
 int Vmath::Imin ( int n, const Array< OneD, const T > & x, const int incx )

Return the index of the minimum element in x.

Definition at line 374 of file VmathArray.hpp.

References ASSERTL1, and Imin().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Imin(n,&x[0],incx);
}
template<class T >
 int Vmath::Imin ( int n, const T * x, const int incx )

Return the index of the minimum element in x.

Definition at line 821 of file Vmath.cpp.

{
int i, indx = ( n > 0 ) ? 0 : -1;
T xmin = *x;
for(i = 0;i < n;i++)
{
if( *x < xmin )
{
xmin = *x;
indx = i;
}
x += incx;
}
return indx;
}
 template int Vmath::Imin ( int n, const Nektar::NekDouble * x, const int incx )
template<class T >
 void Vmath::Neg ( int n, Array< OneD, T > & x, const int incx )

Negate x = -x.

Definition at line 154 of file VmathArray.hpp.

References ASSERTL1, and Neg().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
Neg(n,&x[0],incx);
}
 template void Vmath::Neg ( int n, Nektar::NekDouble * x, const int incx )
template<class T >
 T Vmath::ran2 ( long * idum )

Generates a number from ~Normal(0,1)

Definition at line 73 of file Vmath.cpp.

References AM, IA1, IA2, IM1, IM2, IMM1, IQ1, IQ2, IR1, IR2, NDIV, NTAB, and RNMX.

{
int j;
long k;
static long idum2=123456789;
static long iy=0;
static long iv[NTAB];
T temp;
if (*idum <= 0) {
if (-(*idum) < 1) *idum = 1;
else *idum = -(*idum);
idum2 = (*idum);
for (j=NTAB+7; j>=0; j--) {
k = (*idum) / IQ1;
*idum = IA1 * (*idum - k*IQ1) - k*IR1;
if (*idum < 0) *idum += IM1;
if (j < NTAB) iv[j] = *idum;
}
iy = iv[0];
}
k = (*idum) / IQ1;
*idum = IA1*(*idum - k*IQ1) - k*IR1;
if (*idum < 0) *idum += IM1;
k = idum2 / IQ2;
idum2 = IA2*(idum2 - k*IQ2) - k*IR2;
if (idum2 < 0) idum2 += IM2;
j = iy / NDIV;
iy = iv[j] - idum2;
iv[j] = *idum;
if (iy < 1) iy += IMM1;
if ((temp=AM*iy) > RNMX) return RNMX;
else return temp;
}
template<class T >
 void Vmath::Reverse ( int n, const Array< OneD, const T > & x, int incx, Array< OneD, T > & y, int const incy )

Definition at line 448 of file VmathArray.hpp.

References ASSERTL1, and Reverse().

{
ASSERTL1(static_cast<unsigned int>(std::abs(n*incx)) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(std::abs(n*incy)) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Reverse(n,&x[0],incx,&y[0],incy);
}
template<class T >
 void Vmath::Reverse ( int n, const T * x, const int incx, T * y, const int incy )

Definition at line 1036 of file Vmath.cpp.

{
int i;
T store;
int nloop = n/2;
// copy value in case of n is odd number
y[nloop] = x[nloop];
for(i = 0; i < nloop; ++i)
{
store = x[n-1-i];
y[n-1-i] = x[i];
y[i] = store;
}
}
 template void Vmath::Reverse ( int n, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Sadd ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

Add vector y = alpha + x.

Definition at line 124 of file VmathArray.hpp.

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
}
template<class T >
 void Vmath::Sadd ( int n, const T alpha, const T * x, const int incx, T * y, const int incy )

Add vector y = alpha + x.

Definition at line 298 of file Vmath.cpp.

{
++n;
if (incx == 1 && incy == 1)
{
while( --n )
{
*y = alpha + (*x);
++x;
++y;
}
}
else
{
while( --n )
{
*y = alpha + (*x);
x += incx;
y += incy;
}
}
}
 template void Vmath::Sadd ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Scatr ( int n, const Array< OneD, const T > & x, const Array< OneD, const int > & y, Array< OneD, T > & z )

Scatter vector z[y[i]] = x[i].

Definition at line 307 of file VmathArray.hpp.

References ASSERTL1, and Scatr().

{
ASSERTL1(n <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Scatr(n,&x[0],&y[0],&z[0]);
}
template<class T >
 void Vmath::Scatr ( int n, const T * x, const int * y, T * z )

Scatter vector z[y[i]] = x[i].

Definition at line 656 of file Vmath.cpp.

{
while (n--)
{
*(z + *(y++)) = *(x++);
}
}
 template void Vmath::Scatr ( int n, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 void Vmath::Scatr ( int n, const T * sign, const T * x, const int * y, T * z )

Scatter vector z[y[i]] = sign[i]*x[i].

Definition at line 669 of file Vmath.cpp.

{
while (n--)
{
*(z + *(y++)) = *(sign++) * (*(x++));
}
}
 template void Vmath::Scatr ( int n, const Nektar::NekDouble * sign, const Nektar::NekDouble * x, const int * y, Nektar::NekDouble * z )
template<class T >
 void Vmath::Sdiv ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

Scalar multiply y = alpha/y.

Definition at line 104 of file VmathArray.hpp.

References ASSERTL1, and Sdiv().

{
ASSERTL1(static_cast<unsigned int>(n*incx) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incy) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Sdiv(n,alpha,&x[0],incx,&y[0],incy);
}
template<class T >
 void Vmath::Sdiv ( int n, const T alpha, const T * x, const int incx, T * y, const int incy )

Scalar multiply y = alpha/y.

Definition at line 254 of file Vmath.cpp.

{
++n;
if (incx == 1 && incy == 1)
{
while( --n )
{
*y = alpha / (*x);
++x;
++y;
}
}
else
{
while( --n )
{
*y = alpha / (*x);
x += incx;
y += incy;
}
}
}
 template void Vmath::Sdiv ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Smul ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

Scalar multiply y = alpha*y.

Definition at line 84 of file VmathArray.hpp.

References ASSERTL1, and Smul().

{
ASSERTL1(static_cast<unsigned int>(n*incx) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incy) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Smul(n,alpha, &x[0],incx,&y[0],incy);
}
 template void Vmath::Smul ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Svtsvtp ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, const T beta, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

svtsvtp (scalar times vector plus scalar times vector): z = alpha*x + beta*y

Definition at line 281 of file VmathArray.hpp.

References ASSERTL1, and Svtsvtp().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Svtsvtp(n,alpha,&x[0],incx,beta,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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):

Svtsvtp (scalar times vector plus scalar times vector):

Definition at line 574 of file Vmath.cpp.

{
while( n-- )
{
*z = alpha * (*x) + beta * (*y);
x += incx;
y += incy;
z += incz;
}
}
 template void Vmath::Svtsvtp ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, int incx, const Nektar::NekDouble beta, const Nektar::NekDouble * y, int incy, Nektar::NekDouble * z, int incz )
template<class T >
 void Vmath::Svtvm ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

svtvp (scalar times vector plus vector): z = alpha*x + y

Definition at line 240 of file VmathArray.hpp.

References ASSERTL1, and Svtvm().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Svtvm(n,alpha,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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

Definition at line 501 of file Vmath.cpp.

Referenced by Svtvm(), and Nektar::CourtemancheRamirezNattel98::v_Update().

{
while( n-- )
{
*z = alpha * (*x) - (*y);
x += incx;
y += incy;
z += incz;
}
}
 template void Vmath::Svtvm ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::Svtvp ( int n, const T alpha, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

svtvp (scalar times vector plus vector): z = alpha*x + y

Definition at line 229 of file VmathArray.hpp.

References ASSERTL1, and Svtvp().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Svtvp(n,alpha,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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

Definition at line 468 of file Vmath.cpp.

{
++n;
if (incx == 1 && incy == 1 && incz == 1)
{
while( --n )
{
*z = alpha * (*x) + (*y);
++x;
++y;
++z;
}
}
else
{
while( --n )
{
*z = alpha * (*x) + (*y);
x += incx;
y += incy;
z += incz;
}
}
}
 template void Vmath::Svtvp ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::Vabs ( int n, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

vabs: y = |x|

Definition at line 197 of file VmathArray.hpp.

References ASSERTL1, and Vabs().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vabs(n,&x[0],incx,&y[0],incy);
}
template<class T >
 void Vmath::Vabs ( int n, const T * x, const int incx, T * y, const int incy )

vabs: y = |x|

Definition at line 407 of file Vmath.cpp.

{
while( n-- )
{
*y = ( *x >0)? *x:-(*x);
x += incx;
y += incy;
}
}
 template void Vmath::Vabs ( int n, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Vadd ( int n, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Definition at line 113 of file VmathArray.hpp.

{
ASSERTL1(static_cast<unsigned int>(n*incx) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incy) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incz) <= z.num_elements()+z.GetOffset(),"Array out of bounds");
}
 template void Vmath::Vadd ( int n, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 T Vmath::Vamax ( int n, const Array< OneD, const T > & x, const int incx )

Return the maximum absolute element in x called vamax to avoid conflict with max.

Definition at line 365 of file VmathArray.hpp.

References ASSERTL1, and Vamax().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Vamax(n,&x[0],incx);
}
template<class T >
 T Vmath::Vamax ( int n, const T * x, const int incx )

Return the maximum absolute element in x called vamax to avoid conflict with max.

Definition at line 799 of file Vmath.cpp.

Referenced by Nektar::StdRegions::StdExpansion::Linf(), and Vamax().

{
T xmax = *x;
T xm;
while( n-- )
{
xm = (*x > 0)? *x: -*x;
if (xm > xmax)
{
xmax = xm;
}
x += incx;
}
return xmax;
}
 template Nektar::NekDouble Vmath::Vamax ( int n, const Nektar::NekDouble * x, const int incx )
template<class T >
 void Vmath::Vcopy ( int n, const Array< OneD, const T > & x, int incx, Array< OneD, T > & y, int const incy )

Definition at line 440 of file VmathArray.hpp.

References ASSERTL1, and Vcopy().

{
ASSERTL1(static_cast<unsigned int>(std::abs(n*incx)) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(std::abs(n*incy)) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vcopy(n,&x[0],incx,&y[0],incy);
}
 template void Vmath::Vcopy ( int n, const int * x, const int incx, int * y, const int incy )
 template void Vmath::Vcopy ( int n, const unsigned int * x, const int incx, unsigned int * y, const int incy )
 template void Vmath::Vcopy ( int n, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::Vdiv ( int n, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Multiply vector z = x/y.

Definition at line 93 of file VmathArray.hpp.

References ASSERTL1, and Vdiv().

{
ASSERTL1(static_cast<unsigned int>(n*incx) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incy) <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(static_cast<unsigned int>(n*incz) <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vdiv(n,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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.

Definition at line 224 of file Vmath.cpp.

{
++n;
if (incx == 1 && incy == 1)
{
while( --n )
{
*z = (*x) / (*y);
++x;
++y;
++z;
}
}
else
{
while( --n )
{
*z = (*x) / (*y);
x += incx;
y += incy;
z += incz;
}
}
}
 template void Vmath::Vdiv ( int n, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::Vexp ( int n, const T * x, const int incx, T * y, const int incy )

Definition at line 107 of file Vmath.hpp.

{
while (n--)
{
*y = exp( *x );
x += incx;
y += incy;
}
}
template<class T >
 void Vmath::Vexp ( int n, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

Definition at line 171 of file VmathArray.hpp.

References ASSERTL1, and Vexp().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vexp(n, &x[0], incx, &y[0], incy);
}
template<class T >
 void Vmath::Vlog ( int n, const T * x, const int incx, T * y, const int incy )

Definition at line 95 of file Vmath.hpp.

Referenced by Nektar::CourtemancheRamirezNattel98::v_Update(), and Vlog().

{
while (n--)
{
*y = log( *x );
x += incx;
y += incy;
}
}
template<class T >
 void Vmath::Vlog ( int n, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

Definition at line 162 of file VmathArray.hpp.

References ASSERTL1, and Vlog().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vlog(n, &x[0], incx, &y[0], incy);
}
template<class T >
 T Vmath::Vmax ( int n, const Array< OneD, const T > & x, const int incx )

Return the maximum element in x – called vmax to avoid conflict with max.

Definition at line 347 of file VmathArray.hpp.

References ASSERTL1, and Vmax().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Vmax(n,&x[0],incx);
}
template<class T >
 T Vmath::Vmax ( int n, const T * x, const int incx )

Return the maximum element in x – called vmax to avoid conflict with max.

Definition at line 753 of file Vmath.cpp.

{
T xmax = *x;
while( n-- )
{
if (*x > xmax)
{
xmax = *x;
}
x += incx;
}
return xmax;
}
 template Nektar::NekDouble Vmath::Vmax ( int n, const Nektar::NekDouble * x, const int incx )
 template int Vmath::Vmax ( int n, const int * x, const int incx )
template<class T >
 T Vmath::Vmin ( int n, const Array< OneD, const T > & x, const int incx )

Return the minimum element in x - called vmin to avoid conflict with min.

Definition at line 383 of file VmathArray.hpp.

References ASSERTL1, and Vmin().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Vmin(n,&x[0],incx);
}
template<class T >
 T Vmath::Vmin ( int n, const T * x, const int incx )

Return the minimum element in x - called vmin to avoid conflict with min.

Definition at line 844 of file Vmath.cpp.

{
T xmin = *x;
while( n-- )
{
if (*x < xmin)
{
xmin = *x;
}
x += incx;
}
return xmin;
}
 template Nektar::NekDouble Vmath::Vmin ( int n, const Nektar::NekDouble * x, const int incx )
 template int Vmath::Vmin ( int n, const int * x, const int incx )
template<class T >
 void Vmath::Vmul ( int n, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Multiply vector z = x*y.

Definition at line 64 of file VmathArray.hpp.

References ASSERTL1, and Vmul().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vmul(n,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::Vmul ( int n, const Array< TwoD, NekDouble >::const_reference & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Definition at line 73 of file VmathArray.hpp.

References ASSERTL1, and Vmul().

{
ASSERTL1(n*incx <= x.num_elements(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vmul(n,x.origin(),incx,&y[0],incy,&z[0],incz);
}
 template void Vmath::Vmul ( int n, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::Vpow ( int n, const T * x, const int incx, const T f, T * y, const int incy )

Definition at line 118 of file Vmath.hpp.

Referenced by Nektar::CourtemancheRamirezNattel98::v_Update(), and Vpow().

{
while (n--)
{
*y = pow( *x, f );
x += incx;
y += incy;
}
}
template<class T >
 void Vmath::Vpow ( int n, const Array< OneD, const T > & x, const int incx, const T f, Array< OneD, T > & y, const int incy )

Definition at line 179 of file VmathArray.hpp.

References ASSERTL1, and Vpow().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vpow(n, &x[0], incx, f, &y[0], incy);
}
template<class T >
 void Vmath::Vsqrt ( int n, const Array< OneD, const T > & x, const int incx, Array< OneD, T > & y, const int incy )

sqrt y = sqrt(x)

Definition at line 188 of file VmathArray.hpp.

References ASSERTL1, and Vsqrt().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
Vsqrt(n,&x[0],incx,&y[0],incy);
}
template<class T >
 void Vmath::Vsqrt ( int n, const T * x, const int incx, T * y, const int incy )

sqrt y = sqrt(x)

Definition at line 391 of file Vmath.cpp.

{
while (n--)
{
*y = sqrt( *x );
x += incx;
y += incy;
}
}
 template void Vmath::Vsqrt ( int n, const Nektar::NekDouble * x, const int incx, Nektar::NekDouble * y, const int incy )
template<class T >
 void Vmath::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):

Definition at line 600 of file Vmath.cpp.

{
while( n-- )
{
*z = alpha * (*v) + (*w) + (*x);
v += incv;
w += incw;
x += incx;
z += incz;
}
}
 template void Vmath::Vstvpp ( int n, const Nektar::NekDouble alpha, const Nektar::NekDouble * v, int incv, const Nektar::NekDouble * w, int incw, const Nektar::NekDouble * x, int incx, Nektar::NekDouble * z, int incz )
template<class T >
 void Vmath::Vsub ( int n, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Subtract vector z = x-y.

Definition at line 134 of file VmathArray.hpp.

References ASSERTL1, and Vsub().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vsub(n,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::Vsub ( int n, const T * x, const int incx, const T * y, const int incy, T * z, const int incz )
 template void Vmath::Vsub ( int n, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 T Vmath::Vsum ( int n, const Array< OneD, const T > & x, const int incx )

Subtract return sum(x)

Definition at line 329 of file VmathArray.hpp.

References ASSERTL1, and Vsum().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
return Vsum(n,&x[0],incx);
}
template<class T >
 T Vmath::Vsum ( int n, const T * x, const int incx )

Subtract return sum(x)

Definition at line 711 of file Vmath.cpp.

{
T sum = 0;
while( n-- )
{
sum += (*x);
x += incx;
}
return sum;
}
 template Nektar::NekDouble Vmath::Vsum ( int n, const Nektar::NekDouble * x, const int incx )
 template int Vmath::Vsum ( int n, const int * x, const int incx )
template<class T >
 void Vmath::Vvtvm ( int n, const Array< OneD, const T > & w, const int incw, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

vvtvm (vector times vector minus vector): z = w*x - y

Definition at line 251 of file VmathArray.hpp.

References ASSERTL1, and Vvtvm().

{
ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vvtvm(n,&w[0],incw,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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

Definition at line 448 of file Vmath.cpp.

{
while( n-- )
{
*z = (*w) * (*x) - (*y);
w += incw;
x += incx;
y += incy;
z += incz;
}
}
 template void Vmath::Vvtvm ( int n, const Nektar::NekDouble * w, const int incw, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::Vvtvp ( int n, const Array< OneD, const T > & w, const int incw, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

vvtvp (vector times vector plus vector): z = w*x + y

Definition at line 208 of file VmathArray.hpp.

References ASSERTL1, and Vvtvp().

{
ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vvtvp(n,&w[0],incw,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::Vvtvp ( int n, const Array< TwoD, NekDouble >::const_reference & w, const int incw, const Array< OneD, const T > & x, const int incx, const Array< OneD, const T > & y, const int incy, Array< OneD, T > & z, const int incz )

Definition at line 218 of file VmathArray.hpp.

References ASSERTL1, and Vvtvp().

{
ASSERTL1(n*incw <= w.num_elements(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vvtvp(n,w.origin(),incw,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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 )
 template void Vmath::Vvtvp ( int n, const Nektar::NekDouble * w, const int incw, const Nektar::NekDouble * x, const int incx, const Nektar::NekDouble * y, const int incy, Nektar::NekDouble * z, const int incz )
template<class T >
 void Vmath::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):

Definition at line 547 of file Vmath.cpp.

{
while( n-- )
{
*z = (*v) * (*w) - (*x) * (*y);
v += incv;
w += incw;
x += incx;
y += incy;
z += incz;
}
}
 template void Vmath::Vvtvvtm ( int n, const Nektar::NekDouble * v, int incv, const Nektar::NekDouble * w, int incw, const Nektar::NekDouble * x, int incx, const Nektar::NekDouble * y, int incy, Nektar::NekDouble * z, int incz )
template<class T >
 void Vmath::Vvtvvtp ( int n, const Array< OneD, const T > & v, int incv, const Array< OneD, const T > & w, int incw, const Array< OneD, const T > & x, int incx, const Array< OneD, const T > & y, int incy, Array< OneD, T > & z, int incz )

vvtvvtp (vector times vector plus vector times vector): z = v*w + y*z

Definition at line 263 of file VmathArray.hpp.

References ASSERTL1, and Vvtvvtp().

{
ASSERTL1(n*incv <= v.num_elements()+v.GetOffset(),"Array out of bounds");
ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
ASSERTL1(n*incz <= z.num_elements()+z.GetOffset(),"Array out of bounds");
Vvtvvtp(n,&v[0],incv,&w[0],incw,&x[0],incx,&y[0],incy,&z[0],incz);
}
template<class T >
 void Vmath::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):

Definition at line 520 of file Vmath.cpp.

{
while( n-- )
{
*z = (*v) * (*w) + (*x) * (*y);
v += incv;
w += incw;
x += incx;
y += incy;
z += incz;
}
}
 template void Vmath::Vvtvvtp ( int n, const Nektar::NekDouble * v, int incv, const Nektar::NekDouble * w, int incw, const Nektar::NekDouble * x, int incx, const Nektar::NekDouble * y, int incy, Nektar::NekDouble * z, int incz )
template<class T >
 void Vmath::Zero ( int n, Array< OneD, T > & x, const int incx )

Zero vector.

Definition at line 145 of file VmathArray.hpp.

References ASSERTL1, and Zero().

{
ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
Zero(n,&x[0],incx);
}
 template void Vmath::Zero ( int n, Nektar::NekDouble * x, const int incx )
 template void Vmath::Zero ( int n, int * x, const int incx )
 template void Vmath::Zero ( int n, long * x, const int incx )