Sparse Array-matrix class. More...
#include <Matrix_ArrayComplexSparse.hxx>
Public Types | |
typedef Allocator::value_type | value_type |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
typedef complex< T > | entry_type |
typedef complex< T > | access_type |
typedef complex< T > | const_access_type |
Public Member Functions | |
Matrix_ArrayComplexSparse () | |
Default constructor. | |
Matrix_ArrayComplexSparse (int i, int j) | |
Constructor. | |
~Matrix_ArrayComplexSparse () | |
Destructor. | |
void | Clear () |
Clears the matrix. | |
void | Reallocate (int i, int j) |
Reallocates memory to resize the matrix. | |
void | Resize (int i, int j) |
Reallocates additional memory to resize the matrix. | |
int | GetM () const |
Returns the number of rows. | |
int | GetN () const |
Returns the number of columns. | |
int | GetM (const SeldonTranspose &status) const |
Returns the number of rows of the matrix possibly transposed. | |
int | GetN (const SeldonTranspose &status) const |
Returns the number of columns of the matrix possibly transposed. | |
int | GetRealNonZeros () const |
Returns the number of non-zero elements (real part). | |
int | GetImagNonZeros () const |
Returns the number of non-zero elements (imaginary part). | |
int | GetRealDataSize () const |
Returns the number of elements stored in memory (real part). | |
int | GetImagDataSize () const |
Returns the number of elements stored in memory (imaginary part). | |
int | GetDataSize () const |
Returns the number of elements stored in memory (real+imaginary part). | |
int * | GetRealInd (int i) const |
Returns column indices of non-zero entries in row (real part). | |
int * | GetImagInd (int i) const |
Returns column indices of non-zero entries in row (imaginary part). | |
T * | GetRealData (int i) const |
Returns values of non-zero entries of a row (real part). | |
T * | GetImagData (int i) const |
Returns values of non-zero entries of a row (imaginary part). | |
Vector< T, VectSparse, Allocator > * | GetRealData () const |
Vector< T, VectSparse, Allocator > * | GetImagData () const |
complex< T > | operator() (int i, int j) const |
Access operator. | |
complex< T > & | Val (int i, int j) |
Unavailable access method. | |
const complex< T > & | Val (int i, int j) const |
Unavailable access method. | |
const T & | ValueReal (int num_row, int i) const |
Returns j-th non-zero value of row i (real part). | |
T & | ValueReal (int num_row, int i) |
Returns j-th non-zero value of row i (real part). | |
int | IndexReal (int num_row, int i) const |
Returns column number of j-th non-zero value of row i (real part). | |
int & | IndexReal (int num_row, int i) |
Returns column number of j-th non-zero value of row i (real part). | |
const T & | ValueImag (int num_row, int i) const |
Returns j-th non-zero value of row i (imaginary part). | |
T & | ValueImag (int num_row, int i) |
Returns j-th non-zero value of row i (imaginary part). | |
int | IndexImag (int num_row, int i) const |
Returns column number of j-th non-zero value of row i (imaginary part). | |
int & | IndexImag (int num_row, int i) |
Returns column number of j-th non-zero value of row i (imaginary part). | |
void | SetRealData (int, int, Vector< T, VectSparse, Allocator > *) |
Redefines the real part of the matrix. | |
void | SetImagData (int, int, Vector< T, VectSparse, Allocator > *) |
Redefines the imaginary part of the matrix. | |
void | SetRealData (int, int, T *, int *) |
Redefines a row/column of the matrix. | |
void | SetImagData (int, int, T *, int *) |
Redefines a row/column of the matrix. | |
void | NullifyReal (int i) |
Clears a row without releasing memory. | |
void | NullifyImag (int i) |
Clears a row without releasing memory. | |
void | NullifyReal () |
Clears the matrix without releasing memory. | |
void | NullifyImag () |
Clears the matrix without releasing memory. | |
void | Print () const |
Displays the matrix on the standard output. | |
void | WriteText (string FileName) const |
Writes the matrix in a file. | |
void | WriteText (ostream &FileStream) const |
Writes the matrix to an output stream. | |
void | Assemble () |
Assembles the matrix. | |
template<class T0 > | |
void | RemoveSmallEntry (const T0 &epsilon) |
void | SetIdentity () |
Matrix is initialized to the identity matrix. | |
void | Zero () |
Non-zero entries are set to 0 (but not removed). | |
void | Fill () |
Non-zero entries are filled with values 0, 1, 2, 3 ... | |
template<class T0 > | |
void | Fill (const complex< T0 > &x) |
Non-zero entries are set to a given value x. | |
template<class T0 > | |
Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator > & | operator= (const complex< T0 > &x) |
Non-zero entries are set to a given value x. | |
void | FillRand () |
Non-zero entries take a random value. | |
Protected Attributes | |
int | m_ |
Number of rows. | |
int | n_ |
Number of columns. | |
Vector< Vector< T, VectSparse, Allocator >, VectFull, NewAlloc< Vector< T, VectSparse, Allocator > > > | val_real_ |
real part rows or columns | |
Vector< Vector< T, VectSparse, Allocator >, VectFull, NewAlloc< Vector< T, VectSparse, Allocator > > > | val_imag_ |
imaginary part rows or columns |
Sparse Array-matrix class.
Sparse matrices are defined by: (1) the number of rows and columns; (2) the number of non-zero entries; (3) an array of vectors ind ind(i) is a vector, which contains indices of columns of the row i; (4) an array of vectors val : val(i) is a vector, which contains values of the row i
Definition at line 37 of file Matrix_ArrayComplexSparse.hxx.
Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Matrix_ArrayComplexSparse | ( | ) | [inline] |
Default constructor.
Builds an empty matrix.
Definition at line 38 of file Matrix_ArrayComplexSparse.cxx.
Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Matrix_ArrayComplexSparse | ( | int | i, | |
int | j | |||
) | [inline] |
Constructor.
Builds a i by j sparse matrix.
i | number of rows. | |
j | number of columns. |
Definition at line 54 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Assemble | ( | ) |
Assembles the matrix.
All the row numbers are sorted. If same row numbers exist, values are added.
Definition at line 848 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Clear | ( | ) | [inline] |
Clears the matrix.
This methods is equivalent to the destructor. On exit, the matrix is empty (0 by 0).
Definition at line 82 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetDataSize | ( | ) | const [inline] |
Returns the number of elements stored in memory (real+imaginary part).
Returns the number of elements stored in memory, i.e. the number of non-zero entries.
Definition at line 287 of file Matrix_ArrayComplexSparse.cxx.
T * Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetImagData | ( | int | i | ) | const [inline] |
Returns values of non-zero entries of a row (imaginary part).
[in] | i | row number. |
Definition at line 340 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetImagDataSize | ( | ) | const [inline] |
Returns the number of elements stored in memory (imaginary part).
Returns the number of elements stored in memory, i.e. the number of non-zero entries.
Definition at line 273 of file Matrix_ArrayComplexSparse.cxx.
int * Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetImagInd | ( | int | i | ) | const [inline] |
Returns column indices of non-zero entries in row (imaginary part).
[in] | i | row number. |
Definition at line 328 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetImagNonZeros | ( | ) | const [inline] |
Returns the number of non-zero elements (imaginary part).
Definition at line 241 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetM | ( | ) | const [inline] |
Returns the number of rows.
Definition at line 169 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetM | ( | const SeldonTranspose & | status | ) | const [inline] |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 194 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetN | ( | ) | const [inline] |
Returns the number of columns.
Definition at line 181 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetN | ( | const SeldonTranspose & | status | ) | const [inline] |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 210 of file Matrix_ArrayComplexSparse.cxx.
T * Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetRealData | ( | int | i | ) | const [inline] |
Returns values of non-zero entries of a row (real part).
[in] | i | row number. |
Definition at line 313 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetRealDataSize | ( | ) | const [inline] |
Returns the number of elements stored in memory (real part).
Returns the number of elements stored in memory, i.e. the number of non-zero entries.
Definition at line 259 of file Matrix_ArrayComplexSparse.cxx.
int * Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetRealInd | ( | int | i | ) | const [inline] |
Returns column indices of non-zero entries in row (real part).
[in] | i | row number. |
Definition at line 301 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::GetRealNonZeros | ( | ) | const [inline] |
Returns the number of non-zero elements (real part).
Definition at line 225 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::IndexImag | ( | int | i, | |
int | j | |||
) | const [inline] |
Returns column number of j-th non-zero value of row i (imaginary part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 585 of file Matrix_ArrayComplexSparse.cxx.
int & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::IndexImag | ( | int | i, | |
int | j | |||
) | [inline] |
Returns column number of j-th non-zero value of row i (imaginary part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 612 of file Matrix_ArrayComplexSparse.cxx.
int Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::IndexReal | ( | int | i, | |
int | j | |||
) | const [inline] |
Returns column number of j-th non-zero value of row i (real part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 477 of file Matrix_ArrayComplexSparse.cxx.
int & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::IndexReal | ( | int | i, | |
int | j | |||
) | [inline] |
Returns column number of j-th non-zero value of row i (real part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 504 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::NullifyImag | ( | int | i | ) | [inline] |
Clears a row without releasing memory.
On exit, the row is empty and the memory has not been released. It is useful for low level manipulations on a Matrix instance.
Definition at line 679 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::NullifyImag | ( | ) | [inline] |
Clears the matrix without releasing memory.
On exit, the matrix is empty and the memory has not been released. It is useful for low level manipulations on a Matrix instance.
Definition at line 737 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::NullifyReal | ( | int | i | ) | [inline] |
Clears a row without releasing memory.
On exit, the row is empty and the memory has not been released. It is useful for low level manipulations on a Matrix instance.
Definition at line 667 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::NullifyReal | ( | ) | [inline] |
Clears the matrix without releasing memory.
On exit, the matrix is empty and the memory has not been released. It is useful for low level manipulations on a Matrix instance.
Definition at line 723 of file Matrix_ArrayComplexSparse.cxx.
complex< T > Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::operator() | ( | int | i, | |
int | j | |||
) | const [inline] |
Access operator.
Returns the value of element (i, j).
i | row index. | |
j | column index. |
Reimplemented in Seldon::Matrix< T, Prop, ArrayColSymComplexSparse, Allocator >, and Seldon::Matrix< T, Prop, ArrayRowSymComplexSparse, Allocator >.
Definition at line 362 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Print | ( | ) | const |
Displays the matrix on the standard output.
Displays elements on the standard output, in text format. Each row is displayed on a single line and elements of a row are delimited by tabulations.
Definition at line 757 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Reallocate | ( | int | i, | |
int | j | |||
) | [inline] |
Reallocates memory to resize the matrix.
On exit, the matrix is a i x j matrix.
i | number of rows. | |
j | number of columns. |
Definition at line 102 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Resize | ( | int | i, | |
int | j | |||
) | [inline] |
Reallocates additional memory to resize the matrix.
On exit, the matrix is a i x j matrix.
i | number of rows. | |
j | number of columns. |
Definition at line 125 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::SetImagData | ( | int | i, | |
int | n, | |||
T * | val, | |||
int * | ind | |||
) | [inline] |
Redefines a row/column of the matrix.
[in] | i | row/col number |
[in] | n | number of non-zero entries in the row |
[in] | val | values |
[in] | ind | column numbers |
Definition at line 655 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::SetImagData | ( | int | m, | |
int | n, | |||
Vector< T, VectSparse, Allocator > * | val | |||
) | [inline] |
Redefines the imaginary part of the matrix.
[in] | m | new number of rows. |
[in] | n | new number of columns. |
[in] | val | array of sparse rows/columns. |
Definition at line 709 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::SetRealData | ( | int | i, | |
int | n, | |||
T * | val, | |||
int * | ind | |||
) | [inline] |
Redefines a row/column of the matrix.
[in] | i | row/col number |
[in] | n | number of non-zero entries in the row |
[in] | val | values |
[in] | ind | column numbers |
Definition at line 640 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::SetRealData | ( | int | m, | |
int | n, | |||
Vector< T, VectSparse, Allocator > * | val | |||
) | [inline] |
Redefines the real part of the matrix.
[in] | m | new number of rows. |
[in] | n | new number of columns. |
[in] | val | array of sparse rows/columns. |
Definition at line 693 of file Matrix_ArrayComplexSparse.cxx.
complex< T > & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Val | ( | int | i, | |
int | j | |||
) | [inline] |
Unavailable access method.
This method is declared for consistency with other classes, but it is not defined because no reference can possiblity be returned.
[in] | i | row index. |
[in] | j | column index. |
Definition at line 394 of file Matrix_ArrayComplexSparse.cxx.
const complex< T > & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::Val | ( | int | i, | |
int | j | |||
) | const [inline] |
Unavailable access method.
This method is declared for consistency with other classes, but it is not defined because no reference can possiblity be returned.
[in] | i | row index. |
[in] | j | column index. |
Definition at line 409 of file Matrix_ArrayComplexSparse.cxx.
T & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::ValueImag | ( | int | i, | |
int | j | |||
) | [inline] |
Returns j-th non-zero value of row i (imaginary part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 558 of file Matrix_ArrayComplexSparse.cxx.
const T & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::ValueImag | ( | int | i, | |
int | j | |||
) | const [inline] |
Returns j-th non-zero value of row i (imaginary part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 531 of file Matrix_ArrayComplexSparse.cxx.
const T & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::ValueReal | ( | int | i, | |
int | j | |||
) | const [inline] |
Returns j-th non-zero value of row i (real part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 423 of file Matrix_ArrayComplexSparse.cxx.
T & Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::ValueReal | ( | int | i, | |
int | j | |||
) | [inline] |
Returns j-th non-zero value of row i (real part).
[in] | i | row number. |
[in] | j | local number. |
Definition at line 451 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::WriteText | ( | string | FileName | ) | const |
Writes the matrix in a file.
Stores the matrix in a file in ascii format. The entries are written in coordinate format (row column value). 1-index convention is used.
FileName | output file name. |
Definition at line 791 of file Matrix_ArrayComplexSparse.cxx.
void Seldon::Matrix_ArrayComplexSparse< T, Prop, Storage, Allocator >::WriteText | ( | ostream & | FileStream | ) | const |
Writes the matrix to an output stream.
Stores the matrix in a file in ascii format. The entries are written in coordinate format (row column value). 1-index convention is used.
FileStream | output file name. |
Definition at line 816 of file Matrix_ArrayComplexSparse.cxx.