v2DM-DOCI
1.0
|
#include <BlockStructure.h>
Public Member Functions | |
BlockStructure (int) | |
BlockStructure (const BlockStructure< BlockType > &) | |
BlockStructure (BlockStructure< BlockType > &&) | |
virtual | ~BlockStructure ()=default |
void | setDim (int, int, int) |
BlockStructure & | operator= (const BlockStructure< BlockType > &) |
BlockStructure & | operator= (BlockStructure< BlockType > &&) |
BlockStructure & | operator= (double) |
BlockStructure & | operator+= (const BlockStructure< BlockType > &) |
BlockStructure & | operator-= (const BlockStructure< BlockType > &) |
BlockStructure & | daxpy (double alpha, const BlockStructure< BlockType > &) |
BlockStructure & | operator*= (double) |
BlockStructure & | operator/= (double) |
BlockType & | operator[] (int block) |
const BlockType & | operator[] (int block) const |
double & | operator() (int block, int i, int j) |
double | operator() (int block, int i, int j) const |
double & | operator() (int block, int index) |
double | operator() (int block, int index) const |
int | gnr () const |
int | gdim (int) const |
int | gdeg (int) const |
double | trace () const |
double | ddot (const BlockStructure< BlockType > &) const |
void | dscal (double alpha) |
double | min () const |
double | max () const |
void | fill_Random () |
void | fill_Random (int) |
virtual void | invert () |
virtual void | sqrt (int) |
virtual void | L_map (const BlockStructure< BlockType > &, const BlockStructure< BlockType > &) |
virtual BlockStructure< BlockType > & | mprod (const BlockStructure< BlockType > &, const BlockStructure< BlockType > &) |
void | symmetrize () |
void | sort () |
virtual void | sep_pm (BlockStructure< BlockType > &, BlockStructure< BlockType > &) |
template<> | |
double & | operator() (int block, int i, int j) |
template<> | |
double | operator() (int block, int i, int j) const |
template<> | |
double & | operator() (int block, int index) |
template<> | |
double | operator() (int block, int index) const |
template<> | |
void | sort () |
Private Attributes | |
std::vector< std::unique_ptr< BlockType > > | blocks |
std::vector< int > | degen |
degeneracy of the blocks More... | |
Friends | |
template<class MyBlockType > | |
std::ostream & | operator<< (std::ostream &output, const doci2DM::BlockStructure< MyBlockType > &blocks_p) |
Definition at line 45 of file BlockStructure.h.
BlockStructure::BlockStructure | ( | int | nr | ) |
constructor: Watch out, the matrices themself haven't been allocated yet. Only the Blockmatrix itself is allocated and the array containing the dimensions, but not initialized.
nr | number of blocks in the blockmatrix |
Definition at line 38 of file BlockStructure.cpp.
BlockStructure::BlockStructure | ( | const BlockStructure< BlockType > & | blockmat_copy | ) |
copy constructor, make sure the input matrix and all the blocks have been allocated and filled before the copying
blockmat_copy | The blockmatrix you want to be copied into the object you are constructing |
Definition at line 50 of file BlockStructure.cpp.
BlockStructure::BlockStructure | ( | BlockStructure< BlockType > && | blockmat_copy | ) |
Definition at line 62 of file BlockStructure.cpp.
|
virtualdefault |
BlockStructure< BlockType > & BlockStructure::daxpy | ( | double | alpha, |
const BlockStructure< BlockType > & | blockmat_pl | ||
) |
add the matrix matrix_pl times the constant alpha to this
alpha | the constant to multiply the matrix_pl with |
blockmat_pl | the BlockStructure to be multiplied by alpha and added to this |
Definition at line 172 of file BlockStructure.cpp.
double BlockStructure::ddot | ( | const BlockStructure< BlockType > & | blocks_in | ) | const |
blocks_in | input matrix |
Definition at line 293 of file BlockStructure.cpp.
void BlockStructure::dscal | ( | double | alpha | ) |
Scale the blocks (*this) with parameter alpha
alpha | scalefactor |
Definition at line 320 of file BlockStructure.cpp.
void BlockStructure::fill_Random | ( | ) |
Fill the matrix with random numbers.
Definition at line 331 of file BlockStructure.cpp.
void BlockStructure::fill_Random | ( | int | seed | ) |
Fill the matrix with random numbers.
seed | the seed to use |
Definition at line 342 of file BlockStructure.cpp.
int BlockStructure::gdeg | ( | int | i | ) | const |
Definition at line 268 of file BlockStructure.cpp.
int BlockStructure::gdim | ( | int | i | ) | const |
Definition at line 259 of file BlockStructure.cpp.
int BlockStructure::gnr | ( | ) | const |
Definition at line 250 of file BlockStructure.cpp.
|
virtual |
Invert positive semidefinite symmetric blocks which is stored in (*this), original matrix (*this) is destroyed
Reimplemented in doci2DM::PHM.
Definition at line 308 of file BlockStructure.cpp.
|
virtual |
Multiply symmetric blocks object left en right with symmetric blocks map to form another symmetric blocks and put it in (*this): this = map*object*map
map | BlockStructure that will be multiplied to the left en to the right of matrix object |
object | central BlockStructure |
Definition at line 367 of file BlockStructure.cpp.
double doci2DM::BlockStructure< BlockType >::max | ( | ) | const |
double doci2DM::BlockStructure< BlockType >::min | ( | ) | const |
|
virtual |
BlockStructure product of two general blockmatrices A en B, put result in this
A | left matrix |
B | right matrix |
Definition at line 380 of file BlockStructure.cpp.
double& doci2DM::BlockStructure< BlockType >::operator() | ( | int | block, |
int | i, | ||
int | j | ||
) |
double doci2DM::BlockStructure< BlockType >::operator() | ( | int | block, |
int | i, | ||
int | j | ||
) | const |
double& doci2DM::BlockStructure< BlockType >::operator() | ( | int | block, |
int | index | ||
) |
double doci2DM::BlockStructure< BlockType >::operator() | ( | int | block, |
int | index | ||
) | const |
double & doci2DM::BlockStructure< Matrix >::operator() | ( | int | block, |
int | i, | ||
int | j | ||
) |
write access to your blocks, change the number in block "block", on row i and column j
block | The index of the block you want to access |
i | row number |
j | column number |
Definition at line 214 of file BlockStructure.cpp.
double doci2DM::BlockStructure< Matrix >::operator() | ( | int | block, |
int | i, | ||
int | j | ||
) | const |
read access to your blocks, read the number in block "block" on row i and column j
block | The index of the block you want to access |
i | row number |
j | column number |
Definition at line 227 of file BlockStructure.cpp.
double & doci2DM::BlockStructure< Vector >::operator() | ( | int | block, |
int | index | ||
) |
Definition at line 233 of file BlockStructure.cpp.
double doci2DM::BlockStructure< Vector >::operator() | ( | int | block, |
int | index | ||
) | const |
Definition at line 239 of file BlockStructure.cpp.
BlockStructure< BlockType > & BlockStructure::operator*= | ( | double | c | ) |
Definition at line 196 of file BlockStructure.cpp.
BlockStructure< BlockType > & BlockStructure::operator+= | ( | const BlockStructure< BlockType > & | blockmat_pl | ) |
overload the += operator for matrices
blockmat_pl | The matrix you want to add to this |
Definition at line 143 of file BlockStructure.cpp.
BlockStructure< BlockType > & BlockStructure::operator-= | ( | const BlockStructure< BlockType > & | blockmat_pl | ) |
overload the -= operator for matrices
blockmat_pl | The matrix you want to deduct from this |
Definition at line 157 of file BlockStructure.cpp.
BlockStructure< BlockType > & BlockStructure::operator/= | ( | double | c | ) |
/= operator overloaded: divide by a constant
c | the number to divide your matrix through |
Definition at line 186 of file BlockStructure.cpp.
BlockStructure< BlockType > & BlockStructure::operator= | ( | const BlockStructure< BlockType > & | blockmat_copy | ) |
overload the equality operator: Make sure the blocks in both matrices have been allocated to the same dimensions and have the same degeneracy!
blockmat_copy | The matrix you want to be copied into this |
Definition at line 113 of file BlockStructure.cpp.
BlockStructure& doci2DM::BlockStructure< BlockType >::operator= | ( | BlockStructure< BlockType > && | ) |
BlockStructure< BlockType > & BlockStructure::operator= | ( | double | a | ) |
Make all the numbers in your blocks equal to the number a, e.g. usefull for initialization (BlockStructure M = 0)
a | the number |
Definition at line 129 of file BlockStructure.cpp.
BlockType & BlockStructure::operator[] | ( | int | block | ) |
[] overloaded, will return a reference to the block block in the blocks.
block | index of the block to be returned |
Definition at line 91 of file BlockStructure.cpp.
const BlockType & BlockStructure::operator[] | ( | int | block | ) | const |
[] overloaded, const version, will return a const reference to the block block in the blocks.
block | index of the block to be returned |
Definition at line 102 of file BlockStructure.cpp.
|
virtual |
Definition at line 410 of file BlockStructure.cpp.
void BlockStructure::setDim | ( | int | block, |
int | dim, | ||
int | degeneracy | ||
) |
function that allocates the memory of the blocks block with dimension dim sets and the degeneracy of the matrix
block | the index of the block that will be allocated |
dim | the dimension of the particular block to be allocated |
degeneracy | the degeneracy of block "block" |
Definition at line 76 of file BlockStructure.cpp.
void doci2DM::BlockStructure< BlockType >::sort | ( | ) |
void doci2DM::BlockStructure< Vector >::sort | ( | ) |
Definition at line 402 of file BlockStructure.cpp.
|
virtual |
Take the square root out of the positive semidefinite blocks, destroys original blocks, square root will be put in (*this)
option | = 1, positive square root, = -1, negative square root. |
Reimplemented in doci2DM::PHM.
Definition at line 353 of file BlockStructure.cpp.
void BlockStructure::symmetrize | ( | ) |
Copy upper triangle into lower triangle.
Definition at line 393 of file BlockStructure.cpp.
double BlockStructure::trace | ( | ) | const |
Definition at line 277 of file BlockStructure.cpp.
|
friend |
Output stream operator overloaded, the usage is simple, if you want to print to a file, make an ifstream object and type:
object << blockmatrix << endl;
For output onto the screen type:
cout << blockmatrix << endl;
output | The stream to which you are writing (e.g. cout) |
blocks_p | the BlockMatrix you want to print |
Definition at line 420 of file BlockStructure.cpp.
|
private |
Definition at line 150 of file BlockStructure.h.
|
private |
degeneracy of the blocks
Definition at line 153 of file BlockStructure.h.