SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::datadriven::DataVectorDistributed Class Reference

#include <DataVectorDistributed.hpp>

Public Member Functions

void add (const DataVectorDistributed &x)
 Adds another vector to this vector, modifies this vector.
 
void copyFrom (const DataVectorDistributed &other)
 Copies all values of another distributed data matrix to this object, resizes this object to the size of the other matrix.
 
 DataVectorDistributed (double *input, std::shared_ptr< BlacsProcessGrid > grid, size_t globalSize, size_t blockSize)
 Creates a distributed data vector with specified input data.
 
 DataVectorDistributed (std::shared_ptr< BlacsProcessGrid > grid, size_t globalSize, size_t blockSize, double value=0.0)
 Creates a distributed data vector of specified size and initializes the elements to value.
 
void distribute (double *input, int masterRow=0, int masterCol=0)
 Distribute the input data to the process grid.
 
double dot (const DataVectorDistributed &y) const
 
double get (size_t row) const
 Returns the value of the element at position [row].
 
size_t getBlockSize () const
 
int * getDescriptor ()
 
const int * getDescriptor () const
 
size_t getGlobalRows () const
 Returns the number of rows of the DataMatrix.
 
double * getLocalPointer ()
 
const double * getLocalPointer () const
 
size_t getLocalRows () const
 
DataMatrixDistributedgetMatrix ()
 
const DataMatrixDistributedgetMatrix () const
 
std::shared_ptr< BlacsProcessGridgetProcessGrid () const
 
size_t globalToLocalRowIndex (size_t globalRowIndex) const
 Calculates the local row index from the globalRowIndex.
 
size_t globalToRowProcessIndex (size_t globalRowIndex) const
 Calculates the row process index from the global row index.
 
bool isProcessMapped () const
 
size_t localToGlobalRowIndex (size_t localRowIndex) const
 Calculates the global row index from the local row index.
 
double operator() (size_t row) const
 Returns the value of the element at position [row].
 
void printVector () const
 Prints the vector on stdout on process 0.
 
void resize (size_t rows)
 Resizes the vector to rows, discards the data.
 
void scale (double a)
 Scales this vector by factor a.
 
void set (size_t row, double value)
 Sets the element at global position [row] to value.
 
void setAll (double value)
 Set all entries of the vector to one value.
 
DataVector toLocalDataVector () const
 
void toLocalDataVector (DataVector &localVector) const
 
DataVector toLocalDataVectorBroadcast () const
 
void toLocalDataVectorBroadcast (DataVector &localVector) const
 

Static Public Member Functions

static void add (DataVectorDistributed &y, const DataVectorDistributed &x, double a=1.0)
 Performs the following operation sub(y) := sub(y) + a*sub(x)
 
static double dot (const DataVectorDistributed &x, const DataVectorDistributed &y)
 

Constructor & Destructor Documentation

◆ DataVectorDistributed() [1/2]

sgpp::datadriven::DataVectorDistributed::DataVectorDistributed ( std::shared_ptr< BlacsProcessGrid grid,
size_t  globalSize,
size_t  blockSize,
double  value = 0.0 
)

Creates a distributed data vector of specified size and initializes the elements to value.

Parameters
gridblacs grid for distribution
globalSizeglobal size (rows) of this vector
blockSizesize for each block (one process might receive multiple blocks)
valueInitial value of all elements, default 0.0

◆ DataVectorDistributed() [2/2]

sgpp::datadriven::DataVectorDistributed::DataVectorDistributed ( double *  input,
std::shared_ptr< BlacsProcessGrid grid,
size_t  globalSize,
size_t  blockSize 
)

Creates a distributed data vector with specified input data.

Parameters
inputpointer to input values for this vector
gridblacs grid for distribution
globalSizeglobal size (rows) of this vector
blockSizesize for each block (one process might receive multiple blocks)

Member Function Documentation

◆ add() [1/2]

