Public Types | Public Member Functions | Private Attributes | Related Functions | List of all members
vnl_diag_matrix_fixed< T, N > Class Template Reference

stores a diagonal matrix as a single vector. More...

#include <vnl_diag_matrix_fixed.h>

Inheritance diagram for vnl_diag_matrix_fixed< T, N >:
Inheritance graph
[legend]

Public Types

typedef vnl_vector_fixed< T, N >::iterator iterator
 
typedef vnl_vector_fixed< T, N >::const_iterator const_iterator
 

Public Member Functions

 vnl_diag_matrix_fixed ()
 
 vnl_diag_matrix_fixed (T const &value)
 Construct a diagonal matrix with diagonal elements equal to value. More...
 
 vnl_diag_matrix_fixed (vnl_vector_fixed< T, N > const &that)
 Construct a diagonal matrix from a vnl_vector_fixed. More...
 
 ~vnl_diag_matrix_fixed ()=default
 
vnl_diag_matrix_fixedoperator= (vnl_diag_matrix_fixed< T, N > const &that)
 
vnl_diag_matrix_fixed< T, N > & operator *= (T v)
 In-place arithmetic operation. More...
 
vnl_diag_matrix_fixed< T, N > & operator/= (T v)
 In-place arithmetic operation. More...
 
vnl_diag_matrix_fixedinvert_in_place ()
 Invert a vnl_diag_matrix_fixed in-situ, then returns *this. More...
 
determinant () const
 Return determinant as product of diagonal values. More...
 
vnl_vector_fixed< T, N > solve (vnl_vector_fixed< T, N > const &b) const
 Return inv(D) * b. More...
 
void solve (vnl_vector_fixed< T, N > const &b, vnl_vector_fixed< T, N > *out) const
 Return inv(D) * b. More...
 
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
 
vnl_vector_fixed< T, N > get_diagonal () const
 Return a vector (copy) with the content of the (main) diagonal. More...
 
vnl_vector_fixed< T, N > const & diagonal () const
 Return diagonal elements as a vector. More...
 
vnl_diag_matrix_fixedfill_diagonal (T const &v)
 Set all diagonal elements of matrix to specified value. More...
 
vnl_diag_matrix_fixedset_diagonal (vnl_vector_fixed< T, N > const &v)
 Sets the diagonal elements of this matrix to the specified list of values. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
unsigned int size () const
 Return the total number of elements stored by the matrix. More...
 
unsigned int rows () const
 Return the number of rows. More...
 
unsigned int cols () const
 Return the number of columns. More...
 
unsigned int columns () const
 Return the number of columns. More...
 
void put (unsigned r, unsigned c, T const &v)
 set element with boundary checks. More...
 
get (unsigned r, unsigned c) const
 get element with boundary checks. More...
 
vnl_matrix_fixed< T, N, N > as_matrix_fixed () const
 Convert a vnl_diag_matrix_fixed to a Matrix. More...
 
vnl_matrix_fixed< T, N, N > as_ref () const
 
 operator vnl_matrix_fixed< T, N, N > () const
 
vnl_diag_matrix_fixedfill (T const &x)
 
T * data_block ()
 Return pointer to the diagonal elements as a contiguous 1D C array;. More...
 
T const * data_block () const
 
vnl_diag_matrix_fixedset (vnl_vector_fixed< T, N > const &v)
 Set diagonal elements using vector, then return *this. More...
 

Private Attributes

vnl_vector_fixed< T, N > diagonal_
 

Related Functions

(Note that these are not member functions.)

template<class T , unsigned int n>
vnl_diag_matrix_fixed< std::complex< T >, n > vnl_complexify (vnl_diag_matrix_fixed< T, n > const &R)
 Return complexified version of real fixed diagonal matrix R. More...
 
template<class T , unsigned int N>
VNL_EXPORT std::ostream & operator<< (std::ostream &, vnl_diag_matrix_fixed< T, N > const &)
 
template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator * (vnl_diag_matrix_fixed< T, N > const &A, vnl_diag_matrix_fixed< T, N > const &B)
 Multiply two vnl_diag_matrices. Just multiply the diag elements - n flops. More...
 
template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator+ (vnl_diag_matrix_fixed< T, N > const &A, vnl_diag_matrix_fixed< T, N > const &B)
 Add two vnl_diag_matrices. Just add the diag elements - n flops. More...
 
template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator- (vnl_diag_matrix_fixed< T, N > const &A, vnl_diag_matrix_fixed< T, N > const &B)
 Subtract two vnl_diag_matrices. Just subtract the diag elements - n flops. More...
 
