Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Related Functions
vnl_sym_matrix< T > Class Template Reference

stores a symmetric matrix as just the diagonal and lower triangular part. More...

#include <vnl_sym_matrix.h>

List of all members.

Public Types

typedef T * iterator
typedef const T * const_iterator

Public Member Functions

 vnl_sym_matrix ()
 Construct an empty symmetric matrix.
 vnl_sym_matrix (unsigned nn)
 Construct a symmetric matrix of size nn by nn.
 vnl_sym_matrix (T const *data, unsigned nn)
 Construct a symmetric matrix with elements equal to data.
 vnl_sym_matrix (unsigned nn, const T &value)
 Construct a symmetric matrix with all elements equal to value.
 vnl_sym_matrix (vnl_matrix< T > const &that)
 Construct a symmetric matrix from a full matrix.
 vnl_sym_matrix (vnl_sym_matrix< T > const &that)
 Copy constructor.
 ~vnl_sym_matrix ()
vnl_sym_matrix< T > & operator= (vnl_sym_matrix< T > const &that)
vnl_sym_matrix< T > & operator*= (T v)
 In-place arithmetic operations.
vnl_sym_matrix< T > & operator/= (T v)
 In-place arithmetic operations.
operator() (unsigned i, unsigned j) const
T & operator() (unsigned i, unsigned j)
const T * operator[] (unsigned i) const
 Access a half-row of data.
fast (unsigned i, unsigned j) const
 fast access, however i >= j.
T & fast (unsigned i, unsigned j)
 fast access, however i >= j.
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
unsigned long size () const
unsigned rows () const
unsigned cols () const
unsigned columns () const
vnl_matrix< T > as_matrix () const
 Convert a vnl_sym_matrix to a vnl_matrix.
void set_size (int n)
 Resize matrix to n by n.
T * data_block ()
 Return pointer to the lower triangular elements as a contiguous 1D C array;.
T const * data_block () const
 Return pointer to the lower triangular elements as a contiguous 1D C array;.
void set_half_row (const vnl_vector< T > &half_row, unsigned i)
 Set the first i values of row i.
vnl_sym_matrix< T > & update (vnl_sym_matrix< T > const &m, unsigned diag_start=0)
 Replaces the symmetric submatrix of THIS matrix with the elements of matrix m.
void swap (vnl_sym_matrix &m)
 Swap contents of m with THIS.

Protected Member Functions

void setup_index ()
 Set up the index array.

Protected Attributes

T * data_
T ** index_
unsigned nn_

Related Functions

(Note that these are not member functions.)

template<class T >
void vsl_b_write (vsl_b_ostream &os, const vnl_sym_matrix< T > &v)
 Binary save vnl_matrix to stream.
template<class T >
void vsl_b_read (vsl_b_istream &is, vnl_sym_matrix< T > &v)
 Binary load vnl_matrix from stream.
template<class T >
void vsl_print_summary (vcl_ostream &os, const vnl_sym_matrix< T > &b)
 Print human readable summary of object to a stream.
template<class T >
vcl_ostream & operator<< (vcl_ostream &, vnl_sym_matrix< T > const &)
template<class T >
void swap (vnl_sym_matrix< T > &a, vnl_sym_matrix< T > &b)
 Swap the contents of a and b.

Detailed Description

template<class T>
class vnl_sym_matrix< T >

stores a symmetric matrix as just the diagonal and lower triangular part.

vnl_sym_matrix stores a symmetric matrix for time and space efficiency. Specifically, only the diagonal and lower triangular elements are stored.

Definition at line 25 of file vnl_sym_matrix.h.


Member Typedef Documentation

template<class T>
typedef const T* vnl_sym_matrix< T >::const_iterator

Definition at line 100 of file vnl_sym_matrix.h.

template<class T>
typedef T* vnl_sym_matrix< T >::iterator

Definition at line 97 of file vnl_sym_matrix.h.


Constructor & Destructor Documentation

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

Construct an empty symmetric matrix.

Definition at line 29 of file vnl_sym_matrix.h.

template<class T>
vnl_sym_matrix< T >::vnl_sym_matrix ( unsigned  nn) [inline, explicit]

Construct a symmetric matrix of size nn by nn.

Definition at line 32 of file vnl_sym_matrix.h.

template<class T >
vnl_sym_matrix< T >::vnl_sym_matrix ( T const *  data,
unsigned  nn 
) [inline]

Construct a symmetric matrix with elements equal to data.

Value should be stored row-wise, and contain the n*(n+1)/2 diagonal and lower triangular elements

Definition at line 151 of file vnl_sym_matrix.h.

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

Construct a symmetric matrix with all elements equal to value.