void sgpp::datadriven::DataVectorDistributed::add ( const DataVectorDistributed x)

Adds another vector to this vector, modifies this vector.

Parameters
xvector that is added to this vector

References add().

Referenced by add(), and sgpp::datadriven::AlgorithmMultipleEvaluationDistributed< BASIS >::mult_transpose().

◆ add() [2/2]

void sgpp::datadriven::DataVectorDistributed::add ( DataVectorDistributed y,
const DataVectorDistributed x,
double  a = 1.0 
)
static

Performs the following operation sub(y) := sub(y) + a*sub(x)

Parameters
y
x
afactor for x, default 1.0

References getDescriptor(), getGlobalRows(), getLocalPointer(), and isProcessMapped().

◆ copyFrom()

void sgpp::datadriven::DataVectorDistributed::copyFrom ( const DataVectorDistributed other)

Copies all values of another distributed data matrix to this object, resizes this object to the size of the other matrix.

References sgpp::datadriven::DataMatrixDistributed::copyFrom(), and getMatrix().

◆ distribute()

void sgpp::datadriven::DataVectorDistributed::distribute ( double *  input,
int  masterRow = 0,
int  masterCol = 0 
)

Distribute the input data to the process grid.

Overwrites the current data. For more information, see DataMatrixDistributed::distribute

Parameters
inputinput data
masterRowrow of the process that distributes the data
masterColcol of the process that distributes the data

References sgpp::datadriven::DataMatrixDistributed::distribute().

Referenced by sgpp::datadriven::AlgorithmMultipleEvaluationDistributed< BASIS >::mult_transpose().

◆ dot() [1/2]

double sgpp::datadriven::DataVectorDistributed::dot ( const DataVectorDistributed x,
const DataVectorDistributed y 
)
static
Parameters
x
y
Returns
dot = sub(x)'*sub(y); vector x is transposed

References dot(), getDescriptor(), getGlobalRows(), getLocalPointer(), and isProcessMapped().

◆ dot() [2/2]

double sgpp::datadriven::DataVectorDistributed::dot ( const DataVectorDistributed y) const
Parameters
y
Returns
the dot product of this vector transposed and y

References dot().

Referenced by dot(), and dot().

◆ get()

double sgpp::datadriven::DataVectorDistributed::get ( size_t  row) const

Returns the value of the element at position [row].

Parameters
rowRow
Returns
Value of the element

References sgpp::datadriven::DataMatrixDistributed::get().

◆ getBlockSize()

size_t sgpp::datadriven::DataVectorDistributed::getBlockSize ( ) const

◆ getDescriptor() [1/2]

int * sgpp::datadriven::DataVectorDistributed::getDescriptor ( )

◆ getDescriptor() [2/2]

const int * sgpp::datadriven::DataVectorDistributed::getDescriptor ( ) const
Returns
const pointer to the descriptor array for the underlying data matrix

References sgpp::datadriven::DataMatrixDistributed::getDescriptor().

Referenced by python.uq.parameters.ParameterBuilder.GeneralParameterBuilder::new().

◆ getGlobalRows()

size_t sgpp::datadriven::DataVectorDistributed::getGlobalRows ( ) const

Returns the number of rows of the DataMatrix.

Returns
Number of rows

References sgpp::datadriven::DataMatrixDistributed::getGlobalCols().

Referenced by add(), dot(), sgpp::datadriven::AlgorithmMultipleEvaluationDistributed< BASIS >::mult_transpose(), and scale().

◆ getLocalPointer() [1/2]

◆ getLocalPointer() [2/2]

const double * sgpp::datadriven::DataVectorDistributed::getLocalPointer ( ) const
Returns
const pointer to the local data of this process

References sgpp::datadriven::DataMatrixDistributed::getLocalPointer().

◆ getLocalRows()

size_t sgpp::datadriven::DataVectorDistributed::getLocalRows ( ) const

◆ getMatrix() [1/2]

