finitediff
|
#include <SNmultiGaussian.h>
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 |
T | _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 |
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
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
.
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.
SNmultiGaussian< T, tp_size >::SNmultiGaussian | ( | const SNgaussian< T, tp_size > & | A | ) |
SNmultiGaussian< T, tp_size >::SNmultiGaussian | ( | const SNmultiGaussian< T, tp_size > & | A | ) |
|
overrideprivatevirtual |
Return by reference the requested element of the matrix
Implements SNgeneric< T, tp_size >.
|
overrideprivatevirtual |
Return by value the requested element of the matrix
Implements SNgeneric< T, tp_size >.
|
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.
m_num SNmultiGaussian< T, tp_size >::getLastColumn | ( | ) | const |
return the number of the last non trivial column
SNmultiGaussian< T, tp_size > SNmultiGaussian< T, tp_size >::inverse | ( | ) | const |
return the inverse matrix
void SNmultiGaussian< T, tp_size >::operator*= | ( | const SNgaussian< T, tp_size > & | other | ) |
The product is easy when is multigaussian and is a gaussian matrix for the next line.
A*=B
does
A=A*B
if A is multigaussian with last non trivial column and if B is gaussian for the column .IncompatibleMatrixSizeException
exception if the size are not the same.ProbablyNotWhatYouWantException
if the requirements about the column are not fulfilled. SNmultiGaussian< T, tp_size > & SNmultiGaussian< T, tp_size >::operator= | ( | SNmultiGaussian< T, tp_size > | other | ) |
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 :
other
will be neglected. Also every diagonal elements are ignored, and all the elements that are beyond this->getLastColumn()
.other
must be the same.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
.
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.
void SNmultiGaussian< T, tp_size >::swap | ( | SNmultiGaussian< T, tp_size > & | other | ) |
void SNmultiGaussian< T, tp_size >::swapLines | ( | const m_num & | i, |
const m_num & | j | ||
) |
|
private |
|
private |