Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_sparse_matrix< T > Class Template Reference

#include <vnl_sparse_matrix.h>

Inheritance diagram for vnl_sparse_matrix:

Inheritance graph
[legend]
List of all members.

Public Types

typedef vnl_sparse_matrix_pair<
T > 
pair_t
typedef vcl_vector< pair_trow
typedef vcl_vector< rowvnl_sparse_matrix_elements

Public Methods

 vnl_sparse_matrix ()
 vnl_sparse_matrix (unsigned int m, unsigned int n)
 vnl_sparse_matrix (const vnl_sparse_matrix< T > &rhs)
vnl_sparse_matrix< T > & operator= (const vnl_sparse_matrix< T > &rhs)
void mult (const vnl_sparse_matrix< T > &rhs, vnl_sparse_matrix< T > &result) const
void mult (const vnl_vector< T > &rhs, vnl_vector< T > &result) const
void mult (unsigned int n, unsigned int m, const T *p, T *q) const
void pre_mult (const vnl_vector< T > &lhs, vnl_vector< T > &result) const
void add (const vnl_sparse_matrix< T > &rhs, vnl_sparse_matrix< T > &result) const
void subtract (const vnl_sparse_matrix< T > &rhs, vnl_sparse_matrix< T > &result) const
T & operator() (unsigned int row, unsigned int column)
void diag_AtA (vnl_vector< T > &result) const
void set_row (unsigned int r, vcl_vector< int > const &cols, vcl_vector< T > const &vals)
rowget_row (unsigned int r)
vnl_sparse_matrix< T > & vcat (vnl_sparse_matrix< T > const &A)
unsigned int rows () const
unsigned int columns () const
bool empty_row (unsigned int r) const
double sum_row (unsigned int r)
void scale_row (unsigned int r, T scale)
void resize (int r, int c)
void reset ()
bool next ()
int getrow ()
int getcolumn ()
value ()

Protected Attributes

vnl_sparse_matrix_elements elements
unsigned int rs_
unsigned int cs_
unsigned int itr_row
row::iterator itr_cur
bool itr_isreset

Detailed Description

template<class T>
class vnl_sparse_matrix< T >

Simple sparse matrix. Stores non-zero elements as a sparse_matrix_pair

Definition at line 78 of file vnl_sparse_matrix.h.


Member Typedef Documentation

template<class T>
typedef vnl_sparse_matrix_pair<T> vnl_sparse_matrix< T >::pair_t
 

Definition at line 80 of file vnl_sparse_matrix.h.

template<class T>
typedef vcl_vector< pair_t > vnl_sparse_matrix< T >::row
 

Definition at line 86 of file vnl_sparse_matrix.h.

template<class T>
typedef vcl_vector< row > vnl_sparse_matrix< T >::vnl_sparse_matrix_elements
 

Definition at line 87 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().


Constructor & Destructor Documentation

template<class T>
vnl_sparse_matrix< T >::vnl_sparse_matrix  
 

Construct an empty matrix.

template<class T>
vnl_sparse_matrix< T >::vnl_sparse_matrix unsigned int    m,
unsigned int    n
 

Construct an empty m*n matrix.

template<class T>
vnl_sparse_matrix< T >::vnl_sparse_matrix const vnl_sparse_matrix< T > &    rhs
 

Construct an m*n Matrix and copy rhs into it.


Member Function Documentation

template<class T>
void vnl_sparse_matrix< T >::add const vnl_sparse_matrix< T > &    rhs,
vnl_sparse_matrix< T > &    result
const
 

Add rhs to this.

template<class T>
unsigned int vnl_sparse_matrix< T >::columns   const [inline]
 

Get the number of columns in the matrix.

Definition at line 162 of file vnl_sparse_matrix.h.

template<class T>
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.

template<class T>
bool vnl_sparse_matrix< T >::empty_row unsigned int    r const [inline]
 

Return whether a given row is empty.

Definition at line 166 of file vnl_sparse_matrix.h.

