Column-major symmetric sparse-matrix class. More...
#include <Matrix_ArraySparse.hxx>
Public Types | |
typedef Allocator::value_type | value_type |
typedef Prop | property |
typedef ArrayColSymSparse | storage |
typedef Allocator | allocator |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
typedef T | entry_type |
typedef T & | access_type |
typedef T | const_access_type |
Public Member Functions | |
Matrix () | |
Default constructor. More... | |
Matrix (int i, int j) | |
Constructor. More... | |
const T | operator() (int i, int j) const |
Access operator. More... | |
T & | Get (int i, int j) |
Access to element (i, j) More... | |
const T & | Get (int i, int j) const |
Access to element (i, j) More... | |
T & | Val (int i, int j) |
Access to element (i, j) More... | |
const T & | Val (int i, int j) const |
Access to element (i, j) More... | |
void | Set (int i, int j, const T &x) |
Sets element (i, j) of the matrix. More... | |
void | SetEntry (int i, int j, const T &x) |
Sets element (i, j) of the matrix. More... | |
void | ClearColumn (int i) |
Clears a column. | |
void | ReallocateColumn (int i, int j) |
Reallocates column i. More... | |
void | ResizeColumn (int i, int j) |
Reallocates column i. More... | |
void | SwapColumn (int i, int i_) |
Swaps two columns. More... | |
void | ReplaceIndexColumn (int i, IVect &new_index) |
Sets row numbers of non-zero entries of a column. More... | |
int | GetColumnSize (int i) const |
Returns the number of non-zero entries of a column. More... | |
void | PrintColumn (int i) const |
Displays non-zero values of a column. | |
void | AssembleColumn (int i) |
Assembles a column. More... | |
void | AddInteraction (int i, int j, const T &val) |
Adds a coefficient in the matrix. More... | |
void | AddInteractionRow (int, int, int *, T *, bool already_sorted=false) |
Adds coefficients in a row. More... | |
void | AddInteractionColumn (int, int, int *, T *, bool already_sorted=false) |
Adds coefficients in a column. More... | |
void | AddInteractionRow (int i, int nb, const Vector< int > &col, const Vector< T > &val, bool already_sorted=false) |
Adds coefficients in a row. More... | |
void | AddInteractionColumn (int i, int nb, const Vector< int > &row, const Vector< T > &val, bool already_sorted=false) |
Adds coefficients in a column. More... | |
void | Clear () |
Clears the matrix. More... | |
void | Reallocate (int i, int j) |
Reallocates memory to resize the matrix. More... | |
void | Resize (int i, int j) |
Reallocates additional memory to resize the matrix. More... | |
long | GetNonZeros () const |
Returns the number of non-zero entries. More... | |
size_t | GetMemorySize () const |
returns size of matrix in bytes | |
long | GetDataSize () const |
Returns the number of elements stored in memory. More... | |
int * | GetIndex (int i) const |
Returns (row or column) indices of non-zero entries in row. More... | |
T * | GetData (int i) const |
Returns values of non-zero entries of a row/column. More... | |
Vector< T, VectSparse, Allocator > * | GetData () const |
Returns values of non-zero entries. More... | |
const T & | Value (int num_row, int i) const |
Returns j-th non-zero value of row/column i. More... | |
T & | Value (int num_row, int i) |
Returns j-th non-zero value of row/column i. More... | |
int | Index (int num_row, int i) const |
Returns column/row number of j-th non-zero value of row/column i. More... | |
int & | Index (int num_row, int i) |
Returns column/row number of j-th non-zero value of row/column i. More... | |
void | SetData (int, int, Vector< T, VectSparse, Allocator > *) |
Redefines the matrix. More... | |
void | SetData (int, int, T *, int *) |
Redefines a row/column of the matrix. More... | |
void | Nullify (int i) |
Clears a row without releasing memory. More... | |
void | Nullify () |
Clears the matrix without releasing memory. More... | |
void | Print () const |
Displays the matrix on the standard output. More... | |
void | Assemble () |
Assembles the matrix. More... | |
void | RemoveSmallEntry (const T0 &epsilon) |
Removes small coefficients from entries. More... | |
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 ... | |
void | Fill (const T0 &x) |
Non-zero entries are set to a given value x. | |
void | FillRand () |
Non-zero entries take a random value. | |
void | Write (string FileName) const |
Writes the matrix in a file. More... | |
void | Write (ostream &FileStream) const |
Writes the matrix to an output stream. More... | |
void | WriteText (string FileName, bool cplx=false) const |
Writes the matrix in a file. More... | |
void | WriteText (ostream &FileStream, bool cplx=false) const |
Writes the matrix to an output stream. More... | |
void | Read (string FileName) |
Reads the matrix from a file. More... | |
void | Read (istream &FileStream) |
Reads the matrix from an input stream. More... | |
void | ReadText (string FileName, bool cplx=false) |
Reads the matrix from a file. More... | |
void | ReadText (istream &FileStream, bool cplx=false) |
Reads the matrix from an input stream. More... | |
int | GetM () const |
Returns the number of rows. More... | |
int | GetM (const Seldon::SeldonTranspose &status) const |
Returns the number of rows of the matrix possibly transposed. More... | |
int | GetM (const CBLAS_TRANSPOSE &status) const |
Returns the number of rows of the matrix possibly transposed. More... | |
int | GetN () const |
Returns the number of columns. More... | |
int | GetN (const Seldon::SeldonTranspose &status) const |
Returns the number of columns of the matrix possibly transposed. More... | |
int | GetN (const CBLAS_TRANSPOSE &status) const |
Returns the number of columns of the matrix possibly transposed. More... | |
long | GetSize () const |
Returns the number of elements in the matrix. More... | |
Protected Attributes | |
Vector< Vector< T, VectSparse, Allocator >, VectFull, NewAlloc< Vector< T, VectSparse, Allocator > > > | val_ |
rows or columns | |
int | m_ |
int | n_ |
Column-major symmetric sparse-matrix class.
Definition at line 254 of file Matrix_ArraySparse.hxx.
|
inline |
Default constructor.
Builds an empty matrix.
Definition at line 801 of file Matrix_ArraySparseInline.cxx.
|
inlineexplicit |
Constructor.
Builds a i by j matrix
i | number of rows. |
j | number of columns. |
Definition at line 814 of file Matrix_ArraySparseInline.cxx.
|
inline |
Adds a coefficient in the matrix.
[in] | i | row number. |
[in] | j | column number. |
[in] | val | coefficient to add. |
Definition at line 1091 of file Matrix_ArraySparseInline.cxx.
void Seldon::Matrix< T, Prop, ArrayColSymSparse, Allocator >::AddInteractionColumn | ( | int | i, |
int | nb, | ||
const Vector< int > & | row, | ||
const Vector< T > & | val, | ||
bool | already_sorted = false |
||
) |
Adds coefficients in a column.
[in] | i | column number. |
[in] | nb | number of coefficients to add. |
[in] | row | row numbers of coefficients. |
[in] | val | values of coefficients. |
Definition at line 712 of file Matrix_ArraySparse.cxx.
void Seldon::Matrix< T, Prop, ArrayColSymSparse, Allocator >::AddInteractionColumn | ( | int | i, |
int | nb, | ||
int * | row_, | ||
T * | value_, | ||
bool | already_sorted = false |
||
) |
Adds coefficients in a column.
[in] | i | column number. |
[in] | nb | number of coefficients to add. |
[in] | row_ | row numbers of coefficients. |
[in] | value_ | values of coefficients. |
Definition at line 672 of file Matrix_ArraySparse.cxx.
void Seldon::Matrix< T, Prop, ArrayColSymSparse, Allocator >::AddInteractionRow | ( | int | i, |
int | nb, | ||
const Vector< int > & | col, | ||
const Vector< T > & | val, | ||
bool | already_sorted = false |
||
) |
Adds coefficients in a row.
[in] | i | row number. |
[in] | nb | number of coefficients to add. |
[in] | col | column numbers of coefficients. |
[in] | val | values of coefficients. |
Definition at line 694 of file Matrix_ArraySparse.cxx.
void Seldon::Matrix< T, Prop, ArrayColSymSparse, Allocator >::AddInteractionRow | ( | int | i, |
int | nb, | ||
int * | col_, | ||
T * | value_, | ||
bool | already_sorted = false |
||
) |
Adds coefficients in a row.
[in] | i | row number. |
[in] | nb | number of coefficients to add. |
[in] | col_ | column numbers of coefficients. |
[in] | value_ | values of coefficients. |
Definition at line 650 of file Matrix_ArraySparse.cxx.
|
inherited |
Assembles the matrix.
All the column/row numbers are sorted. If same column/row numbers exist, values are added.
Definition at line 159 of file Matrix_ArraySparse.cxx.
|
inline |
Assembles a column.
[in] | i | column number. |
Definition at line 1077 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Clears the matrix.
This methods is equivalent to the destructor. On exit, the matrix is empty (0 by 0).
Definition at line 66 of file Matrix_ArraySparseInline.cxx.
|
inline |
Access to element (i, j)
Returns the value of element (i, j).
i | row index. |
j | column index. |
Definition at line 868 of file Matrix_ArraySparseInline.cxx.
|
inline |
Access to element (i, j)
Returns the value of element (i, j).
i | row index. |
j | column index. |
Definition at line 891 of file Matrix_ArraySparseInline.cxx.
|
inline |
Returns the number of non-zero entries of a column.
[in] | i | column number. |
Definition at line 1054 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns values of non-zero entries.
Definition at line 127 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns values of non-zero entries of a row/column.
[in] | i | row (or column) number. |
Definition at line 114 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns the number of elements stored in memory.
Returns the number of elements stored in memory, i.e. the number of non-zero entries.
Definition at line 86 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns (row or column) indices of non-zero entries in row.
[in] | i | row (or column) number. |
Definition at line 100 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns the number of rows.
Definition at line 69 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 122 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of rows of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 92 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of columns.
Definition at line 80 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 137 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns the number of columns of the matrix possibly transposed.
status | assumed status about the transposition of the matrix. |
Definition at line 107 of file Matrix_BaseInline.cxx.
|
inherited |
Returns the number of non-zero entries.
Definition at line 97 of file Matrix_ArraySparse.cxx.
|
inlineinherited |
Returns the number of elements in the matrix.
Returns the number of elements in the matrix, i.e. the number of rows multiplied by the number of columns.
Definition at line 153 of file Matrix_BaseInline.cxx.
|
inlineinherited |
Returns column/row number of j-th non-zero value of row/column i.
[in] | i | row/column number. |
[in] | j | local number. |
Definition at line 345 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns column/row number of j-th non-zero value of row/column i.
[in] | i | row/column number. |
[in] | j | local number. |
Definition at line 325 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
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 406 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
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 378 of file Matrix_ArraySparseInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j).
i | row index. |
j | column index. |
Definition at line 844 of file Matrix_ArraySparseInline.cxx.
|
inherited |
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 132 of file Matrix_ArraySparse.cxx.
|
inherited |
Reads the matrix from an input stream.
Reads a matrix in binary format from an input stream. The number of rows (integer) and the number of columns (integer) are read and matrix elements are then read in the same order as it should be in memory (e.g. row-major storage).
FileStream | output file name. |
Definition at line 399 of file Matrix_ArraySparse.cxx.
|
inherited |
Reads the matrix from a file.
Reads a matrix stored in binary format in a file. The number of rows (integer) and the number of columns (integer) are read and matrix elements are then read in the same order as it should be in memory (e.g. row-major storage).
FileName | output file name. |
Definition at line 371 of file Matrix_ArraySparse.cxx.
|
inherited |
Reads the matrix from an input stream.
Reads a matrix from a stream in text format.
FileStream | input stream. |
Definition at line 462 of file Matrix_ArraySparse.cxx.
|
inherited |
Reads the matrix from a file.
Reads the matrix from a file in text format.
FileName | input file name. |
Definition at line 437 of file Matrix_ArraySparse.cxx.
|
inherited |
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 42 of file Matrix_ArraySparse.cxx.
|
inline |
Reallocates column i.
[in] | i | column number. |
[in] | j | new number of non-zero entries in the column. |
Definition at line 1001 of file Matrix_ArraySparseInline.cxx.
|
inherited |
Removes small coefficients from entries.
[in] | epsilon | entries whose values are below epsilon are removed. |
Definition at line 173 of file Matrix_ArraySparse.cxx.
|
inline |
Sets row numbers of non-zero entries of a column.
[in] | i | column number. |
[in] | new_index | new row numbers. |
Definition at line 1040 of file Matrix_ArraySparseInline.cxx.
|
inherited |
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. Data is kept |
Definition at line 63 of file Matrix_ArraySparse.cxx.
|
inline |
Reallocates column i.
[in] | i | column number. |
[in] | j | new number of non-zero entries in the column. |
Definition at line 1014 of file Matrix_ArraySparseInline.cxx.
|
inline |
Sets element (i, j) of the matrix.
i | row index. |
j | column index. |
x | A(i, j) = x |
Definition at line 959 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
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 366 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Redefines the matrix.
[in] | m | new number of rows. |
[in] | n | new number of columns. |
[in] | val | array of sparse rows/columns. |
Definition at line 392 of file Matrix_ArraySparseInline.cxx.
|
inline |
Sets element (i, j) of the matrix.
i | row index. |
j | column index. |
x | A(i, j) = x |
Definition at line 976 of file Matrix_ArraySparseInline.cxx.
|
inline |
Swaps two columns.
[in] | i | first column number. |
[in] | j | second column number. |
Definition at line 1027 of file Matrix_ArraySparseInline.cxx.
|
inline |
Access to element (i, j)
Returns the value of element (i, j).
i | row index. |
j | column index. |
Definition at line 914 of file Matrix_ArraySparseInline.cxx.
|
inline |
Access to element (i, j)
Returns the value of element (i, j).
i | row index. |
j | column index. |
Definition at line 937 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns j-th non-zero value of row/column i.
[in] | i | row/column number. |
[in] | j | local number. |
Definition at line 306 of file Matrix_ArraySparseInline.cxx.
|
inlineinherited |
Returns j-th non-zero value of row/column i.
[in] | i | row/column number. |
[in] | j | local number. |
Definition at line 286 of file Matrix_ArraySparseInline.cxx.
|
inherited |
Writes the matrix to an output stream.
Stores the matrix in a file in binary format. The number of rows (integer) and the number of columns (integer) are written and matrix elements are then written in the same order as in memory (e.g. row-major storage).
FileStream | output file name. |
Definition at line 287 of file Matrix_ArraySparse.cxx.
|
inherited |
Writes the matrix in a file.
Stores the matrix in a file in binary format. The number of rows (integer) and the number of columns (integer) are written and matrix elements are then written in the same order as in memory (e.g. row-major storage).
FileName | output file name. |
Definition at line 259 of file Matrix_ArraySparse.cxx.
|
inherited |
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 342 of file Matrix_ArraySparse.cxx.
|
inherited |
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 314 of file Matrix_ArraySparse.cxx.