SG++-Doxygen-Documentation
sgpp::pde::UpDownTwoOpDims Class Referenceabstract

Implements the Up/Down scheme with two dimensions with special operations: i,j. More...

#include <UpDownTwoOpDims.hpp>

Inheritance diagram for sgpp::pde::UpDownTwoOpDims:
sgpp::base::OperationMatrix

Public Member Functions

virtual void mult (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result)
 starts the Multiplication with the matrix More...
 
void multParallelBuildingBlock (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t operationDimOne, size_t operationDimTwo)
 this functions provides the same functionality as the normal mult routine. More...
 
 UpDownTwoOpDims (sgpp::base::GridStorage *storage, sgpp::base::DataMatrix &coef)
 Constructor. More...
 
 UpDownTwoOpDims (sgpp::base::GridStorage *storage)
 Constructor. More...
 
virtual ~UpDownTwoOpDims ()
 Destructor. More...
 
- Public Member Functions inherited from sgpp::base::OperationMatrix
 OperationMatrix ()
 Constructor. More...
 
virtual ~OperationMatrix ()
 Destructor. More...
 

Protected Types

typedef sgpp::base::GridStorage::grid_iterator grid_iterator
 

Protected Member Functions

virtual void down (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 Down-step in dimension dim for \((\phi_i(x),\phi_j(x))_{L_2}\). More...
 
virtual void downOpDimOne (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D down if the current dim is equal to i More...
 
virtual void downOpDimOneAndOpDimTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D down, if the current dim is equal to i and j More...
 
virtual void downOpDimTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D down if the current dim is equal to j More...
 
void specialOpOne (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim, size_t op_dim_one, size_t op_dim_two)
 All calculations for gradient, parallel version using OpenMP 3. More...
 
void specialOpOneAndOpTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim, size_t op_dim_one, size_t op_dim_two)
 if the current dimension is equal to the both special operation dimensions More...
 
void specialOpTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim, size_t op_dim_one, size_t op_dim_two)
 All calculations for gradient, Part 2, parallel version using OpenMP 3. More...
 
virtual void up (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 Up-step in dimension dim for \((\phi_i(x),\phi_j(x))_{L_2}\). More...
 
void updown (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim, size_t op_dim_one, size_t op_dim_two)
 Recursive procedure for updown, parallel version using OpenMP 3. More...
 
virtual void upOpDimOne (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D up if the current dim is equal to i More...
 
virtual void upOpDimOneAndOpDimTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D up, if the current dim is equal to i and j More...
 
virtual void upOpDimTwo (sgpp::base::DataVector &alpha, sgpp::base::DataVector &result, size_t dim)=0
 1D up if the current dim is equal to j More...
 

Protected Attributes

const std::vector< size_t > algoDims
 algorithmic dimensions, operator is applied in this dimensions More...
 
sgpp::base::DataMatrixcoefs
 Pointer to the coefficients of this bilinear form. More...
 
const size_t numAlgoDims_
 number of algorithmic dimensions More...
 
sgpp::base::GridStoragestorage
 Pointer to the grid's storage object. More...
 

Static Protected Attributes

static const size_t maxParallelDims_ = TASKS_PARALLEL_UPDOWN
 max number of parallel stages (dimension recursive calls) More...
 

Detailed Description

Implements the Up/Down scheme with two dimensions with special operations: i,j.

Parallelization with OpenMP 2 / 3 is supported!

Only symmetric operations are support –> only the "left lower triangular matrix", i <= j, is calculated, please keep that in mind when designing the coefficient vector: the non-diagonal elements must be multiplied by 2 before executing this Up/down scheme!

Member Typedef Documentation

◆ grid_iterator

Constructor & Destructor Documentation

◆ UpDownTwoOpDims() [1/2]

sgpp::pde::UpDownTwoOpDims::UpDownTwoOpDims ( sgpp::base::GridStorage storage,
sgpp::base::DataMatrix coef 
)

Constructor.

Parameters
storagethe grid's sgpp::base::GridStorage object
coefvector that contains the constant coefficients of this operation

◆ UpDownTwoOpDims() [2/2]

sgpp::pde::UpDownTwoOpDims::UpDownTwoOpDims ( sgpp::base::GridStorage storage)
explicit

Constructor.

Parameters
storagethe grid's sgpp::base::GridStorage object

◆ ~UpDownTwoOpDims()

sgpp::pde::UpDownTwoOpDims::~UpDownTwoOpDims ( )
virtual

Destructor.

Member Function Documentation

◆ down()

virtual void sgpp::pde::UpDownTwoOpDims::down ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

Down-step in dimension dim for \((\phi_i(x),\phi_j(x))_{L_2}\).

Applies the down-part of the one-dimensional mass matrix in one dimension. Computes

\[\int_{x=0}^1 \phi_i(x) \sum_{j, l_i\geq l_j} \alpha_j \phi_j(x) dx.\]

Parameters
dimdimension in which to apply the down-part
alphavector of coefficients
resultvector to store the results in

Referenced by updown().

◆ downOpDimOne()

virtual void sgpp::pde::UpDownTwoOpDims::downOpDimOne ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D down if the current dim is equal to i

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that down-Gradient is applied

Referenced by specialOpOne().

◆ downOpDimOneAndOpDimTwo()

virtual void sgpp::pde::UpDownTwoOpDims::downOpDimOneAndOpDimTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D down, if the current dim is equal to i and j

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that down-Gradient is applied

Referenced by specialOpOneAndOpTwo().

◆ downOpDimTwo()

virtual void sgpp::pde::UpDownTwoOpDims::downOpDimTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D down if the current dim is equal to j

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that down-Gradient is applied

Referenced by specialOpTwo().

◆ mult()

void sgpp::pde::UpDownTwoOpDims::mult ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result 
)
virtual

starts the Multiplication with the matrix

Parameters
alphaDataVector that contains the ansatzfunctions' coefficients
resultDataVector into which the result of the Laplace operation is stored

Implements sgpp::base::OperationMatrix.

References sgpp::base::DataVector::add(), sgpp::base::DataVector::axpy(), coefs, sgpp::base::DataMatrix::get(), sgpp::base::DataVector::getSize(), python.statsfileInfo::i, python.utils.statsfile2gnuplot::j, numAlgoDims_, sgpp::base::DataVector::setAll(), and updown().

◆ multParallelBuildingBlock()

void sgpp::pde::UpDownTwoOpDims::multParallelBuildingBlock ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  operationDimOne,
size_t  operationDimTwo 
)

