vnl_diag_matrix< T > Class Template Reference

#include <vnl_diag_matrix.h>

List of all members.


Detailed Description

template<class T>
class vnl_diag_matrix< T >

stores a diagonal matrix as a single vector.

vnl_diag_matrix stores a diagonal matrix for time and space efficiency. Specifically, only the diagonal elements are stored, and some matrix operations (currently *, + and -) are overloaded to use more efficient algorithms.

Definition at line 38 of file vnl_diag_matrix.h.


Public Types

typedef vnl_vector< T >::iterator iterator
typedef vnl_vector< T >::const_iterator const_iterator

Public Member Functions

 vnl_diag_matrix ()
 vnl_diag_matrix (unsigned nn)
 Construct an empty diagonal matrix.
 vnl_diag_matrix (unsigned nn, T const &value)
 Construct a diagonal matrix with diagonal elements equal to value.
 vnl_diag_matrix (vnl_vector< T > const &that)
 Construct a diagonal matrix from a vnl_vector.
 ~vnl_diag_matrix ()
vnl_diag_matrixoperator= (vnl_diag_matrix< T > const &that)
vnl_diag_matrix< T > & operator *= (T v)
 In-place arithmetic operation.
vnl_diag_matrix< T > & operator/= (T v)
 In-place arithmetic operation.
void invert_in_place ()
 Invert a vnl_diag_matrix in-situ.
determinant () const
 Return determinant as product of diagonal values.
vnl_vector< T > solve (vnl_vector< T > const &b) const
 Return inv(D) * b.
void solve (vnl_vector< T > const &b, vnl_vector< T > *out) const
 Return inv(D) * b.
operator() (unsigned i, unsigned j) const
T & operator() (unsigned i, unsigned j)
T & operator() (unsigned i)
T const & operator() (unsigned i) const
T & operator[] (unsigned i)
T const & operator[] (unsigned i) const
void put (unsigned r, unsigned c, T const &v)
 set element with boundary checks.
get (unsigned r, unsigned c) const
 get element with boundary checks.
void fill_diagonal (T const &v)
 Set all diagonal elements of matrix to specified value.
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
unsigned size () const
unsigned rows () const
unsigned cols () const
unsigned columns () const
vnl_matrix< T > asMatrix () const
 Convert a vnl_diag_matrix to a Matrix.
vnl_matrix< T > as_ref () const
 operator vnl_matrix () const
void set_size (int n)
void clear ()
void fill (T const &x)
T * data_block ()
 Return pointer to the diagonal elements as a contiguous 1D C array;.
T const * data_block () const
vnl_vector< T > const & diagonal () const
 Return diagonal elements as a vector.
void set (vnl_vector< T > const &v)
 Set diagonal elements using vector.

Private Attributes

vnl_vector< T > diagonal_

Related Functions

(Note that these are not member functions.)

void vsl_b_write (vsl_b_ostream &os, const vnl_diag_matrix< T > &v)
 Binary save vnl_diag_matrix to stream.
void vsl_b_read (vsl_b_istream &is, vnl_diag_matrix< T > &v)
 Binary load vnl_diag_matrix from stream.
void vsl_print_summary (vcl_ostream &os, const vnl_diag_matrix< T > &b)
 Print human readable summary of object to a stream.
vcl_ostream & operator<< (vcl_ostream &, vnl_diag_matrix< T > const &)
vnl_diag_matrix< T > operator * (vnl_diag_matrix< T > const &A, vnl_diag_matrix< T > const &B)
 Multiply two vnl_diag_matrices. Just multiply the diag elements - n flops.
vnl_diag_matrix< T > operator+ (vnl_diag_matrix< T > const &A, vnl_diag_matrix< T > const &B)
 Add two vnl_diag_matrices. Just add the diag elements - n flops.
vnl_diag_matrix< T > operator- (vnl_diag_matrix< T > const &A, vnl_diag_matrix< T > const &B)
 Subtract two vnl_diag_matrices. Just subtract the diag elements - n flops.
vcl_ostream & vnl_matlab_print (vcl_ostream &, vnl_diag_matrix< T > const &, char const *variable_name=0, vnl_matlab_print_format=vnl_matlab_print_format_default)
 print a vnl_diagonal_matrix<T>.

Member Typedef Documentation

