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)
 dot2 (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)
 dot2 (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 ( 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.

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

References ASSERTL1, and Ddot2().

◆ Ddot2() [2/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.

65 {
66  ASSERTL1(n * incw <= w.size() + w.GetOffset(), "Array out of bounds");
67  ASSERTL1(n * incx <= x.size() + x.GetOffset(), "Array out of bounds");
68  ASSERTL1(n * incy <= y.size() + y.GetOffset(), "Array out of bounds");
69 
70  return Ddot2(pComm, n, &w[0], incw, &x[0], incx, &y[0], incy);
71 }

References ASSERTL1, and Ddot2().

◆ Ddot2() [3/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 
)

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

Definition at line 63 of file VDmath.hpp.

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

References Nektar::LibUtilities::ReduceSum.

◆ Ddot2() [4/4]

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

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

Definition at line 45 of file VDmath.hpp.

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

References Nektar::LibUtilities::ReduceSum.

Referenced by Ddot2().