this functions provides the same functionality as the normal mult routine.

However, it doesn't set up an OpenMP task initialization as the mult routine. This method has to be called within a OpenMP task parallelized region.

Using this function is useful in the following case: Assuming the solver of a certain Equation requires several operators in the space discretization (e.g. Black Scholes Equations) this method can be used to parallelize their calculation which might result in a better parallel efficiency on systems with 4 or more cores hence fewer barriers are needed.

For a full calculation of this operator, in mult serval number of up/downs are needed. This number is equal to the square of the number of the grid's dimensions. All different steps can be executed in parallel. Here only one up/Down is executed, identified by its special dimensions.

Attention: A symmetric operator is assumed: This method only start a calculation if operationDimTwo is less or equal operationDimOne

Parameters
alphavector of coefficients
resultvector to store the results in
operationDimOneDimension in which the first special operator is applied
operationDimTwoDimension in which the second special operator is applied

References sgpp::base::DataVector::add(), sgpp::base::DataVector::axpy(), coefs, sgpp::base::DataMatrix::get(), sgpp::base::DataVector::getSize(), numAlgoDims_, sgpp::base::DataVector::setAll(), and updown().

◆ specialOpOne()

void sgpp::pde::UpDownTwoOpDims::specialOpOne ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim,
size_t  op_dim_one,
size_t  op_dim_two 
)
protected

All calculations for gradient, parallel version using OpenMP 3.

Parameters
alphathe coefficients of the grid points
resultthe result of the operations
dimthe current dimension in the recursion
op_dim_onethe dimension in which to use the first gradient
op_dim_twothe dimension in which to use the second gradient

References sgpp::base::DataVector::add(), algoDims, downOpDimOne(), sgpp::base::DataVector::getSize(), maxParallelDims_, numAlgoDims_, updown(), and upOpDimOne().

Referenced by updown().

◆ specialOpOneAndOpTwo()

void sgpp::pde::UpDownTwoOpDims::specialOpOneAndOpTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim,
size_t  op_dim_one,
size_t  op_dim_two 
)
protected

if the current dimension is equal to the both special operation dimensions

Parameters
alphathe coefficients of the grid points
resultthe result of the operations
dimthe current dimension in the recursion
op_dim_onethe dimension in which to use the first gradient
op_dim_twothe dimension in which to use the second gradient