template<class T>
typedef vnl_vector<T>::iterator vnl_diag_matrix< T >::iterator

Definition at line 106 of file vnl_diag_matrix.h.

template<class T>
typedef vnl_vector<T>::const_iterator vnl_diag_matrix< T >::const_iterator

Definition at line 109 of file vnl_diag_matrix.h.


Constructor & Destructor Documentation

template<class T>
vnl_diag_matrix< T >::vnl_diag_matrix (  )  [inline]

Definition at line 43 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T >::vnl_diag_matrix ( unsigned  nn  )  [inline]

Construct an empty diagonal matrix.

Definition at line 46 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T >::vnl_diag_matrix ( unsigned  nn,
T const &  value 
) [inline]

Construct a diagonal matrix with diagonal elements equal to value.

Definition at line 49 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T >::vnl_diag_matrix ( vnl_vector< T > const &  that  )  [inline]

Construct a diagonal matrix from a vnl_vector.

The vector elements become the diagonal elements.

Definition at line 53 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T >::~vnl_diag_matrix (  )  [inline]

Definition at line 54 of file vnl_diag_matrix.h.


Member Function Documentation

template<class T>
vnl_diag_matrix& vnl_diag_matrix< T >::operator= ( vnl_diag_matrix< T > const &  that  )  [inline]

Definition at line 56 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix<T>& vnl_diag_matrix< T >::operator *= ( v  )  [inline]

In-place arithmetic operation.

Definition at line 64 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix<T>& vnl_diag_matrix< T >::operator/= ( v  )  [inline]

In-place arithmetic operation.

Definition at line 66 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::invert_in_place (  )  [inline]

Invert a vnl_diag_matrix in-situ.

Just replaces each element with its reciprocal.

Definition at line 173 of file vnl_diag_matrix.h.

template<class T>
T vnl_diag_matrix< T >::determinant (  )  const [inline]

Return determinant as product of diagonal values.

Definition at line 184 of file vnl_diag_matrix.h.

template<class T>
vnl_vector< T > vnl_diag_matrix< T >::solve ( vnl_vector< T > const &  b  )  const

Return inv(D) * b.

Definition at line 14 of file vnl_diag_matrix.txx.

template<class T>
void vnl_diag_matrix< T >::solve ( vnl_vector< T > const &  b,
vnl_vector< T > *  out 
) const

Return inv(D) * b.

Definition at line 25 of file vnl_diag_matrix.txx.

template<class T>
T vnl_diag_matrix< T >::operator() ( unsigned  i,
unsigned  j 
) const [inline]

Definition at line 77 of file vnl_diag_matrix.h.

template<class T>
T& vnl_diag_matrix< T >::operator() ( unsigned  i,
unsigned  j 
) [inline]

Definition at line 81 of file vnl_diag_matrix.h.

template<class T>
T& vnl_diag_matrix< T >::operator() ( unsigned  i  )  [inline]

Definition at line 85 of file vnl_diag_matrix.h.

template<class T>
T const& vnl_diag_matrix< T >::operator() ( unsigned  i  )  const [inline]

Definition at line 86 of file vnl_diag_matrix.h.

template<class T>
T& vnl_diag_matrix< T >::operator[] ( unsigned  i  )  [inline]

Definition at line 88 of file vnl_diag_matrix.h.

template<class T>
T const& vnl_diag_matrix< T >::operator[] ( unsigned  i  )  const [inline]

Definition at line 89 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::put ( unsigned  r,
unsigned  c,
T const &  v 
) [inline]

set element with boundary checks.

Definition at line 92 of file vnl_diag_matrix.h.

template<class T>
T vnl_diag_matrix< T >::get ( unsigned  r,
unsigned  c 
) const [inline]

get element with boundary checks.

Definition at line 97 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::fill_diagonal ( T const &  v  )  [inline]

Set all diagonal elements of matrix to specified value.

Definition at line 102 of file vnl_diag_matrix.h.

template<class T>
iterator vnl_diag_matrix< T >::begin (  )  [inline]

Definition at line 107 of file vnl_diag_matrix.h.

template<class T>
iterator vnl_diag_matrix< T >::end (  )  [inline]

Definition at line 108 of file vnl_diag_matrix.h.

template<class T>
const_iterator vnl_diag_matrix< T >::begin (  )  const [inline]

