Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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

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

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

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

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