template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > vnl_imag (vnl_diag_matrix_fixed< std::complex< T >, N > const &C)
 Matrix of imaginary parts of vnl_diag_matrix_fixed<std::complex<T> >. More...
 
template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > vnl_real (vnl_diag_matrix_fixed< std::complex< T >, N > const &C)
 Matrix of real parts of vnl_diag_matrix_fixed<std::complex<T> >. More...
 

Detailed Description

template<class T, unsigned int N>
class vnl_diag_matrix_fixed< T, N >

stores a diagonal matrix as a single vector.

vnl_diag_matrix_fixed 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 30 of file vnl_diag_matrix_fixed.h.

Member Typedef Documentation

◆ const_iterator

template<class T, unsigned int N>
typedef vnl_vector_fixed<T,N>::const_iterator vnl_diag_matrix_fixed< T, N >::const_iterator

Definition at line 110 of file vnl_diag_matrix_fixed.h.

◆ iterator

template<class T, unsigned int N>
typedef vnl_vector_fixed<T,N>::iterator vnl_diag_matrix_fixed< T, N >::iterator

Definition at line 107 of file vnl_diag_matrix_fixed.h.

Constructor & Destructor Documentation

◆ vnl_diag_matrix_fixed() [1/3]

template<class T, unsigned int N>
vnl_diag_matrix_fixed< T, N >::vnl_diag_matrix_fixed ( )
inline

Definition at line 45 of file vnl_diag_matrix_fixed.h.

◆ vnl_diag_matrix_fixed() [2/3]

template<class T, unsigned int N>
vnl_diag_matrix_fixed< T, N >::vnl_diag_matrix_fixed ( T const &  value)
inline

Construct a diagonal matrix with diagonal elements equal to value.

Definition at line 49 of file vnl_diag_matrix_fixed.h.

◆ vnl_diag_matrix_fixed() [3/3]

template<class T, unsigned int N>
vnl_diag_matrix_fixed< T, N >::vnl_diag_matrix_fixed ( vnl_vector_fixed< T, N > const &  that)
inlineexplicit

Construct a diagonal matrix from a vnl_vector_fixed.

The vector elements become the diagonal elements.

Definition at line 53 of file vnl_diag_matrix_fixed.h.

◆ ~vnl_diag_matrix_fixed()

template<class T, unsigned int N>
vnl_diag_matrix_fixed< T, N >::~vnl_diag_matrix_fixed ( )
default

Member Function Documentation

◆ as_matrix_fixed()

template<class T , unsigned int N>
vnl_matrix_fixed< T, N, N > vnl_diag_matrix_fixed< T, N >::as_matrix_fixed ( ) const
inline

Convert a vnl_diag_matrix_fixed to a Matrix.

Definition at line 181 of file vnl_diag_matrix_fixed.h.

◆ as_ref()

template<class T, unsigned int N>
vnl_matrix_fixed<T,N,N> vnl_diag_matrix_fixed< T, N >::as_ref ( ) const
inline

Definition at line 157 of file vnl_diag_matrix_fixed.h.

◆ begin() [1/2]

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N >::iterator vnl_diag_matrix_fixed< T, N >::begin ( )

Definition at line 16 of file vnl_diag_matrix_fixed.hxx.

◆ begin() [2/2]

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N >::const_iterator vnl_diag_matrix_fixed< T, N >::begin ( ) const

Definition at line 24 of file vnl_diag_matrix_fixed.hxx.

◆ cols()

template<class T, unsigned int N>
unsigned int vnl_diag_matrix_fixed< T, N >::cols ( ) const
inline

Return the number of columns.

A synonym for columns().

Definition at line 124 of file vnl_diag_matrix_fixed.h.

◆ columns()

template<class T, unsigned int N>
unsigned int vnl_diag_matrix_fixed< T, N >::columns ( ) const
inline

Return the number of columns.

A synonym for cols().

Definition at line 128 of file vnl_diag_matrix_fixed.h.

◆ data_block() [1/2]

template<class T, unsigned int N>
T* vnl_diag_matrix_fixed< T, N >::data_block ( )
inline

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

Definition at line 165 of file vnl_diag_matrix_fixed.h.

◆ data_block() [2/2]

template<class T, unsigned int N>
T const* vnl_diag_matrix_fixed< T, N >::data_block ( ) const
inline

Definition at line 166 of file vnl_diag_matrix_fixed.h.

◆ determinant()

template<class T , unsigned int N>
T vnl_diag_matrix_fixed< T, N >::determinant ( ) const
inline

Return determinant as product of diagonal values.

