finitediff
Functions
SNoperators.h File Reference
#include "SNpermutation.h"
#include "SNgaussian.h"
#include "SNmultiGaussian.h"
#include "SNidentity.h"
#include "SNlowerTriangular.h"
#include "SNupperTriangular.h"
#include "MathUtilities.h"
#include "../exceptions/SNexceptions.cpp"
Include dependency graph for SNoperators.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class U , class V , unsigned int s, unsigned int t>
SNmatrix< U, s > operator* (const SNgeneric< U, s > &A, const SNgeneric< V, t > &B)
 SNgeneric * SNgeneric. More...
 
template<class U , class V , unsigned int s, unsigned int t>
SNmatrix< U, s > operator* (const SNgaussian< U, s > &A, const SNgeneric< V, t > &B)
 Product SNgaussian * SNgeneric More...
 
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian< U, s > operator* (const SNgaussian< U, s > &A, const SNgaussian< V, t > &B)
 
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian< U, s > operator* (const SNmultiGaussian< U, s > &M, const SNgaussian< V, t > &G)
 
template<class U , class V , unsigned int s, unsigned int t>
SNmatrix< U, s > operator* (const SNmultiGaussian< U, s > &M, const SNgeneric< V, t > &E)
 Product SNmultiGaussian * SNgeneric More...
 
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian< U, s > operator* (const SNmultiGaussian< U, s > &A, const SNmultiGaussian< V, t > &B)
 
template<class U , class V , unsigned int s, unsigned int t>
SNlowerTriangular< U, s > operator* (const SNgaussian< U, s > &A, const SNlowerTriangular< V, t > &B)
 
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian< U, s > operator* (const SNgaussian< U, s > &G, const SNmultiGaussian< V, t > &M)
 Product SNgaussian * SNmultiGaussian More...
 
template<unsigned int tp_size>
Mpermutation< tp_size > operator* (const Mpermutation< tp_size > &p1, const Mpermutation< tp_size > &p2)
 
template<unsigned int tp_size>
Mpermutation< tp_size > operator* (const MgenericPermutation< tp_size > &A, const MgenericPermutation< tp_size > &B)
 Product MgenericPermutation * MgenericPermutation More...
 
template<class U , unsigned int s, class V , unsigned int t>
SNmatrix< U, s > operator+ (const SNmatrix< U, s > &A, const SNmatrix< V, t > &B)
 
template<class U , unsigned int s, class V , unsigned int t>
SNmatrix< U, s > operator- (const SNgeneric< U, s > &A, const SNidentity< V, t > &B)
 
template<class U , unsigned int s, class V , unsigned int t>
bool operator== (const SNgeneric< U, s > &A, const SNgeneric< V, t > &B)
 
template<class U , unsigned int s, class V , unsigned int t>
bool operator== (const SNmatrix< U, s > &A, const SNmatrix< V, t > &B)
 
template<class U , unsigned int s, class V , unsigned int t>
bool operator== (const SNmatrix< U, s > &A, const SNupperTriangular< V, t > &B)
 
template<unsigned int tp_size>
bool operator== (const Mpermutation< tp_size > &A, const Mpermutation< tp_size > &B)
 Return true if the two permutations are equal. More...
 
template<unsigned int tp_size>
bool operator== (const MgenericPermutation< tp_size > &A, const MgenericPermutation< tp_size > &B)
 Return true if the two permutations are equal. More...
 

Function Documentation

template<class U , class V , unsigned int s, unsigned int t>
SNmatrix<U,s> operator* ( const SNgeneric< U, s > &  A,
const SNgeneric< V, t > &  B 
)

SNgeneric * SNgeneric.

In general, I cannot do better than compute everything.

The very point of making many different classes is NOT to use this 'default' implementation for the product.

When this product is used, a warning is displayed.

See also
tooGenericWarning
template<class U , class V , unsigned int s, unsigned int t>
SNmatrix<U,s> operator* ( const SNgaussian< U, s > &  A,
const SNgeneric< V, t > &  B 
)

Product SNgaussian * SNgeneric

As far as the template parameters are concerned, the answer is SNmatrix<T,tp_size> with

  • T is the type of the gaussian (the left operand)
  • tp_size is the common size of the two matrices.

Let $ G $ be gaussian with non trivial column $ c $ and $ E $ be generic. For the product $ GE $ one can copy the first $ c $ lines.

For the other lines ( $ i>c $) the sum $ (GE)_{ij}=\sum_kG_{ik}E_{kj} $ is non vanishing only with $ k=i $ and $ k=c $.

