#include <vnl_sparse_matrix.h>
Stores non-zero elements as a sparse_matrix_pair
Definition at line 87 of file vnl_sparse_matrix.h.
Public Types | |
| typedef vnl_sparse_matrix_pair< T > | pair_t |
| typedef vcl_vector< pair_t > | row |
| typedef vcl_vector< row > | vnl_sparse_matrix_elements |
Public Member Functions | |
| vnl_sparse_matrix () | |
| Construct an empty matrix. | |
| vnl_sparse_matrix (unsigned int m, unsigned int n) | |
| Construct an empty m*n matrix. | |
| vnl_sparse_matrix (const vnl_sparse_matrix< T > &rhs) | |
| Construct an m*n Matrix and copy rhs into it. | |
| vnl_sparse_matrix< T > & | operator= (const vnl_sparse_matrix< T > &rhs) |
| Copy another vnl_sparse_matrix<T> into this. | |
| void | mult (vnl_sparse_matrix< T > const &rhs, vnl_sparse_matrix< T > &result) const |
| Multiply this*rhs, another sparse matrix. | |
| void | mult (vnl_vector< T > const &rhs, vnl_vector< T > &result) const |
| Multiply this*rhs, where rhs is a vector. | |
| void | mult (unsigned int n, unsigned int m, T const *p, T *q) const |
| Multiply this*p, a fortran order matrix. | |
| void | pre_mult (const vnl_vector< T > &lhs, vnl_vector< T > &result) const |
| Multiplies lhs*this, where lhs is a vector. | |
| void | add (const vnl_sparse_matrix< T > &rhs, vnl_sparse_matrix< T > &result) const |
| Add rhs to this. | |
| void | subtract (const vnl_sparse_matrix< T > &rhs, vnl_sparse_matrix< T > &result) const |
| Subtract rhs from this. | |
| T & | operator() (unsigned int row, unsigned int column) |
| Get a reference to an entry in the matrix. | |
| void | diag_AtA (vnl_vector< T > &result) const |
| Get diag(A_tranpose * A). | |
| void | set_row (unsigned int r, vcl_vector< int > const &cols, vcl_vector< T > const &vals) |
| Set a whole row at once. Much faster. | |
| row & | get_row (unsigned int r) |
| Return row as vector of pairs. | |
| vnl_sparse_matrix< T > & | vcat (vnl_sparse_matrix< T > const &A) |
| Laminate matrix A onto the bottom of this one. | |
| unsigned int | rows () const |
| Get the number of rows in the matrix. | |
| unsigned int | columns () const |
| Get the number of columns in the matrix. | |
| unsigned int | cols () const |
| Get the number of columns in the matrix. | |
| bool | empty_row (unsigned int r) const |
| Return whether a given row is empty. | |
| T | sum_row (unsigned int r) |
| This is occasionally useful. | |
| void | scale_row (unsigned int r, T scale) |
| Useful for normalizing row sums in convolution operators. | |
| void | set_size (int r, int c) |
| Resizes the array to have r rows and c cols -- sets elements to null. | |
| void | resize (int r, int c) |
| Resizes the array to have r rows and c cols. | |
| void | reset () const |
| Resets the internal iterator. | |
| bool | next () const |
| Moves the internal iterator to next non-zero entry in matrix. | |
| int | getrow () const |
| Returns the row of the entry pointed to by internal iterator. | |
| int | getcolumn () const |
| Returns the column of the entry pointed to by internal iterator. | |
| T | value () const |
| Returns the value pointed to by the internal iterator. | |
Protected Attributes | |
| vnl_sparse_matrix_elements | elements |
| unsigned int | rs_ |
| unsigned int | cs_ |
| unsigned int | itr_row |
| row::const_iterator | itr_cur |
| bool | itr_isreset |
| typedef vnl_sparse_matrix_pair<T> vnl_sparse_matrix< T >::pair_t |
Definition at line 90 of file vnl_sparse_matrix.h.
| typedef vcl_vector< pair_t > vnl_sparse_matrix< T >::row |
Definition at line 96 of file vnl_sparse_matrix.h.
| typedef vcl_vector< row > vnl_sparse_matrix< T >::vnl_sparse_matrix_elements |
Definition at line 97 of file vnl_sparse_matrix.h.
| vnl_sparse_matrix< T >::vnl_sparse_matrix | ( | ) |
| vnl_sparse_matrix< T >::vnl_sparse_matrix | ( | unsigned int | m, | |
| unsigned int | n | |||
| ) |
| vnl_sparse_matrix< T >::vnl_sparse_matrix | ( | const vnl_sparse_matrix< T > & | rhs | ) |
| vnl_sparse_matrix< T > & vnl_sparse_matrix< T >::operator= | ( | const vnl_sparse_matrix< T > & | rhs | ) |
| void vnl_sparse_matrix< T >::mult | ( | vnl_sparse_matrix< T > const & | rhs, | |
| vnl_sparse_matrix< T > & | result | |||
| ) | const |
| void vnl_sparse_matrix< T >::mult | ( | vnl_vector< T > const & | rhs, | |
| vnl_vector< T > & | result | |||
| ) | const |
| void vnl_sparse_matrix< T >::mult | ( | unsigned int | prows, | |
| unsigned int | pcols, | |||
| T const * | p, | |||
| T * | q | |||
| ) | const |
Multiply this*p, a fortran order matrix.
The matrix p has n rows and m columns, and is in fortran order, ie. columns first.
Definition at line 143 of file vnl_sparse_matrix.txx.
| void vnl_sparse_matrix< T >::pre_mult | ( | const vnl_vector< T > & | lhs, | |
| vnl_vector< T > & | result | |||
| ) | const |
| void vnl_sparse_matrix< T >::add | ( | const vnl_sparse_matrix< T > & | rhs, | |
| vnl_sparse_matrix< T > & | result | |||
| ) | const |
| void vnl_sparse_matrix< T >::subtract | ( | const vnl_sparse_matrix< T > & | rhs, | |
| vnl_sparse_matrix< T > & | result | |||
| ) | const |
| T & vnl_sparse_matrix< T >::operator() | ( | unsigned int | row, | |
| unsigned int | column | |||
| ) |
| void vnl_sparse_matrix< T >::diag_AtA | ( | vnl_vector< T > & | result | ) | const |
Get diag(A_tranpose * A).
Useful for forming Jacobi preconditioners for linear solvers.
Definition at line 414 of file vnl_sparse_matrix.txx.
| void vnl_sparse_matrix< T >::set_row | ( | unsigned int | r, | |
| vcl_vector< int > const & | cols, | |||
| vcl_vector< T > const & | vals | |||
| ) |
| row& vnl_sparse_matrix< T >::get_row | ( | unsigned int | r | ) | [inline] |
Return row as vector of pairs.
Added to aid binary I/O
Definition at line 146 of file vnl_sparse_matrix.h.
| vnl_sparse_matrix< T > & vnl_sparse_matrix< T >::vcat | ( | vnl_sparse_matrix< T > const & | A | ) |
Laminate matrix A onto the bottom of this one.
Definition at line 451 of file vnl_sparse_matrix.txx.
| unsigned int vnl_sparse_matrix< T >::rows | ( | ) | const [inline] |
| unsigned int vnl_sparse_matrix< T >::columns | ( | ) | const [inline] |
| unsigned int vnl_sparse_matrix< T >::cols | ( | ) | const [inline] |
| bool vnl_sparse_matrix< T >::empty_row | ( | unsigned int | r | ) | const [inline] |
| T vnl_sparse_matrix< T >::sum_row | ( | unsigned int | r | ) |
| void vnl_sparse_matrix< T >::scale_row | ( | unsigned int | r, | |
| T | scale | |||
| ) |
Useful for normalizing row sums in convolution operators.
Definition at line 482 of file vnl_sparse_matrix.txx.
| void vnl_sparse_matrix< T >::set_size | ( | int | r, | |
| int | c | |||
| ) |
Resizes the array to have r rows and c cols -- sets elements to null.
Definition at line 494 of file vnl_sparse_matrix.txx.
| void vnl_sparse_matrix< T >::resize | ( | int | r, | |
| int | c | |||
| ) |
Resizes the array to have r rows and c cols.
This is more wasteful of resources than set_size, but it preserves the contents.
Definition at line 513 of file vnl_sparse_matrix.txx.
| void vnl_sparse_matrix< T >::reset | ( | ) | const |
| bool vnl_sparse_matrix< T >::next | ( | ) | const |
Moves the internal iterator to next non-zero entry in matrix.
Returns true if there is another value, false otherwise. Use in combination with methods reset, getrow, getcolumn, and value.
Definition at line 549 of file vnl_sparse_matrix.txx.
| int vnl_sparse_matrix< T >::getrow | ( | ) | const |
Returns the row of the entry pointed to by internal iterator.
Definition at line 584 of file vnl_sparse_matrix.txx.
| int vnl_sparse_matrix< T >::getcolumn | ( | ) | const |
Returns the column of the entry pointed to by internal iterator.
Definition at line 593 of file vnl_sparse_matrix.txx.
| T vnl_sparse_matrix< T >::value | ( | ) | const |
Returns the value pointed to by the internal iterator.
Definition at line 602 of file vnl_sparse_matrix.txx.
vnl_sparse_matrix_elements vnl_sparse_matrix< T >::elements [protected] |
Definition at line 194 of file vnl_sparse_matrix.h.
unsigned int vnl_sparse_matrix< T >::rs_ [protected] |
Definition at line 195 of file vnl_sparse_matrix.h.
unsigned int vnl_sparse_matrix< T >::cs_ [protected] |
Definition at line 195 of file vnl_sparse_matrix.h.
unsigned int vnl_sparse_matrix< T >::itr_row [mutable, protected] |
Definition at line 198 of file vnl_sparse_matrix.h.
row::const_iterator vnl_sparse_matrix< T >::itr_cur [mutable, protected] |
Definition at line 199 of file vnl_sparse_matrix.h.
bool vnl_sparse_matrix< T >::itr_isreset [mutable, protected] |
Definition at line 200 of file vnl_sparse_matrix.h.
1.5.1