DataMatrixDistributed & sgpp::datadriven::DataVectorDistributed::getMatrix ( )
Returns
reference to the underlying DataMatrixDistributed object.

Referenced by copyFrom().

◆ getMatrix() [2/2]

const DataMatrixDistributed & sgpp::datadriven::DataVectorDistributed::getMatrix ( ) const
Returns
const ref to the underlying DataMatrixDistributed object.

◆ getProcessGrid()

std::shared_ptr< BlacsProcessGrid > sgpp::datadriven::DataVectorDistributed::getProcessGrid ( ) const

◆ globalToLocalRowIndex()

size_t sgpp::datadriven::DataVectorDistributed::globalToLocalRowIndex ( size_t  globalRowIndex) const

Calculates the local row index from the globalRowIndex.

Parameters
globalRowIndex

References sgpp::datadriven::DataMatrixDistributed::globalToLocalColumnIndex().

◆ globalToRowProcessIndex()

size_t sgpp::datadriven::DataVectorDistributed::globalToRowProcessIndex ( size_t  globalRowIndex) const

Calculates the row process index from the global row index.

Parameters
globalRowIndex

References sgpp::datadriven::DataMatrixDistributed::globalToColumnProcessIndex().

◆ isProcessMapped()

bool sgpp::datadriven::DataVectorDistributed::isProcessMapped ( ) const

◆ localToGlobalRowIndex()

size_t sgpp::datadriven::DataVectorDistributed::localToGlobalRowIndex ( size_t  localRowIndex) const

◆ operator()()

double sgpp::datadriven::DataVectorDistributed::operator() ( size_t  row) const

Returns the value of the element at position [row].

Only a const version exists as setting an element is not necessarily done in local memory.

Parameters
rowRow
Returns
constant reference to the element

◆ printVector()

void sgpp::datadriven::DataVectorDistributed::printVector ( ) const

Prints the vector on stdout on process 0.

References toLocalDataVector(), and sgpp::base::DataVector::toString().

◆ resize()

void sgpp::datadriven::DataVectorDistributed::resize ( size_t  rows)

Resizes the vector to rows, discards the data.

Parameters
rows

References sgpp::datadriven::DataMatrixDistributed::resize().

Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOffParallel::adapt().

◆ scale()

void sgpp::datadriven::DataVectorDistributed::scale ( double  a)

Scales this vector by factor a.

Parameters
a

References getDescriptor(), getGlobalRows(), getLocalPointer(), and isProcessMapped().

Referenced by sgpp::datadriven::DBMatOnlineDE::evalParallel().

◆ set()

void sgpp::datadriven::DataVectorDistributed::set ( size_t  row,
double  value 
)

Sets the element at global position [row] to value.

Parameters
rowGlobal row
valueNew value for element

References sgpp::datadriven::DataMatrixDistributed::set().

◆ setAll()

void sgpp::datadriven::DataVectorDistributed::setAll ( double  value)

Set all entries of the vector to one value.

Parameters
value

References sgpp::datadriven::DataMatrixDistributed::setAll().

Referenced by sgpp::datadriven::AlgorithmMultipleEvaluationDistributed< BASIS >::mult_transpose().

◆ toLocalDataVector() [1/2]

◆ toLocalDataVector() [2/2]

void sgpp::datadriven::DataVectorDistributed::toLocalDataVector ( DataVector localVector) const
Parameters
[out]localVectorthe gathered DataVector on process (0, 0)

References sgpp::datadriven::DataMatrixDistributed::toLocalDataMatrix().

◆ toLocalDataVectorBroadcast() [1/2]

◆ toLocalDataVectorBroadcast() [2/2]

void sgpp::datadriven::DataVectorDistributed::toLocalDataVectorBroadcast ( DataVector localVector) const
Parameters
[out]localVectorthe broadcaster DataVector on all processes

References sgpp::datadriven::DataMatrixDistributed::toLocalDataMatrixBroadcast().


The documentation for this class was generated from the following files: