GetFEM  5.4.2
gmm_blas.h File Reference

Basic linear algebra functions. More...

#include "gmm_scaled.h"
#include "gmm_transposed.h"
#include "gmm_conjugated.h"

Go to the source code of this file.

Functions

template<typename L >
void gmm::clear (L &l)
 clear (fill with zeros) a vector or matrix.
 
template<typename L >
size_type gmm::nnz (const L &l)
 count the number of non-zero entries of a vector or matrix.
 
template<typename L >
void gmm::fill (L &l, typename gmm::linalg_traits< L >::value_type x)
 *‍/ More...
 
template<typename L >
void gmm::fill_random (L &l)
 fill a vector or matrix with random value (uniform [-1,1]).
 
template<typename L >
void gmm::fill_random (L &l, double cfill)
 *‍/ More...
 
template<typename V >
void gmm::resize (V &v, size_type n)
 *‍/ More...
 
template<typename M >
void gmm::resize (M &v, size_type m, size_type n)
 *‍/ More...
 
template<typename M >
void gmm::reshape (M &v, size_type m, size_type n)
 *‍/ More...
 
template<typename V1 , typename V2 >
strongest_value_type< V1, V2 >::value_type gmm::vect_sp (const V1 &v1, const V2 &v2)
 *‍/ More...
 
template<typename MATSP , typename V1 , typename V2 >
strongest_value_type3< V1, V2, MATSP >::value_type gmm::vect_sp (const MATSP &ps, const V1 &v1, const V2 &v2)
 scalar product between two vectors, using a matrix. More...
 
template<typename V1 , typename V2 >
strongest_value_type< V1, V2 >::value_type gmm::vect_hp (const V1 &v1, const V2 &v2)
 *‍/ More...
 
template<typename MATSP , typename V1 , typename V2 >
strongest_value_type3< V1, V2, MATSP >::value_type gmm::vect_hp (const MATSP &ps, const V1 &v1, const V2 &v2)
 Hermitian product with a matrix.
 
template<typename M >
linalg_traits< M >::value_type gmm::mat_trace (const M &m)
 Trace of a matrix.
 
template<typename V >
number_traits< typename linalg_traits< V >::value_type >::magnitude_type gmm::vect_norm2_sqr (const V &v)
 squared Euclidean norm of a vector.
 
template<typename V >
number_traits< typename linalg_traits< V >::value_type >::magnitude_type gmm::vect_norm2 (const V &v)
 Euclidean norm of a vector.
 
template<typename V1 , typename V2 >
number_traits< typename linalg_traits< V1 >::value_type >::magnitude_type gmm::vect_dist2_sqr (const V1 &v1, const V2 &v2)
 squared Euclidean distance between two vectors
 
template<typename V1 , typename V2 >
number_traits< typename linalg_traits< V1 >::value_type >::magnitude_type gmm::vect_dist2 (const V1 &v1, const V2 &v2)
 Euclidean distance between two vectors.
 
template<typename M >
number_traits< typename linalg_traits< M >::value_type >::magnitude_type gmm::mat_euclidean_norm_sqr (const M &m)
 *‍/ More...
 
template<typename M >
number_traits< typename linalg_traits< M >::value_type >::magnitude_type gmm::mat_euclidean_norm (const M &m)
 Euclidean norm of a matrix.
 
template<typename V >
number_traits< typename linalg_traits< V >::value_type >::magnitude_type gmm::vect_norm1 (const V &v)
 1-norm of a vector
 
template<typename V1 , typename V2 >
number_traits< typename linalg_traits< V1 >::value_type >::magnitude_type gmm::vect_dist1 (const V1 &v1, const V2 &v2)
 1-distance between two vectors
 
template<typename V >
number_traits< typename linalg_traits< V >::value_type >::magnitude_type gmm::vect_norminf (const V &v)
 Infinity norm of a vector.
 
