#include <itpp/base/smat.h>
Public Member Functions | |
| Sparse_Mat () | |
| Default constructor. | |
| Sparse_Mat (int rows, int cols, int row_data_init=200) | |
| Initiate an empty sparse matrix. | |
| Sparse_Mat (const Sparse_Mat< T > &m) | |
Initiate a new sparse matrix. The elements of m are copied into the new sparse matrix. | |
| Sparse_Mat (const Mat< T > &m) | |
Initiate a new sparse matrix from a dense matrix. The elements of m are copied into the new sparse matrix. | |
| Sparse_Mat (const Mat< T > &m, T epsilon) | |
Initiate a new sparse matrix from a dense matrix. Elements of m larger than epsilon are copied into the new sparse matrix. | |
| ~Sparse_Mat () | |
| Destructor. | |
| void | set_size (int rows, int cols, int row_data_init=-1) |
| Set the size of the sparse matrix. | |
| int | rows () const |
| Returns the number of rows of the sparse matrix. | |
| int | cols () const |
| Returns the number of columns of the sparse matrix. | |
| int | nnz () |
| The number of non-zero elements in the sparse matrix. | |
| double | density () |
| Returns the density of the sparse matrix: (number of non-zero elements)/(total number of elements). | |
| void | compact () |
| Set the maximum number of non-zero elements in each column equal to the actual number of non-zero elements in each column. | |
| void | full (Mat< T > &m) const |
Returns a full, dense matrix in m. | |
| Mat< T > | full () const |
| Returns a full, dense matrix. | |
| T | operator() (int r, int c) const |
Returns element of row r and column c. | |
| void | set (int r, int c, T v) |
Set element (r, c ) equal to v. | |
| void | set_new (int r, int c, T v) |
Set a new element with index (r, c ) equal to v. | |
| void | add_elem (const int r, const int c, const T v) |
Add the element in row r and column c with v. | |
| void | zeros () |
| Set the sparse matrix to the all zero matrix (removes all non-zero elements). | |
| void | zero_elem (const int r, const int c) |
Set the element in row r and column c to zero (i.e. clear that element if it contains a non-zero value). | |
| void | clear () |
| Clear all non-zero elements of the sparse matrix. | |
| void | clear_elem (const int r, const int c) |
Clear the element in row r and column c (if it contains a non-zero value). | |
| void | set_submatrix (int r1, int r2, int c1, int c2, const Mat< T > &m) |
| Set submatrix defined by rows r1,r2 and columns c1,c2 to matrix m. | |
| void | set_submatrix (int r, int c, const Mat< T > &m) |
Set submatrix defined by upper-left element (r,c) and the size of matrix m to m. | |
| Sparse_Mat< T > | get_submatrix (int r1, int r2, int c1, int c2) const |
Returns the sub-matrix from rows r1 to r2 and columns c1 to c2. | |
| Sparse_Mat< T > | get_submatrix_cols (int c1, int c2) const |
Returns the sub-matrix from columns c1 to c2 (all rows). | |
| void | get_col (int c, Sparse_Vec< T > &v) const |
Returns column c of the Sparse_Mat in the Sparse_Vec v. | |
| Sparse_Vec< T > | get_col (int c) const |
Returns column c of the Sparse_Mat. | |
| void | set_col (int c, const Sparse_Vec< T > &v) |
Set column c of the Sparse_Mat. | |
| void | transpose (Sparse_Mat< T > &m) const |
Transpose the sparse matrix, return the result in m. | |
| Sparse_Mat< T > | transpose () const |
| Returns the transpose of the sparse matrix. | |
| void | operator= (const Sparse_Mat< T > &m) |
Assign sparse matrix the value and dimensions of the sparse matrix m. | |
| void | operator= (const Mat< T > &m) |
Assign sparse matrix the value and dimensions of the dense matrix m. | |
| Sparse_Mat< T > | operator- () const |
| Returns the sign inverse of all elements in the sparse matrix. | |
| bool | operator== (const Sparse_Mat< T > &m) const |
| Compare two sparse matricies. False if wrong sizes or different values. | |
| void | operator+= (const Sparse_Mat< T > &v) |
Add sparse matrix v to all non-zero elements of the sparse matrix. | |
| void | operator+= (const Mat< T > &v) |
Add matrix v to all non-zero elements of the sparse matrix. | |
| void | operator-= (const Sparse_Mat< T > &v) |
Subtract sparse matrix v from all non-zero elements of the sparse matrix. | |
| void | operator-= (const Mat< T > &v) |
Subtract matrix v from all non-zero elements of the sparse matrix. | |
| void | operator *= (const T &v) |
Multiply all non-zero elements of the sparse matrix with the scalar v. | |
| void | operator/= (const T &v) |
Divide all non-zero elements of the sparse matrix with the scalar v. | |
Friends | |
| Sparse_Mat< T > | operator+ (const Sparse_Mat< T > &m1, const Sparse_Mat< T > &m2) |
| Addition m1+m2 where m1 and m2 are sparse matrices. | |
| Sparse_Mat< T > | operator * (const T &c, const Sparse_Mat< T > &m) |
| Multiplication c*m where c is a scalar and m is a sparse matrix. | |
| Sparse_Mat< T > | operator * (const Sparse_Mat< T > &m1, const Sparse_Mat< T > &m2) |
| Multiplication m1*m2 where m1 and m2 are sparse matrices. | |
| Sparse_Vec< T > | operator * (const Sparse_Mat< T > &m, const Sparse_Vec< T > &v) |
| Multiplication m*v where m is a sparse matrix and v is a sparse vector. | |
| Vec< T > | operator * (const Sparse_Mat< T > &m, const Vec< T > &v) |
| Multiplication m*v where m is a sparse matrix and v is a full column vector. | |
| Vec< T > | operator * (const Vec< T > &v, const Sparse_Mat< T > &m) |
| Multiplication v'*m where m is a sparse matrix and v is a full column vector. | |
| Mat< T > | trans_mult (const Sparse_Mat< T > &m) |
| Multiplication m'*m where m is a sparse matrix. Returns a full, dense matrix. | |
| Sparse_Mat< T > | trans_mult_s (const Sparse_Mat< T > &m) |
| Multiplication m'*m where m is a sparse matrix, Returns a sparse matrix. | |
| Sparse_Mat< T > | trans_mult (const Sparse_Mat< T > &m1, const Sparse_Mat< T > &m2) |
| Multiplication m1'*m2 where m1 and m2 are sparse matrices. | |
| Vec< T > | trans_mult (const Sparse_Mat< T > &m, const Vec< T > &v) |
| Multiplication m'*v where m is a sparse matrix and v is a full column vector. | |
| Sparse_Mat< T > | mult_trans (const Sparse_Mat< T > &m1, const Sparse_Mat< T > &m2) |
| Multiplication m1*m2' where m1 and m2 are sparse matrices. | |
Definition at line 104 of file smat.h.
|
|||||||||
|
Default constructor.
|
|
||||||||||||||||||||
|
Initiate an empty sparse matrix.
A Sparse_Mat consists of colums that have the type Sparse_Vec. The maximum number of non-zero elements is each column is denoted
|
|
||||||||||
|
Initiate a new sparse matrix. The elements of
Definition at line 369 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::n_cols, and itpp::Sparse_Mat< T >::n_rows. |
|
||||||||||
|
Initiate a new sparse matrix from a dense matrix. The elements of
Definition at line 381 of file smat.h. References itpp::Mat< Num_T >::cols(), and itpp::Mat< Num_T >::rows(). |
|
||||||||||||||||
|
Initiate a new sparse matrix from a dense matrix. Elements of
Definition at line 399 of file smat.h. References itpp::abs(), itpp::Mat< Num_T >::cols(), and itpp::Mat< Num_T >::rows(). |
|
|||||||||
|
Destructor.
|
|
||||||||||||||||||||
|
Set the size of the sparse matrix.
A Sparse_Mat consists of colums that have the type Sparse_Vec. The maximum number of non-zero elements is each column is denoted
Definition at line 422 of file smat.h. Referenced by itpp::Sparse_Mat< T >::transpose(). |
|
|||||||||
|
Returns the number of rows of the sparse matrix.
Definition at line 151 of file smat.h. Referenced by itpp::GF2mat::GF2mat(), itpp::Sparse_Mat< T >::operator+=(), and itpp::Sparse_Mat< T >::operator-=(). |
|
|||||||||
|
Returns the number of columns of the sparse matrix.
Definition at line 154 of file smat.h. Referenced by itpp::GF2mat::GF2mat(), itpp::Sparse_Mat< T >::operator+=(), and itpp::Sparse_Mat< T >::operator-=(). |
|
|||||||||
|
The number of non-zero elements in the sparse matrix.
Definition at line 435 of file smat.h. Referenced by itpp::Sparse_Mat< T >::density(), itpp::GF2mat::GF2mat(), and itpp::Sparse_Mat< T >::operator-(). |
|
|||||||||
|
Returns the density of the sparse matrix: (number of non-zero elements)/(total number of elements).
Definition at line 445 of file smat.h. References itpp::Sparse_Mat< T >::nnz(). |
|
|||||||||
|
Set the maximum number of non-zero elements in each column equal to the actual number of non-zero elements in each column.
Definition at line 452 of file smat.h. Referenced by itpp::Sparse_Mat< T >::get_submatrix(), and itpp::Sparse_Mat< T >::get_submatrix_cols(). |
|
||||||||||
|
Returns a full, dense matrix in
Definition at line 459 of file smat.h. References itpp::Mat< Num_T >::set_size(). |
|
|||||||||
|
Returns a full, dense matrix.
|
|
||||||||||||||||
|
Returns element of row
Definition at line 478 of file smat.h. References it_assert0. |
|
||||||||||||||||||||
|
Set element (
Definition at line 485 of file smat.h. References it_assert0, and itpp::Mat< Num_T >::set(). Referenced by itpp::Sparse_Mat< T >::set_submatrix(), and itpp::GF2mat::sparsify(). |
|
||||||||||||||||||||
|
Set a new element with index (
Definition at line 492 of file smat.h. References it_assert0. Referenced by itpp::Sparse_Mat< T >::operator-(), and itpp::Sparse_Mat< T >::transpose(). |
|
||||||||||||||||||||
|
Add the element in row
Definition at line 499 of file smat.h. References it_assert0. |
|
|||||||||
|
Set the sparse matrix to the all zero matrix (removes all non-zero elements).
Definition at line 506 of file smat.h. References itpp::Mat< Num_T >::zeros(). |
|
||||||||||||||||
|
Set the element in row
Definition at line 513 of file smat.h. References it_assert0. |
|
|||||||||
|
Clear all non-zero elements of the sparse matrix.
Definition at line 520 of file smat.h. References itpp::Mat< Num_T >::clear(). |
|
||||||||||||||||
|
Clear the element in row
Definition at line 527 of file smat.h. References it_assert0. |
|
||||||||||||||||||||||||||||
|
Set submatrix defined by rows r1,r2 and columns c1,c2 to matrix m.
Definition at line 534 of file smat.h. References itpp::Mat< Num_T >::cols(), it_assert1, itpp::Mat< Num_T >::rows(), and itpp::Sparse_Mat< T >::set(). |
|
||||||||||||||||||||
|
Set submatrix defined by upper-left element (
Definition at line 555 of file smat.h. References itpp::Mat< Num_T >::cols(), it_assert1, itpp::Mat< Num_T >::rows(), and itpp::Sparse_Mat< T >::set(). |
|
||||||||||||||||||||||||
|
Returns the sub-matrix from rows
Definition at line 568 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::compact(), and it_assert0. |
|
||||||||||||||||
|
Returns the sub-matrix from columns
Definition at line 583 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::compact(), and it_assert0. |
|
||||||||||||||||
|
Returns column
Definition at line 596 of file smat.h. References it_assert. Referenced by itpp::GF2mat::GF2mat(), itpp::Sparse_Mat< T >::operator+=(), and itpp::Sparse_Mat< T >::operator-=(). |
|
||||||||||
|
Returns column
Definition at line 603 of file smat.h. References it_assert. |
|
||||||||||||||||
|
Set column
Definition at line 610 of file smat.h. References it_assert. |
|
||||||||||
|
Transpose the sparse matrix, return the result in
Definition at line 617 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::set_new(), and itpp::Sparse_Mat< T >::set_size(). |
|
|||||||||
|
Returns the transpose of the sparse matrix.
|
|
||||||||||
|
Assign sparse matrix the value and dimensions of the sparse matrix
Definition at line 635 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::n_cols, and itpp::Sparse_Mat< T >::n_rows. |
|
||||||||||
|
Assign sparse matrix the value and dimensions of the dense matrix
Definition at line 647 of file smat.h. References itpp::Mat< Num_T >::cols(), and itpp::Mat< Num_T >::rows(). |
|
|||||||||
|
Returns the sign inverse of all elements in the sparse matrix.
Definition at line 664 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::nnz(), and itpp::Sparse_Mat< T >::set_new(). |
|
||||||||||
|
Compare two sparse matricies. False if wrong sizes or different values.
Definition at line 678 of file smat.h. References itpp::Sparse_Mat< T >::col, itpp::Sparse_Mat< T >::n_cols, and itpp::Sparse_Mat< T >::n_rows. |
|
||||||||||
|
Add sparse matrix
Definition at line 691 of file smat.h. References itpp::Sparse_Mat< T >::cols(), itpp::Sparse_Mat< T >::get_col(), it_assert0, and itpp::Sparse_Mat< T >::rows(). |
|
||||||||||
|
Add matrix
Definition at line 703 of file smat.h. References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), it_assert0, and itpp::Mat< Num_T >::rows(). |
|
||||||||||
|
Subtract sparse matrix
Definition at line 712 of file smat.h. References itpp::Sparse_Mat< T >::cols(), itpp::Sparse_Mat< T >::get_col(), it_assert0, and itpp::Sparse_Mat< T >::rows(). |
|
||||||||||
|
Subtract matrix
Definition at line 724 of file smat.h. References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), it_assert0, and itpp::Mat< Num_T >::rows(). |
|
||||||||||
|
Multiply all non-zero elements of the sparse matrix with the scalar
|
|
||||||||||
|
Divide all non-zero elements of the sparse matrix with the scalar
|
|
||||||||||||||||
|
Addition m1+m2 where m1 and m2 are sparse matrices.
|
|
||||||||||||||||
|
Multiplication c*m where c is a scalar and m is a sparse matrix.
|
|
||||||||||||||||
|
Multiplication m1*m2 where m1 and m2 are sparse matrices.
|
|
||||||||||||||||
|
Multiplication m*v where m is a sparse matrix and v is a sparse vector.
|
|
||||||||||||||||
|
Multiplication m*v where m is a sparse matrix and v is a full column vector.
|
|
||||||||||||||||
|
Multiplication v'*m where m is a sparse matrix and v is a full column vector.
|
|
||||||||||
|
Multiplication m'*m where m is a sparse matrix. Returns a full, dense matrix.
|
|
||||||||||
|
Multiplication m'*m where m is a sparse matrix, Returns a sparse matrix.
|
|
||||||||||||||||
|
Multiplication m1'*m2 where m1 and m2 are sparse matrices.
|
|
||||||||||||||||
|
Multiplication m'*v where m is a sparse matrix and v is a full column vector.
|
|
||||||||||||||||
|
Multiplication m1*m2' where m1 and m2 are sparse matrices.
|
Generated on Fri Jan 11 08:51:42 2008 for IT++ by Doxygen 1.3.9.1