#include <bmatrix.h>
Public Member Functions | |
bmatrix (const bmatrix &mat) | |
copy constructor | |
bmatrix (long m, long n) | |
default constructor | |
bmatrix () | |
long | gen_indices () |
generates global indices vectors | |
void | give_locid (long ti, long tj, long &i, long &j, long &k, long &l) const |
returns local indices from the given total indices | |
void | give_totid (long i, long j, long k, long l, long &ti, long &tj) const |
returns total indices from the given local indices | |
long | give_totm () const |
returns total number of rows | |
long | give_totn () const |
returns total number of columns | |
double & | operator() (long i, long j, long k, long l) const |
matrix & | operator() (long i, long j) const |
matrix * | operator[] (long i) const |
~bmatrix () | |
destructor | |
Public Attributes | |
matrix * | a |
pointer to onedimensional array with block matrices elements stored in rows | |
ivector | col |
vector of column indices | |
long | m |
number of rows of block matrices | |
long | n |
number of columns of block matrices | |
ivector | row |
vector of row indices | |
long | tm |
long | tn |
total number of double elements in rows and columns |
This file declares struct bmatrix, which implements matrix with block structure and with elements type of double. It can be used as a fourth order tensor or default matrix. There are also declarations of the functions for the basic matrix operations
Definition at line 15 of file bmatrix.h.
bmatrix | ( | long | m, | |
long | n | |||
) |
default constructor
allocating constructor
The constructor allocates memory form the heap to the member array a.
m | is the number of rows | |
n | is the number of columns |
created 29.5.2000, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 17 of file bmatrix.cpp.
References a, m, memset(), n, and print_err().
copy constructor
The copy constructor creates copy of the object given by the constant reference parameter.
v | is reference to the object of the vector which should be copied |
created 16.10.2003 by Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 39 of file bmatrix.cpp.
References a, col, if(), m, ivector::n, n, print_err(), print_warning(), and row.
~bmatrix | ( | ) |
destructor
The destructor deallocates the memory occupied by the member array a.
created 29.5.2000, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 9.5.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 72 of file bmatrix.cpp.
long gen_indices | ( | ) |
generates global indices vectors
Function checks all block matrices in rows and columns of bmatrix for dimension consistency and generates vector of global indices in rows and columns.
0 | - on success | |
1 | - error in rows | |
2 | - error in columns |
Definition at line 94 of file bmatrix.cpp.
References a, allocv(), col, matrix::m, m, matrix::n, n, print_err(), row, tm, and tn.
Referenced by anisodam::tmatstiff().
void give_locid | ( | long | ti, | |
long | tj, | |||
long & | i, | |||
long & | j, | |||
long & | k, | |||
long & | l | |||
) | const |
returns local indices from the given total indices
Function computes the total index of double element from indices of block (i,j) and element indices (k,l).
i | - row index of block matrix | |
j | - column index of block matrix | |
k | - row index of element in block(i,j) | |
k | - column index of element in block(i,j) | |
ti | - total row index of element - output parameter | |
tj | - total column index of element - output parameter |
The | total indices are returned via parameters ti and tj |
Definition at line 235 of file bmatrix.cpp.
References a, col, give_totm(), give_totn(), matrix::m, m, matrix::n, n, ivector::n, print_err(), row, tm, and tn.
void give_totid | ( | long | i, | |
long | j, | |||
long | k, | |||
long | l, | |||
long & | ti, | |||
long & | tj | |||
) | const |
returns total indices from the given local indices
Function computes the total index of double element from indices of block (i,j) and element indices (k,l).
i | - row index of block matrix | |
j | - column index of block matrix | |
k | - row index of element in block(i,j) | |
k | - column index of element in block(i,j) | |
ti | - total row index of element - output parameter | |
tj | - total column index of element - output parameter |
The | total indices are returned via parameters ti and tj |
Definition at line 193 of file bmatrix.cpp.
References a, col, m, ivector::n, n, print_err(), and row.
long give_totm | ( | ) | const |
returns total number of rows
Function computes the total number of rows in block matrix.
The | function returns total number of rows. |
Definition at line 157 of file bmatrix.cpp.
Referenced by give_locid().
long give_totn | ( | ) | const |
returns total number of columns
Function computes the total number of columns in block matrix.
The | function returns total number of columns. |
Definition at line 172 of file bmatrix.cpp.
Referenced by give_locid().
double& operator() | ( | long | i, | |
long | j, | |||
long | k, | |||
long | l | |||
) | const [inline] |
The operator enables access to the elements of the member array a.
i | is the index of row | |
j | is the index of column |
created 29.5.2000, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 9.5.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 85 of file bmatrix.h.
References a, m, n, and print_err().
matrix& operator() | ( | long | i, | |
long | j | |||
) | const [inline] |
The operator enables access to the elements of the member array a.
i | is the index of row | |
j | is the index of column |
created 29.5.2000, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 9.5.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 62 of file bmatrix.h.
References a, m, n, and print_err().
matrix* operator[] | ( | long | i | ) | const [inline] |
The operator enables access to the rows of elements of the member array a.
i | is the number of row |
created 29.5.2000, Tomas Koudelka, koudelka@cml.fsv.cvut.cz modified 9.5.2001, Tomas Koudelka, koudelka@cml.fsv.cvut.cz
Definition at line 41 of file bmatrix.h.
References a, m, n, and print_err().
pointer to onedimensional array with block matrices elements stored in rows
Definition at line 25 of file bmatrix.h.
Referenced by allocm(), bmatrix(), destrm(), gen_indices(), give_locid(), give_totid(), give_totm(), give_totn(), operator()(), operator[](), and ~bmatrix().
vector of column indices
Definition at line 27 of file bmatrix.h.
Referenced by bmatrix(), copym(), gen_indices(), give_locid(), and give_totid().
long m |
number of rows of block matrices
Definition at line 22 of file bmatrix.h.
Referenced by addm(), allocm(), bmatrix(), cmulm(), copym(), destrm(), fillm(), gen_indices(), give_locid(), give_totid(), give_totm(), operator()(), operator[](), subm(), and ~bmatrix().
long n |
number of columns of block matrices
Definition at line 23 of file bmatrix.h.
Referenced by addm(), allocm(), bmatrix(), cmulm(), copym(), destrm(), fillm(), gen_indices(), give_locid(), give_totid(), give_totm(), give_totn(), operator()(), operator[](), subm(), and ~bmatrix().
vector of row indices
Definition at line 26 of file bmatrix.h.
Referenced by bmatrix(), copym(), gen_indices(), give_locid(), and give_totid().
long tm |
Definition at line 24 of file bmatrix.h.
Referenced by addm(), gen_indices(), give_locid(), mxm(), and subm().
long tn |
total number of double elements in rows and columns
Definition at line 24 of file bmatrix.h.
Referenced by addm(), gen_indices(), give_locid(), mxm(), and subm().