C++ mpi module for stochmagnet_main Package
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
SM_PackedBlockMatrix< T, P > Class Template Referenceabstract

This class described a matrix by packed block of size \( P \times P \) in a row storage. More...

#include <SM_PackedBlockMatrix.h>

Inheritance diagram for SM_PackedBlockMatrix< T, P >:
Inheritance graph
[legend]
Collaboration diagram for SM_PackedBlockMatrix< T, P >:
Collaboration graph
[legend]

Public Member Functions

virtual tMemSize getMemorySize () const
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual tMemSize getContentsMemorySize () const
 return the memory size of the included associations More...
 
virtual void reset ()=0
 reset the values
 
virtual void setSize (const tInteger &nRowBlocks, const tInteger &nColBlocks)
 set the number or rows & columns of the blocks matrix More...
 
const tInteger & getRowBlocksNumber () const
 get the number of row blowks
 
const tInteger & getColumnBlocksNumber () const
 get the number of column blocks
 
virtual void setValue (const tIndex &i, const tIndex &j, const T &v)=0
 set values at row i and column j More...
 
virtual const T & getValue (const tIndex &i, const tIndex &j) const =0
 get values at row i and column j for reading More...
 
virtual T & getValue (const tIndex &i, const tIndex &j)=0
 get values at row i and column j for writing More...
 
virtual void vectorProduct (const T *vX, T *vY) const =0
 vector product More...
 
virtual tString toString () const override
 return string representaton of the operator
 
- Public Member Functions inherited from CORE_Object
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Static Public Attributes

static constexpr tUCInt BLOCK_SIZE =P*(P+1)/2
 size of the block in packed storage with diagonal
 

Protected Member Functions

 SM_PackedBlockMatrix (void)
 create a matrix of size 0
 
virtual ~SM_PackedBlockMatrix (void)
 destroy
 
- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Static Protected Member Functions

static tIndex GetPackedIndex (const tIndex &i, const tIndex &j)
 return the pack index of size Q in a column storage More...
 
static void BlockVectorProduct (const T *B, const T *X, T *Y, const T *eY, const T *Xi, const T *Xj, T *Yi, T *Yj)
 compute sthe vector product of the packed symmetric block B of dimension P by X to obtain Y=B.X More...
 

Additional Inherited Members

- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Detailed Description

template<typename T, tUCInt P>
class SM_PackedBlockMatrix< T, P >

This class described a matrix by packed block of size \( P \times P \) in a row storage.

Template Parameters
T: type of the elemment of the block of the matrix
P: size of the block \( P \times P \)
Author
Stephane Despreaux
Version
2.0

Member Function Documentation

◆ BlockVectorProduct()

template<typename T , tUCInt P>
static void SM_PackedBlockMatrix< T, P >::BlockVectorProduct ( const T *  B,
const T *  X,
T *  Y,
const T *  eY,
const T *  Xi,
const T *  Xj,
T *  Yi,
T *  Yj 
)
inlinestaticprotected

compute sthe vector product of the packed symmetric block B of dimension P by X to obtain Y=B.X

Parameters
[in]B: begin iterator on block values of size \( P.(P+1)/2 \)
[in]X: begin iteration on vector values of size P
[in]Y: begin iterator on result vector values of size P
[in]eY: end iterator on result vector values of size \( eY=Y+P\)
[in,out]Xiconstant work pointer on X
[in,out]Xjconstant work pointer on X
[in,out]Yiwork pointer on Y
[in,out]Yjwork pointer on Y

◆ getContentsMemorySize()

template<typename T , tUCInt P>
virtual tMemSize SM_PackedBlockMatrix< T, P >::getContentsMemorySize ( ) const
inlinevirtual

return the memory size of the included associations

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

Reimplemented from CORE_Object.

Reimplemented in SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.

◆ getMemorySize()

template<typename T , tUCInt P>
virtual tMemSize SM_PackedBlockMatrix< T, P >::getMemorySize ( ) const
inlinevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes The mamory size is :
  • the added size of the base classes which contains:
    • the primary attributes size depends on the order: (first delare the smallest attributes size
    • all virtual functions costs <pointer-size> (4 32xor 8 64x) bytes by virtual function
    • virtual inherihtance will increase of (4 or 8) bytes
  • we add the size of the contains values of the attributes : for example the size of a string is the length of the string 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Object.

Reimplemented in SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.

◆ GetPackedIndex()

template<typename T , tUCInt P>
static tIndex SM_PackedBlockMatrix< T, P >::GetPackedIndex ( const tIndex &  i,
const tIndex &  j 
)
inlinestaticprotected

return the pack index of size Q in a column storage

Parameters
[in]i: index of the row of the block of memory size Q
[in]j: index of the column of the block of memory size Q
Returns
(j.(j+1)/2 + i )

◆ getValue() [1/2]

template<typename T , tUCInt P>
virtual const T& SM_PackedBlockMatrix< T, P >::getValue ( const tIndex &  i,
const tIndex &  j 
) const
pure virtual

get values at row i and column j for reading

Parameters
[in]i: index of the row i in [0,nRowBlocks x P[
[in]jindex of the column j in [ [0,nCollocks x P[ return value at index i,j

Implemented in SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.

◆ getValue() [2/2]

template<typename T , tUCInt P>
virtual T& SM_PackedBlockMatrix< T, P >::getValue ( const tIndex &  i,
const tIndex &  j 
)
pure virtual

get values at row i and column j for writing

Parameters
[in]i: index of the row i in [0,nRowBlocks x P[
[in]jindex of the column j in [ [0,nCollocks x P[ return value at index i,j

Implemented in SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.

◆ setSize()

template<typename T , tUCInt P>
virtual void SM_PackedBlockMatrix< T, P >::setSize ( const tInteger &  nRowBlocks,
const tInteger &  nColBlocks 
)
inlinevirtual

set the number or rows & columns of the blocks matrix

Parameters
[in]nRowBlocksnumber of blocks in rows
[in]nColBlocksnumber of blocks in columns

◆ setValue()

template<typename T , tUCInt P>
virtual void SM_PackedBlockMatrix< T, P >::setValue ( const tIndex &  i,
const tIndex &  j,
const T &  v 
)
pure virtual

set values at row i and column j

Parameters
[in]i: index of the row i in [0,nRowBlocks x P[
[in]jindex of the column j in [ [0,nCollocks x P[
[in]v: value

Implemented in SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.

◆ vectorProduct()

template<typename T , tUCInt P>
virtual void SM_PackedBlockMatrix< T, P >::vectorProduct ( const T *  vX,
T *  vY 
) const
pure virtual

vector product

Parameters
[in]vXvalues of X vector
[out]vY: values of return vector Y=A.X

Implemented in SMOMPI_PackedBlockSymmetricMatrix< T, P >, SM_PackedBlockSymmetricMatrix< T, P >, and SM_PackedBlockGeneralMatrix< T, P >.


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