Definition at line 210 of file vnl_diag_matrix_fixed.h.

◆ diagonal()

template<class T, unsigned int N>
vnl_vector_fixed<T,N> const& vnl_diag_matrix_fixed< T, N >::diagonal ( ) const
inline

Return diagonal elements as a vector.

Definition at line 97 of file vnl_diag_matrix_fixed.h.

◆ end() [1/2]

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N >::iterator vnl_diag_matrix_fixed< T, N >::end ( )

Definition at line 20 of file vnl_diag_matrix_fixed.hxx.

◆ end() [2/2]

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N >::const_iterator vnl_diag_matrix_fixed< T, N >::end ( ) const

Definition at line 28 of file vnl_diag_matrix_fixed.hxx.

◆ fill()

template<class T, unsigned int N>
vnl_diag_matrix_fixed& vnl_diag_matrix_fixed< T, N >::fill ( T const &  x)
inline

Definition at line 162 of file vnl_diag_matrix_fixed.h.

◆ fill_diagonal()

template<class T, unsigned int N>
vnl_diag_matrix_fixed& vnl_diag_matrix_fixed< T, N >::fill_diagonal ( T const &  v)
inline

Set all diagonal elements of matrix to specified value.

Definition at line 100 of file vnl_diag_matrix_fixed.h.

◆ get()

template<class T, unsigned int N>
T vnl_diag_matrix_fixed< T, N >::get ( unsigned  r,
unsigned  c 
) const
inline

get element with boundary checks.

Definition at line 143 of file vnl_diag_matrix_fixed.h.

◆ get_diagonal()

template<class T, unsigned int N>
vnl_vector_fixed<T,N> vnl_diag_matrix_fixed< T, N >::get_diagonal ( ) const
inline

Return a vector (copy) with the content of the (main) diagonal.

Definition at line 94 of file vnl_diag_matrix_fixed.h.

◆ invert_in_place()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > & vnl_diag_matrix_fixed< T, N >::invert_in_place ( )
inline

Invert a vnl_diag_matrix_fixed in-situ, then returns *this.

Just replaces each element with its reciprocal.

Definition at line 199 of file vnl_diag_matrix_fixed.h.

◆ operator *=()

template<class T, unsigned int N>
vnl_diag_matrix_fixed<T,N>& vnl_diag_matrix_fixed< T, N >::operator *= ( v)
inline

In-place arithmetic operation.

Definition at line 64 of file vnl_diag_matrix_fixed.h.

◆ operator vnl_matrix_fixed< T, N, N >()

template<class T, unsigned int N>
vnl_diag_matrix_fixed< T, N >::operator vnl_matrix_fixed< T, N, N > ( ) const
inline

Definition at line 160 of file vnl_diag_matrix_fixed.h.

◆ operator()() [1/4]

template<class T, unsigned int N>
T vnl_diag_matrix_fixed< T, N >::operator() ( unsigned  i,
unsigned  j 
) const
inline

Definition at line 77 of file vnl_diag_matrix_fixed.h.

◆ operator()() [2/4]

template<class T, unsigned int N>
T& vnl_diag_matrix_fixed< T, N >::operator() ( unsigned  i,
unsigned  j 
)
inline

Definition at line 81 of file vnl_diag_matrix_fixed.h.

◆ operator()() [3/4]

template<class T, unsigned int N>
T& vnl_diag_matrix_fixed< T, N >::operator() ( unsigned  i)
inline

Definition at line 87 of file vnl_diag_matrix_fixed.h.

◆ operator()() [4/4]

template<class T, unsigned int N>
T const& vnl_diag_matrix_fixed< T, N >::operator() ( unsigned  i) const
inline

Definition at line 88 of file vnl_diag_matrix_fixed.h.

◆ operator/=()

template<class T, unsigned int N>
vnl_diag_matrix_fixed<T,N>& vnl_diag_matrix_fixed< T, N >::operator/= ( v)
inline

In-place arithmetic operation.

Definition at line 66 of file vnl_diag_matrix_fixed.h.

◆ operator=()

template<class T, unsigned int N>
vnl_diag_matrix_fixed& vnl_diag_matrix_fixed< T, N >::operator= ( vnl_diag_matrix_fixed< T, N > const &  that)
inline

Definition at line 56 of file vnl_diag_matrix_fixed.h.

◆ operator[]() [1/2]

template<class T, unsigned int N>
T& vnl_diag_matrix_fixed< T, N >::operator[] ( unsigned  i)
inline

Definition at line 90 of file vnl_diag_matrix_fixed.h.

◆ operator[]() [2/2]