template<typename V1 , typename V2 >
number_traits< typename linalg_traits< V1 >::value_type >::magnitude_type gmm::vect_distinf (const V1 &v1, const V2 &v2)
 Infinity distance between two vectors.
 
template<typename M >
number_traits< typename linalg_traits< M >::value_type >::magnitude_type gmm::mat_norm1 (const M &m)
 *‍/ More...
 
template<typename M >
number_traits< typename linalg_traits< M >::value_type >::magnitude_type gmm::mat_norminf (const M &m)
 *‍/ More...
 
template<typename M >
number_traits< typename linalg_traits< M >::value_type >::magnitude_type gmm::mat_maxnorm (const M &m)
 *‍/ More...
 
template<typename L >
void gmm::clean (L &l, double threshold)
 Clean a vector or matrix (replace near-zero entries with zeroes). More...
 
template<typename L1 , typename L2 >
void gmm::copy (const L1 &l1, L2 &l2)
 *‍/ More...
 
template<typename L1 , typename L2 >
void gmm::add (const L1 &l1, L2 &l2)
 *‍/ More...
 
template<typename L1 , typename L2 , typename L3 >
void gmm::add (const L1 &l1, const L2 &l2, L3 &l3)
 *‍/ More...
 
template<typename L1 , typename L2 , typename L3 >
void gmm::mult (const L1 &l1, const L2 &l2, L3 &l3)
 *‍/ More...
 
template<typename L1 , typename L2 , typename L3 >
void gmm::mult_add (const L1 &l1, const L2 &l2, L3 &l3)
 *‍/ More...
 
template<typename MAT >
bool gmm::is_symmetric (const MAT &A, magnitude_of_linalg(MAT) tol=magnitude_of_linalg(MAT)(-1))
 *‍/ More...
 
template<typename MAT >
bool gmm::is_hermitian (const MAT &A, magnitude_of_linalg(MAT) tol=magnitude_of_linalg(MAT)(-1))
 *‍/ More...
 

Detailed Description

Basic linear algebra functions.

Author
Yves Renard Yves..nosp@m.Rena.nosp@m.rd@in.nosp@m.sa-l.nosp@m.yon.f.nosp@m.r
Date
October 13, 2002.

Definition in file gmm_blas.h.

Function Documentation

◆ fill()

template<typename L >
void gmm::fill ( L &  l,
typename gmm::linalg_traits< L >::value_type  x 
)
inline

*‍/

fill a vector or matrix with x.

Definition at line 103 of file gmm_blas.h.

◆ fill_random()

template<typename L >
void gmm::fill_random ( L &  l,
double  cfill 
)
inline

*‍/

fill a vector or matrix with random value.

Parameters
la vector or matrix.
cfillprobability of a non-zero value.

Definition at line 154 of file gmm_blas.h.

◆ resize() [1/2]

template<typename V >
void gmm::resize ( V &  v,
size_type  n 
)
inline

*‍/

resize a vector.

Definition at line 209 of file gmm_blas.h.

◆ resize() [2/2]

template<typename M >
void gmm::resize ( M &  v,
size_type  m,
size_type  n 
)
inline

*‍/

resize a matrix

Definition at line 231 of file gmm_blas.h.

◆ reshape()

template<typename M >
void gmm::reshape ( M &  v,
size_type  m,
size_type  n 
)
inline

*‍/

reshape a matrix

Definition at line 250 of file gmm_blas.h.

◆ vect_sp() [1/2]

template<typename V1 , typename V2 >
strongest_value_type<V1,V2>::value_type gmm::vect_sp ( const V1 &  v1,
const V2 &  v2 
)
inline

*‍/

scalar product between two vectors

Definition at line 263 of file gmm_blas.h.

◆ vect_sp() [2/2]

template<typename MATSP , typename V1 , typename V2 >
strongest_value_type3<V1,V2,MATSP>::value_type gmm::vect_sp ( const MATSP &  ps,
const V1 &  v1,
const V2 &  v2 
)
inline

scalar product between two vectors, using a matrix.

Parameters
psthe matrix of the scalar product.
v1the first vector
v2the second vector

