#include <SparseMatrix.h>
Collaboration diagram for PLearn::SparseMatrix:
Public Member Functions | |
int | length () const |
int | width () const |
SparseMatrix () | |
SparseMatrix (int nbrows, int n_columns, int n_non_zero) | |
SparseMatrix (Vec bRow, Vec eRow, Vec Row, Vec Values, int nbrows) | |
SparseMatrix (Mat m) | |
convert Mat into SparseMatrix: | |
SparseMatrix (string filename) | |
void | resize (int nbrows, int n_columns, int n_non_zero) |
void | loadFortran (const char *filename) |
load SparseMatrix from file in ascii Harwell-Boeing Fortran format: 4-line header, followed by beginRow, row, and values. | |
void | saveFortran (const char *filename) |
Mat | toMat () |
convert to the equivalent full matrix | |
void | product (const Vec &x, Vec &y) |
multiply a sparse matrix by a full vector and set resulting vector y = matrix * x | |
void | diag (Vec &d) |
extract the diagonal of the sparse matrix: d[i] = A[i,i] | |
void | diagonalOfSquare (Vec &d) |
d = diagonal(A'*A), i.e. | |
real | dotRow (int i, Vec v) |
return dot product of i-th row with vector v | |
real | dotColumn (int j, Vec v) |
return dot product of j-th column with vector v | |
Public Attributes | |
int | n_rows |
the dimensions of the matrix are: n_rows x beginRow.length() | |
Vec | beginRow |
Vec | endRow |
Vec | row |
Vec | values |
beginRow(n_columns): beginning of block of (not necessarily contiguous) elements of column j in the values vector endRow(n_columns): last element of block of (not necessarily contiguous) elements of column j in the values vector row(n_non_zero_elements): row of a non-zero element values(n_non_zero_elements): value of a non-zero element so for example values[k] is the value of an element (i,j) of the matrix such that row[k]=i and beginRow[i]<=k<=endRow[i].
Definition at line 57 of file SparseMatrix.h.
|
Definition at line 68 of file SparseMatrix.h. |
|
Definition at line 69 of file SparseMatrix.h. |
|
Definition at line 72 of file SparseMatrix.h. |
|
convert Mat into SparseMatrix:
Definition at line 149 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, k, PLearn::TMat< T >::mod(), n_rows, PLearn::TVec< T >::resize(), row, values, and PLearn::TMat< T >::width(). |
|
Definition at line 79 of file SparseMatrix.h. References loadFortran(). |
|
extract the diagonal of the sparse matrix: d[i] = A[i,i]
Definition at line 204 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, k, PLearn::TVec< T >::length(), row, and values. |
|
d = diagonal(A'*A), i.e. d[i] = |A[i]|^2 where A[i] is i-th column Definition at line 220 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, k, PLearn::TVec< T >::length(), and values. |
|
return dot product of j-th column with vector v
Definition at line 243 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, k, length(), PLearn::TVec< T >::length(), PLERROR, row, and values. |
|
return dot product of i-th row with vector v
Definition at line 236 of file SparseMatrix.cc. References PLERROR. |
|
Definition at line 65 of file SparseMatrix.h. References n_rows. Referenced by dotColumn(). |
|
load SparseMatrix from file in ascii Harwell-Boeing Fortran format: 4-line header, followed by beginRow, row, and values.
Definition at line 52 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, n_rows, PLERROR, PLearn::TVec< T >::resize(), row, and values. Referenced by SparseMatrix(). |
|
multiply a sparse matrix by a full vector and set resulting vector y = matrix * x
Definition at line 182 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::clear(), PLearn::TVec< T >::data(), endRow, k, PLearn::TVec< T >::length(), n_rows, PLERROR, row, values, and x. |
|
Definition at line 41 of file SparseMatrix.cc. References beginRow, endRow, n_rows, PLearn::TVec< T >::resize(), row, and values. |
|
Definition at line 105 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, PLearn::TVec< T >::length(), n_rows, PLERROR, row, and values. |
|
convert to the equivalent full matrix
Definition at line 133 of file SparseMatrix.cc. References beginRow, PLearn::TVec< T >::data(), endRow, k, PLearn::TVec< T >::length(), PLearn::Mat, n_rows, row, and values. |
|
Definition at line 66 of file SparseMatrix.h. References beginRow, and PLearn::TVec< T >::length(). |
|
Definition at line 60 of file SparseMatrix.h. Referenced by PLearn::add(), diag(), diagonalOfSquare(), dotColumn(), loadFortran(), PLearn::operator+(), product(), resize(), PLearn::RowMapSparseMatrix< real >::RowMapSparseMatrix(), saveFortran(), SparseMatrix(), toMat(), and width(). |
|
Definition at line 61 of file SparseMatrix.h. Referenced by PLearn::add(), diag(), diagonalOfSquare(), dotColumn(), loadFortran(), PLearn::operator+(), product(), resize(), PLearn::RowMapSparseMatrix< real >::RowMapSparseMatrix(), saveFortran(), SparseMatrix(), and toMat(). |
|
the dimensions of the matrix are: n_rows x beginRow.length()
Definition at line 59 of file SparseMatrix.h. Referenced by length(), loadFortran(), PLearn::operator+(), product(), resize(), saveFortran(), SparseMatrix(), and toMat(). |
|
Definition at line 62 of file SparseMatrix.h. Referenced by PLearn::add(), diag(), dotColumn(), loadFortran(), PLearn::operator+(), product(), resize(), PLearn::RowMapSparseMatrix< real >::RowMapSparseMatrix(), saveFortran(), SparseMatrix(), and toMat(). |
|
Definition at line 63 of file SparseMatrix.h. Referenced by PLearn::add(), diag(), diagonalOfSquare(), dotColumn(), loadFortran(), PLearn::operator+(), product(), resize(), PLearn::RowMapSparseMatrix< real >::RowMapSparseMatrix(), saveFortran(), SparseMatrix(), and toMat(). |