template<class T>
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 150 of file vnl_sparse_matrix.h.

template<class T>
int vnl_sparse_matrix< T >::getcolumn  
 

Returns the column of the entry pointed to by internal iterator.

template<class T>
int vnl_sparse_matrix< T >::getrow  
 

Returns the row of the entry pointed to by internal iterator.

template<class T>
void vnl_sparse_matrix< T >::mult unsigned int    n,
unsigned int    m,
const T *    p,
T *    q
const
 

Multiply this*p, a fortran order matrix.

template<class T>
void vnl_sparse_matrix< T >::mult const vnl_vector< T > &    rhs,
vnl_vector< T > &    result
const
 

Multiply this*rhs, where rhs is a vector.

template<class T>
void vnl_sparse_matrix< T >::mult const vnl_sparse_matrix< T > &    rhs,
vnl_sparse_matrix< T > &    result
const
 

Multiply this*rhs, another sparse matrix.

template<class T>
bool vnl_sparse_matrix< T >::next  
 

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.

template<class T>
T& vnl_sparse_matrix< T >::operator() unsigned int    row,
unsigned int    column
 

Get a reference to an entry in the matrix.

template<class T>
vnl_sparse_matrix<T>& vnl_sparse_matrix< T >::operator= const vnl_sparse_matrix< T > &    rhs
 

Copy another vnl_sparse_matrix<T> into this.

template<class T>
void vnl_sparse_matrix< T >::pre_mult const vnl_vector< T > &    lhs,
vnl_vector< T > &    result
const
 

Multiplies lhs*this, where lhs is a vector.

template<class T>
void vnl_sparse_matrix< T >::reset  
 

Resets the internal iterator.

template<class T>
void vnl_sparse_matrix< T >::resize int    r,
int    c
 

Resizes the array to have r rows and c cols. Currently not implemented.

template<class T>
unsigned int vnl_sparse_matrix< T >::rows   const [inline]
 

Get the number of rows in the matrix.

Definition at line 158 of file vnl_sparse_matrix.h.

template<class T>
void vnl_sparse_matrix< T >::scale_row unsigned int    r,
  scale
 

Useful for normalizing row sums in convolution operators.

template<class T>
void vnl_sparse_matrix< T >::set_row unsigned int    r,
vcl_vector< int > const &    cols,
vcl_vector< T > const &    vals
 

Set a whole row at once.\ Much faster.

template<class T>
void vnl_sparse_matrix< T >::subtract const vnl_sparse_matrix< T > &    rhs,
vnl_sparse_matrix< T > &    result
const
 

Subtract rhs from this.

template<class T>
double vnl_sparse_matrix< T >::sum_row unsigned int    r
 

This is occasionally useful.

template<class T>
T vnl_sparse_matrix< T >::value  
 

Returns the value pointed to by the internal iterator.

template<class T>
vnl_sparse_matrix<T>& vnl_sparse_matrix< T >::vcat vnl_sparse_matrix< T > const &    A
 

Laminate matrix A onto the bottom of this one.


Member Data Documentation

template<class T>
unsigned int vnl_sparse_matrix< T >::cs_ [protected]
 

Definition at line 206 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().

template<class T>
vnl_sparse_matrix_elements vnl_sparse_matrix< T >::elements [protected]
 

Definition at line 205 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().

template<class T>
row::iterator vnl_sparse_matrix< T >::itr_cur [protected]
 

Definition at line 210 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().

template<class T>
bool vnl_sparse_matrix< T >::itr_isreset [protected]
 

Definition at line 211 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().

template<class T>
unsigned int vnl_sparse_matrix< T >::itr_row [protected]
 

Definition at line 209 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().

template<class T>
unsigned int vnl_sparse_matrix< T >::rs_ [protected]
 

Definition at line 206 of file vnl_sparse_matrix.h.

Referenced by vnl_sparse_matrix< double >::empty_row().


The documentation for this class was generated from the following file:
Generated at Fri May 21 01:17:27 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000