Definition at line 278 of file gmm_blas.h.

◆ vect_hp()

template<typename V1 , typename V2 >
strongest_value_type<V1,V2>::value_type gmm::vect_hp ( const V1 &  v1,
const V2 &  v2 
)
inline

*‍/

Hermitian product.

Definition at line 511 of file gmm_blas.h.

◆ mat_euclidean_norm_sqr()

template<typename M >
number_traits<typename linalg_traits<M>::value_type>::magnitude_type gmm::mat_euclidean_norm_sqr ( const M &  m)
inline

*‍/

squared Euclidean norm of a matrix.

Definition at line 626 of file gmm_blas.h.

◆ mat_norm1()

template<typename M >
number_traits<typename linalg_traits<M>::value_type>::magnitude_type gmm::mat_norm1 ( const M &  m)

*‍/

1-norm of a matrix

Definition at line 782 of file gmm_blas.h.

◆ mat_norminf()

template<typename M >
number_traits<typename linalg_traits<M>::value_type>::magnitude_type gmm::mat_norminf ( const M &  m)

*‍/

infinity-norm of a matrix.

Definition at line 836 of file gmm_blas.h.

◆ mat_maxnorm()

template<typename M >
number_traits<typename linalg_traits<M>::value_type>::magnitude_type gmm::mat_maxnorm ( const M &  m)

*‍/

max-norm of a matrix.

Definition at line 870 of file gmm_blas.h.

◆ clean()

template<typename L >
void gmm::clean ( L &  l,
double  threshold 
)
inline

Clean a vector or matrix (replace near-zero entries with zeroes).


◆ copy()

template<typename L1 , typename L2 >
void gmm::copy ( const L1 &  l1,
L2 &  l2 
)
inline

*‍/

Copy vectors or matrices.

Parameters
l1source vector or matrix.
l2destination.

Definition at line 977 of file gmm_blas.h.

◆ add() [1/2]

template<typename L1 , typename L2 >
void gmm::add ( const L1 &  l1,
L2 &  l2 
)
inline

*‍/

Add two vectors or matrices

Parameters
l1
l2contains on output, l2+l1.

Definition at line 1268 of file gmm_blas.h.

◆ add() [2/2]

template<typename L1 , typename L2 , typename L3 >
void gmm::add ( const L1 &  l1,
const L2 &  l2,
L3 &  l3 
)
inline

*‍/

Addition of two vectors/matrices

Parameters
l1
l2
l3contains l1+l2 on output

Definition at line 1425 of file gmm_blas.h.

◆ mult()

template<typename L1 , typename L2 , typename L3 >
void gmm::mult ( const L1 &  l1,
const L2 &  l2,
L3 &  l3 
)
inline

*‍/

matrix-vector or matrix-matrix product.

Parameters
l1a matrix.
l2a vector or matrix.
l3the product l1*l2.

Definition at line 1654 of file gmm_blas.h.

◆ mult_add()

template<typename L1 , typename L2 , typename L3 >
void gmm::mult_add ( const L1 &  l1,
const L2 &  l2,
L3 &  l3 
)
inline

*‍/

Multiply-accumulate. l3 += l1*l2;

Definition at line 1781 of file gmm_blas.h.

◆ is_symmetric()

template<typename MAT >
bool gmm::is_symmetric ( const MAT &  A,
magnitude_of_linalg(MAT)  tol = magnitude_of_linalg(MAT)(-1) 
)
inline

*‍/

test if A is symmetric.

Parameters
Aa matrix.
tola threshold.

Definition at line 2168 of file gmm_blas.h.

◆ is_hermitian()

template<typename MAT >
bool gmm::is_hermitian ( const MAT &  A,
magnitude_of_linalg(MAT)  tol = magnitude_of_linalg(MAT)(-1) 
)
inline

*‍/

test if A is Hermitian.

Parameters
Aa matrix.
tola threshold.

Definition at line 2229 of file gmm_blas.h.