template<class T, unsigned int N>
T const& vnl_diag_matrix_fixed< T, N >::operator[] ( unsigned  i) const
inline

Definition at line 91 of file vnl_diag_matrix_fixed.h.

◆ put()

template<class T, unsigned int N>
void vnl_diag_matrix_fixed< T, N >::put ( unsigned  r,
unsigned  c,
T const &  v 
)
inline

set element with boundary checks.

Definition at line 131 of file vnl_diag_matrix_fixed.h.

◆ rows()

template<class T, unsigned int N>
unsigned int vnl_diag_matrix_fixed< T, N >::rows ( ) const
inline

Return the number of rows.

Definition at line 120 of file vnl_diag_matrix_fixed.h.

◆ set()

template<class T, unsigned int N>
vnl_diag_matrix_fixed& vnl_diag_matrix_fixed< T, N >::set ( vnl_vector_fixed< T, N > const &  v)
inline

Set diagonal elements using vector, then return *this.

Definition at line 169 of file vnl_diag_matrix_fixed.h.

◆ set_diagonal()

template<class T, unsigned int N>
vnl_diag_matrix_fixed& vnl_diag_matrix_fixed< T, N >::set_diagonal ( vnl_vector_fixed< T, N > const &  v)
inline

Sets the diagonal elements of this matrix to the specified list of values.

Definition at line 103 of file vnl_diag_matrix_fixed.h.

◆ size()

template<class T, unsigned int N>
unsigned int vnl_diag_matrix_fixed< T, N >::size ( ) const
inline

Return the total number of elements stored by the matrix.

Since vnl_diag_matrix_fixed only stores values on the diagonal and must be square, size() == rows() == cols().

Definition at line 117 of file vnl_diag_matrix_fixed.h.

◆ solve() [1/2]

template<class T, unsigned int N>
vnl_vector_fixed< T, N > vnl_diag_matrix_fixed< T, N >::solve ( vnl_vector_fixed< T, N > const &  b) const

Return inv(D) * b.

Definition at line 32 of file vnl_diag_matrix_fixed.hxx.

◆ solve() [2/2]

template<class T, unsigned int N>
void vnl_diag_matrix_fixed< T, N >::solve ( vnl_vector_fixed< T, N > const &  b,
vnl_vector_fixed< T, N > *  out 
) const

Return inv(D) * b.

Definition at line 42 of file vnl_diag_matrix_fixed.hxx.

Friends And Related Function Documentation

◆ operator *()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator * ( vnl_diag_matrix_fixed< T, N > const &  A,
vnl_diag_matrix_fixed< T, N > const &  B 
)
related

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

Definition at line 222 of file vnl_diag_matrix_fixed.h.

◆ operator+()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator+ ( vnl_diag_matrix_fixed< T, N > const &  A,
vnl_diag_matrix_fixed< T, N > const &  B 
)
related

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

Definition at line 260 of file vnl_diag_matrix_fixed.h.

◆ operator-()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > operator- ( vnl_diag_matrix_fixed< T, N > const &  A,
vnl_diag_matrix_fixed< T, N > const &  B 
)
related

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

Definition at line 293 of file vnl_diag_matrix_fixed.h.

◆ operator<<()

template<class T , unsigned int N>
VNL_EXPORT std::ostream & operator<< ( std::ostream &  ,
vnl_diag_matrix_fixed< T, N > const &   
)
related

◆ vnl_complexify()

template<class T , unsigned int n>
vnl_diag_matrix_fixed< std::complex< T >, n > vnl_complexify ( vnl_diag_matrix_fixed< T, n > const &  R)
related

Return complexified version of real fixed diagonal matrix R.

Definition at line 98 of file vnl_complexify.h.

◆ vnl_imag()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > vnl_imag ( vnl_diag_matrix_fixed< std::complex< T >, N > const &  C)
related

Matrix of imaginary parts of vnl_diag_matrix_fixed<std::complex<T> >.

Definition at line 89 of file vnl_imag.h.

◆ vnl_real()

template<class T , unsigned int N>
vnl_diag_matrix_fixed< T, N > vnl_real ( vnl_diag_matrix_fixed< std::complex< T >, N > const &  C)
related

Matrix of real parts of vnl_diag_matrix_fixed<std::complex<T> >.

Definition at line 89 of file vnl_real.h.

Member Data Documentation

◆ diagonal_

template<class T, unsigned int N>
vnl_vector_fixed<T,N> vnl_diag_matrix_fixed< T, N >::diagonal_
private

Definition at line 42 of file vnl_diag_matrix_fixed.h.


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