finitediff
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SNmultiGaussian< T, tp_size > Class Template Reference

#include <SNmultiGaussian.h>

Inheritance diagram for SNmultiGaussian< T, tp_size >:
Inheritance graph
[legend]
Collaboration diagram for SNmultiGaussian< T, tp_size >:
Collaboration graph
[legend]

Public Member Functions

 SNmultiGaussian ()
 
 SNmultiGaussian (const SNgeneric< T, tp_size > &A)
 
 SNmultiGaussian (const SNgaussian< T, tp_size > &A)
 
 SNmultiGaussian (const SNmultiGaussian< T, tp_size > &A)
 
void swap (SNmultiGaussian< T, tp_size > &)
 
SNmultiGaussian< T, tp_size > & operator= (SNmultiGaussian< T, tp_size >)
 
void operator*= (const SNgaussian< T, tp_size > &other)
 
SNmultiGaussian< T, tp_size > inverse () const
 
void swapLines (const m_num &i, const m_num &j)
 
m_num getLastColumn () const
 
void setLastColumn (const m_num &lc)
 Set the number of the last non trivial column. More...
 
template<class U , unsigned int s>
void setFirstLines (const SNgeneric< U, s > &other, const m_num max_l)
 copies the first max_l lines from other to this. More...
 
- Public Member Functions inherited from SNgeneric< T, tp_size >
virtual unsigned int getSize () const final
 
virtual T & at (const m_num, const m_num) final
 
virtual T get (const m_num, const m_num) const final
 
virtual SNline< T, tp_size > getSNline (m_num l) const
 
template<class V , unsigned int s>
void subtract (const SNgeneric< V, s > &)
 
template<class V , unsigned int s>
void subtract (const SNgaussian< V, s > &)
 
SNgaussian< T, tp_size > getGaussian (const m_num c) const
 
template<class V , unsigned int s>
bool isNumericallyEqual (const SNgeneric< V, s > &A, const double &epsilon) const
 

Private Member Functions

SpecialValue< T > checkForSpecialElements (const m_num &, const m_num &) const
 
_get (m_num, m_num) const override
 
T & _at (m_num, m_num) override
 

Private Attributes

SNlowerTriangular< T, tp_size > data_L
 
m_num data_last_column
 

Detailed Description

template<class T, unsigned int tp_size>
class SNmultiGaussian< T, tp_size >

This class represent matrices that are product of gaussian matrices. They are "partially" the lower triangular part of the PLU decomposition during the process.

Some of the properties of these matrices are

Constructor & Destructor Documentation

template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size >::SNmultiGaussian ( )

The no-parameter constructor initializes data_last_column to tp_size+1, and this is detected by _at so that you cannot populate the matrix before to have initialized the maximal non trivial column number.

See setLastColumn.

template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size >::SNmultiGaussian ( const SNgeneric< T, tp_size > &  A)

Construct gaussian matrix of the first line of the argument A

A gaussian matrix is a particular case of multi-gaussian matrix.

template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size >::SNmultiGaussian ( const SNgaussian< T, tp_size > &  A)
template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size >::SNmultiGaussian ( const SNmultiGaussian< T, tp_size > &  A)

Member Function Documentation

template<class T , unsigned int tp_size>
T & SNmultiGaussian< T, tp_size >::_at ( m_num  ,
m_num   
)
overrideprivatevirtual

Return by reference the requested element of the matrix

Implements SNgeneric< T, tp_size >.

template<class T , unsigned int tp_size>
T SNmultiGaussian< T, tp_size >::_get ( m_num  ,
m_num   
) const
overrideprivatevirtual

Return by value the requested element of the matrix

Implements SNgeneric< T, tp_size >.

template<class T , unsigned int tp_size>
SpecialValue< T > SNmultiGaussian< T, tp_size >::checkForSpecialElements ( const m_num i,
const m_num j 
) const
private

A SpecialValue represents a value in the matrix that is fixed by the type of the matrix (like "0" at position (1,4) for a lower triangular matrix).

This is merely a pair "value,boolean". The boolean says if the requested element is special.

  • if true, the value is the special value
  • if false, the value is dummy because it means that the requested element is not special in this kind of matrix.
template<class T , unsigned int tp_size>
m_num SNmultiGaussian< T, tp_size >::getLastColumn ( ) const

return the number of the last non trivial column

template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size > SNmultiGaussian< T, tp_size >::inverse ( ) const

return the inverse matrix

template<class T , unsigned int tp_size>
void SNmultiGaussian< T, tp_size >::operator*= ( const SNgaussian< T, tp_size > &  other)

The product $ AB $ is easy when $ A $ is multigaussian and $ B $ is a gaussian matrix for the next line.

A*=B does

template<class T , unsigned int tp_size>
SNmultiGaussian< T, tp_size > & SNmultiGaussian< T, tp_size >::operator= ( SNmultiGaussian< T, tp_size >  other)
template<class T , unsigned int tp_size>
template<class U , unsigned int s>
void SNmultiGaussian< T, tp_size >::setFirstLines ( const SNgeneric< U, s > &  other,
const m_num  max_l 
)

copies the first max_l lines from other to this.

The first max_l lines are copied from other taking into account :

  • the elements that cannot be changed here will not be changed. Typically, the element (0,0) of other will be neglected. Also every diagonal elements are ignored, and all the elements that are beyond this->getLastColumn().
  • The size of other must be the same.
  • The template type of other must be convertible to the template type of this.
  • The copy copies each line from column 0 to the diagonal (exclusively). It does not restrict itself to something like the minimum between the diagonal and this->getLastColumn(). Thus : the real last column of the resulting matrix could be incorrect.

    The last point needs attention. One could just take care of that issue during the copying process by looking at non zero elements located beyond the data_last_column column. But if these elements are "fake zeroes" like they should be zero but are, for numerical reasons, non vanishing; in this case we loose a good occasion to make then real zeroes.

    You have to set by hand the last column attribute before to call setLastColumn.

See also
setLastColumn
copyFirstLines(SNgeneric<U,t>& ans, const SNgeneric<T,tp_size>& A,const m_num max_l)
template<class T , unsigned int tp_size>
void SNmultiGaussian< T, tp_size >::setLastColumn ( const m_num lc)

Set the number of the last non trivial column.

Needed for optimization purpose : during the PLU decomposition, one need to modify a multi-gaussian matrix at each step. The point is to modify it, not re-creating a new one each time.

template<class T , unsigned int tp_size>
void SNmultiGaussian< T, tp_size >::swap ( SNmultiGaussian< T, tp_size > &  other)
template<class T , unsigned int tp_size>
void SNmultiGaussian< T, tp_size >::swapLines ( const m_num i,
const m_num j 
)

Member Data Documentation

template<class T, unsigned int tp_size>
SNlowerTriangular<T,tp_size> SNmultiGaussian< T, tp_size >::data_L
private
template<class T, unsigned int tp_size>
m_num SNmultiGaussian< T, tp_size >::data_last_column
private

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