Global MPI operations
Functions | Variables
vdop.cpp File Reference
#include "vdop.h"
#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>

Functions

void vddiv (vector< double > &x, vector< double > const &y, vector< double > const &z)
 
void vdaxpy (std::vector< double > &x, std::vector< double > const &y, double alpha, std::vector< double > const &z)
 Element-wise daxpy operation x(k) = y(k) + alpha*z(k). More...
 
double dscapr (std::vector< double > const &x, std::vector< double > const &y)
 Calculates the Euclidean inner product of two vectors. More...
 
bool CompareVectors (std::vector< double > const &x, int const n, double const y[], double const eps)
 Compares an STL vector with POD vector. More...
 
void Send_ProcD (const int to, vector< double > const &xin, MPI_Comm const &icomm)
 
void Recv_ProcD (const int from, vector< double > &xout, MPI_Comm const &icomm)
 
void ExchangeD (const int yourid, vector< double > const &xin, vector< double > &xout, MPI_Comm const &icomm)
 
double par_scalar (vector< double > const &x, vector< double > const &y, MPI_Comm const &icomm)
 
void ExchangeAll (vector< double > const &xin, vector< double > &yout, MPI_Comm const &icomm)
 
void ExchangeAllInPlace (vector< double > &xin, MPI_Comm const &icomm)
 

Variables

const int TAG1 = 1
 
const int TAG2 = 2
 

Function Documentation

◆ CompareVectors()

bool CompareVectors ( std::vector< double > const &  x,
int  n,
double const  y[],
double const  eps = 0.0 
)

Compares an STL vector with POD vector.

The accuracy criteria \( |x_k-y_k| < \varepsilon \left({1+0.5(|x_k|+|y_k|)}\right) \) follows the book by Stoyan/Baran, p.8.

Parameters
[in]xSTL vector
[in]nlength of POD vector
[in]yPOD vector
[in]epsrelative accuracy criteria (default := 0.0).
Returns
true iff pairwise vector elements are relatively close to each other.

◆ dscapr()

double dscapr ( std::vector< double > const &  x,
std::vector< double > const &  y 
)

Calculates the Euclidean inner product of two vectors.

Parameters
[in]xvector
[in]yvector
Returns
Euclidean inner product \(\langle x,y \rangle\)

◆ ExchangeAll()

void ExchangeAll ( vector< double > const &  xin,
vector< double > &  yout,
MPI_Comm const &  icomm 
)

◆ ExchangeAllInPlace()

void ExchangeAllInPlace ( vector< double > &  xin,
MPI_Comm const &  icomm 
)

◆ ExchangeD()

void ExchangeD ( const int  yourid,
vector< double > const &  xin,
vector< double > &  xout,
MPI_Comm const &  icomm 
)

◆ par_scalar()

double par_scalar ( vector< double > const &  x,
vector< double > const &  y,
MPI_Comm const &  icomm 
)

◆ Recv_ProcD()

void Recv_ProcD ( const int  from,
vector< double > &  xout,
MPI_Comm const &  icomm 
)

◆ Send_ProcD()

void Send_ProcD ( const int  to,
vector< double > const &  xin,
MPI_Comm const &  icomm 
)

◆ vdaxpy()

void vdaxpy ( std::vector< double > &  x,
std::vector< double > const &  y,
double  alpha,
std::vector< double > const &  z 
)

Element-wise daxpy operation x(k) = y(k) + alpha*z(k).

Parameters
[out]xtarget vector
[in]ysource vector
[in]alphascalar
[in]zsource vector

◆ vddiv()

void vddiv ( vector< double > &  x,
vector< double > const &  y,
vector< double > const &  z 
)

Variable Documentation

◆ TAG1

const int TAG1 = 1

◆ TAG2

const int TAG2 = 2