Definition at line 110 of file vnl_diag_matrix.h.

template<class T>
const_iterator vnl_diag_matrix< T >::end (  )  const [inline]

Definition at line 111 of file vnl_diag_matrix.h.

template<class T>
unsigned vnl_diag_matrix< T >::size (  )  const [inline]

Definition at line 113 of file vnl_diag_matrix.h.

template<class T>
unsigned vnl_diag_matrix< T >::rows (  )  const [inline]

Definition at line 114 of file vnl_diag_matrix.h.

template<class T>
unsigned vnl_diag_matrix< T >::cols (  )  const [inline]

Definition at line 115 of file vnl_diag_matrix.h.

template<class T>
unsigned vnl_diag_matrix< T >::columns (  )  const [inline]

Definition at line 116 of file vnl_diag_matrix.h.

template<class T>
vnl_matrix< T > vnl_diag_matrix< T >::asMatrix (  )  const [inline]

Convert a vnl_diag_matrix to a Matrix.

Definition at line 154 of file vnl_diag_matrix.h.

template<class T>
vnl_matrix<T> vnl_diag_matrix< T >::as_ref (  )  const [inline]

Definition at line 121 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T >::operator vnl_matrix (  )  const [inline]

Definition at line 124 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::set_size ( int  n  )  [inline]

Definition at line 126 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::clear (  )  [inline]

Definition at line 128 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::fill ( T const &  x  )  [inline]

Definition at line 129 of file vnl_diag_matrix.h.

template<class T>
T* vnl_diag_matrix< T >::data_block (  )  [inline]

Return pointer to the diagonal elements as a contiguous 1D C array;.

Definition at line 132 of file vnl_diag_matrix.h.

template<class T>
T const* vnl_diag_matrix< T >::data_block (  )  const [inline]

Definition at line 133 of file vnl_diag_matrix.h.

template<class T>
vnl_vector<T> const& vnl_diag_matrix< T >::diagonal (  )  const [inline]

Return diagonal elements as a vector.

Definition at line 136 of file vnl_diag_matrix.h.

template<class T>
void vnl_diag_matrix< T >::set ( vnl_vector< T > const &  v  )  [inline]

Set diagonal elements using vector.

Definition at line 139 of file vnl_diag_matrix.h.


Friends And Related Function Documentation

template<class T>
void vsl_b_write ( vsl_b_ostream os,
const vnl_diag_matrix< T > &  v 
) [related]

Binary save vnl_diag_matrix to stream.

template<class T>
void vsl_b_read ( vsl_b_istream is,
vnl_diag_matrix< T > &  v 
) [related]

Binary load vnl_diag_matrix from stream.

template<class T>
void vsl_print_summary ( vcl_ostream &  os,
const vnl_diag_matrix< T > &  b 
) [related]

Print human readable summary of object to a stream.

template<class T>
vcl_ostream & operator<< ( vcl_ostream &  ,
vnl_diag_matrix< T > const &   
) [related]

template<class T>
vnl_diag_matrix< T > operator * ( vnl_diag_matrix< T > const &  A,
vnl_diag_matrix< T > const &  B 
) [related]

Multiply two vnl_diag_matrices. Just multiply the diag elements - n flops.

Definition at line 197 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T > operator+ ( vnl_diag_matrix< T > const &  A,
vnl_diag_matrix< T > const &  B 
) [related]

Add two vnl_diag_matrices. Just add the diag elements - n flops.

Definition at line 238 of file vnl_diag_matrix.h.

template<class T>
vnl_diag_matrix< T > operator- ( vnl_diag_matrix< T > const &  A,
vnl_diag_matrix< T > const &  B 
) [related]

Subtract two vnl_diag_matrices. Just subtract the diag elements - n flops.

Definition at line 274 of file vnl_diag_matrix.h.

template<class T>
vcl_ostream & vnl_matlab_print ( vcl_ostream &  ,
vnl_diag_matrix< T > const &  ,
char const *  variable_name = 0,
vnl_matlab_print_format  = vnl_matlab_print_format_default 
) [related]

print a vnl_diagonal_matrix<T>.


Member Data Documentation

template<class T>
vnl_vector<T> vnl_diag_matrix< T >::diagonal_ [private]

Definition at line 40 of file vnl_diag_matrix.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:06:51 2010 for core/vnl by  doxygen 1.5.1