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

#include <SNgaussian.h>

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

Public Member Functions

 SNgaussian ()
 
template<class U , unsigned int s>
 SNgaussian (const SNgeneric< U, s > &A, const m_num &c=0)
 
SNgaussian< T, tp_size > inverse () const
 
void setColumn (const m_num &col)
 
m_num getColumn () const
 
- 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 &i, const m_num &j) const
 
template<class U , unsigned int s>
void populate_from (const SNgeneric< U, s > &)
 
 SNgaussian (const std::array< T, tp_size > &d, const m_num &c)
 
_get (m_num, m_num) const override
 
T & _at (m_num, m_num) override
 

Private Attributes

std::array< T, tp_size > data
 
m_num data_column
 

Detailed Description

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

This represents a gaussian matrix.

A gaussian matrix is the multiplicative matrix which serves to eliminate a column under the diagonal.

Let $A$ be a matrix and $ c $ be an index. Let $ m=A_{c,c}$. The gaussian matrix for $ A $ on the index $ c $ is full of zeros except for

That is there is something non trivial only on the column $ c $, under the diagonal.

TODO : giving 'c' as a template argument, one can in average spare half of the memory by allowing 'c' as size in 'data' instead of 'tp_size'.

Constructor & Destructor Documentation

template<class T , unsigned int tp_size>
SNgaussian< T, tp_size >::SNgaussian ( const std::array< T, tp_size > &  d,
const m_num c 
)
private

Construct a matrix from its data. See the implementation of '_at'

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

The non-parameter constructor initializes the member data_column to tp_size+1 (which is impossible). This is checked by the function _at so that you cannot populate the matrix before to initialize.

use setColumn()

template<class T , unsigned int tp_size>
template<class U , unsigned int s>
SNgaussian< T, tp_size >::SNgaussian ( const SNgeneric< U, s > &  A,
const m_num c = 0 
)

Construct a gaussian matrix from a generic one by

  • setting 1 on the diagonal (whatever there is in 'A'),
  • keeping what is below the diagonal on column 'c'
  • setting 0 everywhere else

Default column is zero. So

will produce the gaussian matrix of E for its first column (first=number zero) provided the type and size of E are compatible with "double" and zero.

Member Function Documentation

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

The elements are stored in std::array<T,tp_size> data while the matrix only contains non fixed values on one column, under the diagonal.

First element of data stores the first non fixed value. Example for a gaussian matrix on column 1 :

$ \matrix{ 1& 0& 0& 0\cr 0& 1 & 0 & 0\cr 0& d_0& 1& 0\cr 0& d_1& 0& 1\cr } $

Only the first (tp_size-c-1) elements of 'data' are used.

Implements SNgeneric< T, tp_size >.

template<class T , unsigned int tp_size>
T SNgaussian< 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 > SNgaussian< T, tp_size >::checkForSpecialElements ( const m_num i,
const m_num j 
) const
private

checkForSpecialElements(i,j) checks for element (i,j). If this is a special element (a one whose value is fixed by the fact that we are a gaussian matrix) then it returns a 'SpecialValue<T>' with its boolean part set to true, meaning that this is a special value. In that case :

If this is not a special value, it returns a 'SpecialValue<T>' with boolean part set to false. In that case :

  • both _get and _at have to search in the stored values.
template<class T , unsigned int tp_size>
m_num SNgaussian< T, tp_size >::getColumn ( ) const
template<class T , unsigned int tp_size>
SNgaussian< T, tp_size > SNgaussian< T, tp_size >::inverse ( ) const
template<class T , unsigned int tp_size>
template<class U , unsigned int s>
void SNgaussian< T, tp_size >::populate_from ( const SNgeneric< U, s > &  A)
private
template<class T , unsigned int tp_size>
void SNgaussian< T, tp_size >::setColumn ( const m_num col)

Set the number of the line on which one has non trivial elements.

Member Data Documentation

template<class T, unsigned int tp_size>
std::array<T,tp_size> SNgaussian< T, tp_size >::data
private
template<class T, unsigned int tp_size>
m_num SNgaussian< T, tp_size >::data_column
private

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