Definition at line 163 of file vnl_sym_matrix.h.

template<class T >
vnl_sym_matrix< T >::vnl_sym_matrix ( vnl_matrix< T > const &  that) [inline, explicit]

Construct a symmetric matrix from a full matrix.

If NDEBUG is set, the symmetry of the matrix will be asserted.

Definition at line 174 of file vnl_sym_matrix.h.

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

Copy constructor.

Definition at line 190 of file vnl_sym_matrix.h.

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

Definition at line 52 of file vnl_sym_matrix.h.


Member Function Documentation

template<class T >
vnl_matrix< T > vnl_sym_matrix< T >::as_matrix ( ) const [inline]

Convert a vnl_sym_matrix to a vnl_matrix.

Definition at line 199 of file vnl_sym_matrix.h.

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

Definition at line 98 of file vnl_sym_matrix.h.

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

Definition at line 101 of file vnl_sym_matrix.h.

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

Definition at line 106 of file vnl_sym_matrix.h.

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

Definition at line 107 of file vnl_sym_matrix.h.

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

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

Definition at line 118 of file vnl_sym_matrix.h.

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

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

Definition at line 120 of file vnl_sym_matrix.h.

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

Definition at line 99 of file vnl_sym_matrix.h.

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

Definition at line 102 of file vnl_sym_matrix.h.

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

fast access, however i >= j.

Definition at line 84 of file vnl_sym_matrix.h.

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

fast access, however i >= j.

Definition at line 90 of file vnl_sym_matrix.h.

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

Definition at line 68 of file vnl_sym_matrix.h.

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

Definition at line 72 of file vnl_sym_matrix.h.

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

In-place arithmetic operations.

Definition at line 61 of file vnl_sym_matrix.h.

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

In-place arithmetic operations.

Definition at line 63 of file vnl_sym_matrix.h.

template<class T >
vnl_sym_matrix< T > & vnl_sym_matrix< T >::operator= ( vnl_sym_matrix< T > const &  that)

Definition at line 49 of file vnl_sym_matrix.txx.

template<class T>
const T* vnl_sym_matrix< T >::operator[] ( unsigned  i) const [inline]

Access a half-row of data.

Only the first i+1 values from this pointer are valid.

Definition at line 78 of file vnl_sym_matrix.h.

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

Definition at line 105 of file vnl_sym_matrix.h.

template<class T >
void vnl_sym_matrix< T >::set_half_row ( const vnl_vector< T > &  half_row,
unsigned  i 
)

Set the first i values of row i.

or the top i values of column i

Definition at line 62 of file vnl_sym_matrix.txx.

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

Resize matrix to n by n.

You will loose any existing data.

Definition at line 210 of file vnl_sym_matrix.h.

template<class T>
void vnl_sym_matrix< T >::setup_index ( ) [inline, protected]

Set up the index array.

Definition at line 135 of file vnl_sym_matrix.h.

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

Definition at line 104 of file vnl_sym_matrix.h.

template<class T >
void vnl_sym_matrix< T >::swap ( vnl_sym_matrix< T > &  m)

Swap contents of m with THIS.

Definition at line 33 of file vnl_sym_matrix.txx.

template<class T >
vnl_sym_matrix< T > & vnl_sym_matrix< T >::update ( vnl_sym_matrix< T > const &  m,
unsigned  diagonal_start = 0 
)

Replaces the symmetric submatrix of THIS matrix with the elements of matrix m.

Replaces the symmetric submatrix of THIS matrix, starting at top left corner, by the elements of matrix m.

Starting at top left corner. Complexity is $O(m^2)$.

O(m*m).

Definition at line 15 of file vnl_sym_matrix.txx.


Friends And Related Function Documentation

template<class T >
vcl_ostream & operator<< ( vcl_ostream &  ,
vnl_sym_matrix< T > const &   
) [related]
template<class T >
void swap ( vnl_sym_matrix< T > &  a,
vnl_sym_matrix< T > &  b 
) [related]

Swap the contents of a and b.

Definition at line 236 of file vnl_sym_matrix.h.

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

Binary load vnl_matrix from stream.

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

Binary save vnl_matrix to stream.

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

Print human readable summary of object to a stream.


Member Data Documentation

template<class T>
T* vnl_sym_matrix< T >::data_ [protected]

Definition at line 140 of file vnl_sym_matrix.h.

template<class T>
T** vnl_sym_matrix< T >::index_ [protected]

Definition at line 141 of file vnl_sym_matrix.h.

template<class T>
unsigned vnl_sym_matrix< T >::nn_ [protected]

Definition at line 142 of file vnl_sym_matrix.h.


The documentation for this class was generated from the following files: