Nektar++
Functions
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 More...
 
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 More...
 
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

◆ Ddot2() [1/4]

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 44 of file VDmath.hpp.

References Nektar::LibUtilities::ReduceSum.

Referenced by Ddot2().

49  {
50  T sum = 0;
51 
52  while( n-- )
53  {
54  sum += (*y == 1 ? (*w) * (*x) : 0 );
55  ++w;
56  ++x;
57  ++y;
58  }
59  pComm->AllReduce(sum, Nektar::LibUtilities::ReduceSum);
60  return sum;
61  }

◆ Ddot2() [2/4]

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 48 of file VDmathArray.hpp.

References ASSERTL1, and Ddot2().

52  {
53  ASSERTL1(n <= w.num_elements()+w.GetOffset(),"Array out of bounds");
54  ASSERTL1(n <= x.num_elements()+x.GetOffset(),"Array out of bounds");
55  ASSERTL1(n <= y.num_elements()+y.GetOffset(),"Array out of bounds");
56 
57  return Ddot2(pComm, n,&w[0],&x[0],&y[0]);
58  }
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)
Definition: VDmathArray.hpp:61
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ Ddot2() [3/4]

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 61 of file VDmathArray.hpp.

References ASSERTL1, and Ddot2().

65  {
66  ASSERTL1(n*incw <= w.num_elements()+w.GetOffset(),"Array out of bounds");
67  ASSERTL1(n*incx <= x.num_elements()+x.GetOffset(),"Array out of bounds");
68  ASSERTL1(n*incy <= y.num_elements()+y.GetOffset(),"Array out of bounds");
69 
70  return Ddot2(pComm, n,&w[0],incw,&x[0],incx,&y[0],incy);
71  }
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)
Definition: VDmathArray.hpp:61
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250

◆ Ddot2() [4/4]

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 64 of file VDmath.hpp.

References Nektar::LibUtilities::ReduceSum.

69  {
70  T sum = 0;
71 
72  while( n-- )
73  {
74  sum += (*y == 1 ? (*w) * (*x) : 0.0 );
75  w += incw;
76  x += incx;
77  y += incy;
78  }
79  pComm->AllReduce(sum, Nektar::LibUtilities::ReduceSum);
80  return sum;
81  }