template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian<U,s> operator* ( const SNgaussian< U, s > &  A,
const SNgaussian< V, t > &  B 
)
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian<U,s> operator* ( const SNmultiGaussian< U, s > &  M,
const SNgaussian< V, t > &  G 
)
template<class U , class V , unsigned int s, unsigned int t>
SNmatrix<U,s> operator* ( const SNmultiGaussian< U, s > &  M,
const SNgeneric< V, t > &  E 
)

Product SNmultiGaussian * SNgeneric

As far as the template parameters are concerned, the answer is SNmatrix<T,tp_size> with

  • T is the type of the multi-gaussian (the left operand)
  • tp_size is the common size of the two matrices.

We populate the answer line by line. Let $ M $ be a multi-gaussian and $ E $ a generic matrix. We denote by $ c $ the last non-trivial column of $ M $.

For computing $ (ME)_{ij}=\sum_kM_{ik}E_{kj} $ :

  • the first line is copied.
  • if $ i<c $ we compute the product with the first $ i-1 $ elements, and add the $ i $th.
  • if $ i\geq c $ we compute the first $ c-1 $ products and add the $ i $th.
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian<U,s> operator* ( const SNmultiGaussian< U, s > &  A,
const SNmultiGaussian< V, t > &  B 
)
template<class U , class V , unsigned int s, unsigned int t>
SNlowerTriangular<U,s> operator* ( const SNgaussian< U, s > &  A,
const SNlowerTriangular< V, t > &  B 
)
template<class U , class V , unsigned int s, unsigned int t>
SNmultiGaussian<U,s> operator* ( const SNgaussian< U, s > &  G,
const SNmultiGaussian< V, t > &  M 
)

Product SNgaussian * SNmultiGaussian

The answer is SNmultiGaussian<T,tp_size> with

  • T is the type of the gaussian (the left operand)
  • tp_size is the common size of the two matrices.
  • the last non trivial column is the max of the column of the first argument and of the last non trivial of the second argument.

Let $ G $ be a gaussian matrix for the column $ col $ and $ M $ a multi-gaussian with max column $ l_c $.

For computing the element $ (GM)_{ij}=\sum_kG_{ik}M{kj} $ we use the structure of $ G $.

  • If $ i\leq col $ we have $ (GM)_{ij}=M_{ij} $. So we copy the first $ col $ lines.
  • The sum has only two non vanishing terms and we have $ (GM)_{ij}=M_{ij}+G_{i,col}M_{col,j} $.
template<unsigned int tp_size>
Mpermutation<tp_size> operator* ( const Mpermutation< tp_size > &  p1,
const Mpermutation< tp_size > &  p2 
)

The multiplication "permutation1 * permutation2" is the composition.

template<unsigned int tp_size>
Mpermutation<tp_size> operator* ( const MgenericPermutation< tp_size > &  A,
const MgenericPermutation< tp_size > &  B 
)

Product MgenericPermutation * MgenericPermutation

The product is the composition.

This product defines the products of Mpermutation and MelementaryPermutation (there are 4 possibilities).

template<class U , unsigned int s, class V , unsigned int t>
SNmatrix<U,s> operator+ ( const SNmatrix< U, s > &  A,
const SNmatrix< V, t > &  B 
)

Sum of two SNmatrix.

The return type is the one of the left argument. THUS : this is not totally commutative. You may have $ A+B\neq B+A $

template<class U , unsigned int s, class V , unsigned int t>
SNmatrix<U,s> operator- ( const SNgeneric< U, s > &  A,
const SNidentity< V, t > &  B 
)
template<class U , unsigned int s, class V , unsigned int t>
bool operator== ( const SNgeneric< U, s > &  A,
const SNgeneric< V, t > &  B 
)
template<class U , unsigned int s, class V , unsigned int t>
bool operator== ( const SNmatrix< U, s > &  A,
const SNmatrix< V, t > &  B 
)
template<class U , unsigned int s, class V , unsigned int t>
bool operator== ( const SNmatrix< U, s > &  A,
const SNupperTriangular< V, t > &  B 
)
template<unsigned int tp_size>
bool operator== ( const Mpermutation< tp_size > &  A,
const Mpermutation< tp_size > &  B 
)

Return true if the two permutations are equal.

template<unsigned int tp_size>
bool operator== ( const MgenericPermutation< tp_size > &  A,
const MgenericPermutation< tp_size > &  B 
)

Return true if the two permutations are equal.