References sgpp::base::DataVector::add(), algoDims, downOpDimOneAndOpDimTwo(), sgpp::base::DataVector::getSize(), maxParallelDims_, numAlgoDims_, updown(), and upOpDimOneAndOpDimTwo().

Referenced by updown().

◆ specialOpTwo()

void sgpp::pde::UpDownTwoOpDims::specialOpTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim,
size_t  op_dim_one,
size_t  op_dim_two 
)
protected

All calculations for gradient, Part 2, parallel version using OpenMP 3.

Parameters
alphathe coefficients of the grid points
resultthe result of the operations
dimthe current dimension in the recursion
op_dim_onethe dimension in which to use the first gradient
op_dim_twothe dimension in which to use the second gradient

References sgpp::base::DataVector::add(), algoDims, downOpDimTwo(), sgpp::base::DataVector::getSize(), maxParallelDims_, numAlgoDims_, updown(), and upOpDimTwo().

Referenced by updown().

◆ up()

virtual void sgpp::pde::UpDownTwoOpDims::up ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

Up-step in dimension dim for \((\phi_i(x),\phi_j(x))_{L_2}\).

Applies the up-part of the one-dimensional mass matrix in one dimension. Computes

\[\int_{x=0}^1 \phi_i(x) \sum_{j, l_i < l_j} \alpha_j \phi_j(x) dx.\]

Parameters
dimdimension in which to apply the up-part
alphavector of coefficients
resultvector to store the results in

Referenced by updown().

◆ updown()

void sgpp::pde::UpDownTwoOpDims::updown ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim,
size_t  op_dim_one,
size_t  op_dim_two 
)
protected

Recursive procedure for updown, parallel version using OpenMP 3.

Parameters
dimthe current dimension
op_dim_onethe dimension in which to use the first gradient
op_dim_twothe dimension in which to use the second gradient
alphavector of coefficients
resultvector to store the results in

References sgpp::base::DataVector::add(), algoDims, down(), sgpp::base::DataVector::getSize(), maxParallelDims_, numAlgoDims_, specialOpOne(), specialOpOneAndOpTwo(), specialOpTwo(), and up().

Referenced by mult(), multParallelBuildingBlock(), specialOpOne(), specialOpOneAndOpTwo(), and specialOpTwo().

◆ upOpDimOne()

virtual void sgpp::pde::UpDownTwoOpDims::upOpDimOne ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D up if the current dim is equal to i

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that up-Gradient is applied

Referenced by specialOpOne().

◆ upOpDimOneAndOpDimTwo()

virtual void sgpp::pde::UpDownTwoOpDims::upOpDimOneAndOpDimTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D up, if the current dim is equal to i and j

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that up-Gradient is applied

Referenced by specialOpOneAndOpTwo().

◆ upOpDimTwo()

virtual void sgpp::pde::UpDownTwoOpDims::upOpDimTwo ( sgpp::base::DataVector alpha,
sgpp::base::DataVector result,
size_t  dim 
)
protectedpure virtual

1D up if the current dim is equal to j

Parameters
alphathe coefficients of the gridpoints
resultvector with the result of this operation
dimthe dimension in that up-Gradient is applied

Referenced by specialOpTwo().

Member Data Documentation

◆ algoDims

const std::vector<size_t> sgpp::pde::UpDownTwoOpDims::algoDims
protected

algorithmic dimensions, operator is applied in this dimensions

Referenced by specialOpOne(), specialOpOneAndOpTwo(), specialOpTwo(), and updown().

◆ coefs

sgpp::base::DataMatrix* sgpp::pde::UpDownTwoOpDims::coefs
protected

Pointer to the coefficients of this bilinear form.

Referenced by mult(), and multParallelBuildingBlock().

◆ maxParallelDims_

const size_t sgpp::pde::UpDownTwoOpDims::maxParallelDims_ = TASKS_PARALLEL_UPDOWN
staticprotected

max number of parallel stages (dimension recursive calls)

Referenced by specialOpOne(), specialOpOneAndOpTwo(), specialOpTwo(), and updown().

◆ numAlgoDims_

const size_t sgpp::pde::UpDownTwoOpDims::numAlgoDims_
protected

number of algorithmic dimensions

Referenced by mult(), multParallelBuildingBlock(), specialOpOne(), specialOpOneAndOpTwo(), specialOpTwo(), and updown().

◆ storage

sgpp::base::GridStorage* sgpp::pde::UpDownTwoOpDims::storage
protected

Pointer to the grid's storage object.


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