finitediff
Classes | Functions
MathUtilities.h File Reference
#include "../exceptions/SNexceptions.cpp"
Include dependency graph for MathUtilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SNgeneric< T, tp_size >
 This is the base class for the other matrices types. More...
 

Functions

template<class U , unsigned int s, class V , unsigned int t>
void checkSizeCompatibility (const SNgeneric< U, s > &A, const SNgeneric< V, t > &B)
 
template<class T , class U >
bool componentWiseeEquality (const T &A, const U &B)
 
template<class T , class U , unsigned int s, unsigned int t>
matrixProductComponent (const SNgeneric< T, s > &A, const SNgeneric< U, t > &B, unsigned int i, unsigned int j)
 compute the component (i,j) of the matrix product A*B More...
 
template<class U , unsigned int t, class T , unsigned int tp_size>
void copyFirstLines (SNgeneric< U, t > &ans, const SNgeneric< T, tp_size > &A, const m_num max_l)
 copy the first lines of a matrix in an other one. More...
 

Function Documentation

template<class U , unsigned int s, class V , unsigned int t>
void checkSizeCompatibility ( const SNgeneric< U, s > &  A,
const SNgeneric< V, t > &  B 
)
template<class T , class U >
bool componentWiseeEquality ( const T &  A,
const U &  B 
)
template<class U , unsigned int t, class T , unsigned int tp_size>
void copyFirstLines ( SNgeneric< U, t > &  ans,
const SNgeneric< T, tp_size > &  A,
const m_num  max_l 
)

copy the first lines of a matrix in an other one.

Parameters
ansthe matrix in which one copies (non-const).
Athe matrix from which one copies (const).
max_lthe number of lines that have to be copied (const).
1 copyFirstLines(A,B,5);

Now the 5 first lines in A are the same of the ones of B. The previously present elements in the first 5 lines of A are lost.

This function is useful to populate the "answer" matrix when multiplying a gaussian matrix by something else.

Remarks :

  • the matrices ans and A must have same size;
  • for the template type, ans is SNgeneric<U,s> and A is SNgeneric<T,tp_size>. Obviously the conversion from T to U must be possible.
See also
SNmultiGaussian<T,tp_size>::setFirstLines(const SNgeneric<U,s>& other,const m_num max_l);
template<class T , class U , unsigned int s, unsigned int t>
T matrixProductComponent ( const SNgeneric< T, s > &  A,
const SNgeneric< U, t > &  B,
unsigned int  i,
unsigned int  j 
)

compute the component (i,j) of the matrix product A*B

Parameters
Aa matrix
Ba matrix
ithe line of the element of 'A*B' to be computed
jthe column of the element of 'A*B' to be computed

The size compatibility is not checked since this functions is supposed to be called from something like an operator * that has already checked the compatibility.

As stated in the README.md, the type of the elements in the returned matrix is the one of the first matrix of the product.