Nektar++
VDmath Namespace Reference

## Functions

template<class T >
Ddot2 (Nektar::LibUtilities::CommSharedPtr &pComm, int n, const T *w, const T *x, const int *y)
vvtvp (vector times vector times vector): z = w*x*y
template<class T >
Ddot2 (Nektar::LibUtilities::CommSharedPtr &pComm, 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<class T >
Ddot2 (LibUtilities::CommSharedPtr &pComm, int n, const Array< OneD, const T > &w, const Array< OneD, const T > &x, const Array< OneD, const int > &y)
template<class T >
Ddot2 (LibUtilities::CommSharedPtr &pComm, 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)

## Function Documentation

template<class T >
 T VDmath::Ddot2 ( Nektar::LibUtilities::CommSharedPtr & pComm, int n, const T * w, const T * x, const int * y )

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

Definition at line 45 of file VDmath.hpp.

References Nektar::LibUtilities::ReduceSum.

Referenced by Ddot2().

{
T sum = 0;
while( n-- )
{
sum += (*y == 1 ? (*w) * (*x) : 0 );
++w;
++x;
++y;
}
pComm->AllReduce(sum, Nektar::LibUtilities::ReduceSum);
return sum;
}
template<class T >
 T VDmath::Ddot2 ( LibUtilities::CommSharedPtr & pComm, int n, const Array< OneD, const T > & w, const Array< OneD, const T > & x, const Array< OneD, const int > & y )

Definition at line 49 of file VDmathArray.hpp.

References ASSERTL1, and Ddot2().

{
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 Ddot2(pComm, n,&w[0],&x[0],&y[0]);
}
template<class T >
 T VDmath::Ddot2 ( LibUtilities::CommSharedPtr & pComm, 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 62 of file VDmathArray.hpp.

References ASSERTL1, and Ddot2().

{
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 Ddot2(pComm, n,&w[0],incw,&x[0],incx,&y[0],incy);
}
template<class T >
 T VDmath::Ddot2 ( Nektar::LibUtilities::CommSharedPtr & pComm, 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 65 of file VDmath.hpp.

References Nektar::LibUtilities::ReduceSum.

{
T sum = 0;
while( n-- )
{
sum += (*y == 1 ? (*w) * (*x) : 0.0 );
w += incw;
x += incx;
y += incy;
}
pComm->AllReduce(sum, Nektar::LibUtilities::ReduceSum);
return sum;
}