Alien  1.3.0
Developer documentation
Loading...
Searching...
No Matches
Alien::LinearAlgebraExpr< Tag, TagV > Class Template Reference

Linear algebra interface. More...

#include <core/alien/core/backend/LinearAlgebraExpr.h>

Collaboration diagram for Alien::LinearAlgebraExpr< Tag, TagV >:

Public Member Functions

template<typename... T>
 LinearAlgebraExpr (T... args)
 Creates a linear algebra.
virtual ~LinearAlgebraExpr ()
 Free resources.
Real norm0 (const IVector &x) const
 Compute L0 norm of a vector.
Real norm1 (const IVector &x) const
 Compute L1 norm of a vector.
Real norm2 (const IVector &x) const
 Compute L2 norm of a vector.
Real normInf (const IVector &x) const
 Compute LInf norm of a vector.
Real norm2 (const IMatrix &x) const
 Compute L2 (Frobenous) norm of a matrix.
void mult (const IMatrix &a, const IVector &x, IVector &r) const
 Compute a matrix vector product.
void axpy (Real alpha, const IVector &x, IVector &y) const
 Scale a vector by a factor and adds the result to another vector.
void aypx (Real alpha, IVector &y, const IVector &x) const
 Scale a vector by a factor and adds the result to another vector.
void copy (const IVector &x, IVector &r) const
 Copy a vector in another one.
void copy (const IMatrix &x, IMatrix &r) const
 Copy a matrix in another one.
void add (const IMatrix &a, IMatrix &b) const
 Add two matrices A and B.
Real dot (const IVector &x, const IVector &y) const
 Compute the dot product of two vectors.
void scal (Real alpha, IVector &x) const
 Scale a vector by a factor.
void scal (Real alpha, IMatrix &a) const
 Scale a matrix by a factor.
void diagonal (const IMatrix &a, IVector &x) const
 Extract the diagonal of a matrix in a vector.
void reciprocal (IVector &x) const
 Compute the reciprocal of a vector.
void pointwiseMult (const IVector &x, const IVector &y, IVector &w) const
 Compute the point wise multiplication of two vectors and store the result in another one.
void mult (const IMatrix &a, const UniqueArray< Real > &x, UniqueArray< Real > &r) const
 Compute a matrix vector product.
void axpy (Real alpha, const UniqueArray< Real > &x, UniqueArray< Real > &r) const
 Scale a vector by a factor and adds the result to another vector.
void aypx (Real alpha, UniqueArray< Real > &y, const UniqueArray< Real > &x) const
 Scale a vector by a factor and adds the result to another vector.
void copy (const UniqueArray< Real > &x, UniqueArray< Real > &r) const
 Copy a vector in another one.
Real dot (Integer local_size, const UniqueArray< Real > &x, const UniqueArray< Real > &y) const
 Compute the dot product of two vectors.
void scal (Real alpha, UniqueArray< Real > &x) const
 Scale a vector by a factor.
void dump (IMatrix const &a, std::string const &filename) const
 Dumps a matrix to a file.
void dump (IVector const &x, std::string const &filename) const
 Dumps a vector to a file.

Private Types

typedef AlgebraTraits< Tag >::algebra_type KernelAlgebra
 The type of the linear algebra.
typedef AlgebraTraits< Tag >::algebra_expr_type KernelAlgebraExpr

Private Attributes

std::unique_ptr< KernelAlgebraExpr > m_algebra
 The linear algebra kernel.

Detailed Description

template<class Tag, class TagV = Tag>
class Alien::LinearAlgebraExpr< Tag, TagV >

Linear algebra interface.

Interface for all linear algebra package

Template Parameters
TagThe tag of the type of matrix used
TagVThe tag of the type of vector used

Definition at line 48 of file LinearAlgebraExpr.h.

Member Typedef Documentation

◆ KernelAlgebra

template<class Tag, class TagV = Tag>
typedef AlgebraTraits<Tag>::algebra_type Alien::LinearAlgebraExpr< Tag, TagV >::KernelAlgebra
private

The type of the linear algebra.

Definition at line 281 of file LinearAlgebraExpr.h.

◆ KernelAlgebraExpr

template<class Tag, class TagV = Tag>
typedef AlgebraTraits<Tag>::algebra_expr_type Alien::LinearAlgebraExpr< Tag, TagV >::KernelAlgebraExpr
private

Definition at line 282 of file LinearAlgebraExpr.h.

Constructor & Destructor Documentation

◆ LinearAlgebraExpr()

template<class Tag, class TagV = Tag>
template<typename... T>
Alien::LinearAlgebraExpr< Tag, TagV >::LinearAlgebraExpr ( T... args)
inline

Creates a linear algebra.

Creates a linear algebra using traits and the linear algebra factory

Template Parameters
TVariadics type of linear algebra
Parameters
[in]argsLinear algebras

Definition at line 60 of file LinearAlgebraExpr.h.

◆ ~LinearAlgebraExpr()

template<class Tag, class TagV>
Alien::LinearAlgebraExpr< Tag, TagV >::~LinearAlgebraExpr ( )
virtual

Free resources.

Definition at line 32 of file LinearAlgebraExprT.h.

Member Function Documentation

◆ add()

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::add ( const IMatrix & a,
IMatrix & b ) const

Add two matrices A and B.

Parameters
[in]aThe matrix A
[in]bThe matrix B
[in,out]cThe resulting matrix

Definition at line 145 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ axpy() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::axpy ( Real alpha,
const IVector & x,
IVector & y ) const

Scale a vector by a factor and adds the result to another vector.

Scale the vector x by the real value alpha and add the result to the vector y : y += alpha * x

Parameters
[in]alphaThe real value to scale with
[in]xThe vector to be scaled
[in,out]yThe resulting vector

Definition at line 104 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ axpy() [2/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::axpy ( Real alpha,
const UniqueArray< Real > & x,
UniqueArray< Real > & r ) const

Scale a vector by a factor and adds the result to another vector.

Scale the vector x by the real value alpha and add the result to the vector y : y += alpha * x

Parameters
[in]alphaThe real value to scale with
[in]xThe vector to be scaled
[in,out]yThe resulting vector

Definition at line 233 of file LinearAlgebraExprT.h.

References m_algebra.

◆ aypx() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::aypx ( Real alpha,
IVector & y,
const IVector & x ) const

Scale a vector by a factor and adds the result to another vector.

Scale the vector y by the real value alpha and add the values of x : alpha * y += x

Parameters
[in]alphaThe real value to scale with
[in,out]yThe vector to be scaled
[in]xThe vector to add

Definition at line 116 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ aypx() [2/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::aypx ( Real alpha,
UniqueArray< Real > & y,
const UniqueArray< Real > & x ) const

Scale a vector by a factor and adds the result to another vector.

Scale the vector y by the real value alpha and add the values of x : alpha * y += x

Parameters
[in]alphaThe real value to scale with
[in,out]yThe vector to be scaled
[in]xThe vector to add

Definition at line 242 of file LinearAlgebraExprT.h.

References m_algebra.

◆ copy() [1/3]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::copy ( const IMatrix & x,
IMatrix & r ) const

Copy a matrix in another one.

Parameters
[in]xThe matrix to copy
[in,out]rThe copied matrix

Definition at line 136 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ copy() [2/3]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::copy ( const IVector & x,
IVector & r ) const

Copy a vector in another one.

Parameters
[in]xThe vector to copy
[in,out]rThe copied vector

Definition at line 127 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ copy() [3/3]

template<class Tag, class TagV = Tag>
void Alien::LinearAlgebraExpr< Tag, TagV >::copy ( const UniqueArray< Real > & x,
UniqueArray< Real > & r ) const

Copy a vector in another one.

Parameters
[in]xThe vector to copy
[in,out]rThe copied vector

◆ diagonal()

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::diagonal ( const IMatrix & a,
IVector & x ) const

Extract the diagonal of a matrix in a vector.

Parameters
[in]aThe matrix to extract the diagonal
[in,out]xThe diagonal elements of the matrix stored in a vector

Definition at line 167 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::MultiVectorImpl::get(), Alien::IMatrix::impl(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ dot() [1/2]

template<class Tag, class TagV>
Real Alien::LinearAlgebraExpr< Tag, TagV >::dot ( const IVector & x,
const IVector & y ) const

Compute the dot product of two vectors.

Parameters
[in]xThe first vector
[in]yThe second vector
Returns
The dot product of x * y

Definition at line 156 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ dot() [2/2]

template<class Tag, class TagV>
Real Alien::LinearAlgebraExpr< Tag, TagV >::dot ( Integer local_size,
const UniqueArray< Real > & x,
const UniqueArray< Real > & y ) const

Compute the dot product of two vectors.

Parameters
[in]local_sizeThe size of the vectors
[in]xThe first vector
[in]yThe second vector
Returns
The dot product of x * y

Definition at line 261 of file LinearAlgebraExprT.h.

References m_algebra.

◆ dump() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::dump ( IMatrix const & a,
std::string const & filename ) const

Dumps a matrix to a file.

Parameters
[in]aThe matrix to dump
[in]filenameThe name of the file

Definition at line 280 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ dump() [2/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::dump ( IVector const & x,
std::string const & filename ) const

Dumps a vector to a file.

Parameters
[in]xThe vector to dump
[in]filenameThe name of the file

Definition at line 290 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ mult() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::mult ( const IMatrix & a,
const IVector & x,
IVector & r ) const

Compute a matrix vector product.

Compute the matrix-vector product a by x and store it in r : r = a * x

Parameters
[in]aThe matrix to be multiplied
[in]xThe vector to be multipled
[in,out]rThe resulting vector

Definition at line 90 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::MultiVectorImpl::get(), Alien::IMatrix::impl(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ mult() [2/2]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::mult ( const IMatrix & a,
const UniqueArray< Real > & x,
UniqueArray< Real > & r ) const

Compute a matrix vector product.

Compute the matrix-vector product a by x and store it in r : r = a * x

Parameters
[in]aThe matrix to be multiplied
[in]xThe vector to be multipled
[in,out]rThe resulting vector

Definition at line 222 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ norm0()

template<class Tag, class TagV>
Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm0 ( const IVector & x) const

Compute L0 norm of a vector.

Parameters
[in]xThe vector on which norm0 is computed
Returns
The norm0 of the vector

Definition at line 38 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ norm1()

template<class Tag, class TagV>
Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm1 ( const IVector & x) const

Compute L1 norm of a vector.

Parameters
[in]xThe vector on which norm0 is computed
Returns
The norm1 of the vector

Definition at line 48 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ norm2() [1/2]

template<class Tag, class TagV>
Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm2 ( const IMatrix & x) const

Compute L2 (Frobenous) norm of a matrix.

Parameters
[in]xThe matrix on which norm2 is computed
Returns
The norm2 of the matrix

Definition at line 81 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ norm2() [2/2]

template<class Tag, class TagV>
Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm2 ( const IVector & x) const

Compute L2 norm of a vector.

Parameters
[in]xThe vector on which norm0 is computed
Returns
The norm2 of the vector

Definition at line 59 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ normInf()

template<class Tag, class TagV>
Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::normInf ( const IVector & x) const

Compute LInf norm of a vector.

Parameters
[in]xThe vector on which norm0 is computed
Returns
The normInf of the vector

Definition at line 70 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ pointwiseMult()

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::pointwiseMult ( const IVector & x,
const IVector & y,
IVector & w ) const

Compute the point wise multiplication of two vectors and store the result in another one.

Parameters
[in]xThe first vector
[in]yThe second vector
[in,out]wThe resulting vector

Definition at line 207 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ reciprocal()

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::reciprocal ( IVector & x) const

Compute the reciprocal of a vector.

Parameters
[in,out]xThe vector to be processed

Definition at line 180 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ scal() [1/3]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::scal ( Real alpha,
IMatrix & a ) const

Scale a matrix by a factor.

Parameters
[in]alphaThe real value to scale with
[in,out]xThe vector to be scaled

Definition at line 197 of file LinearAlgebraExprT.h.

References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.

Here is the call graph for this function:

◆ scal() [2/3]

template<class Tag, class TagV>
void Alien::LinearAlgebraExpr< Tag, TagV >::scal ( Real alpha,
IVector & x ) const

Scale a vector by a factor.

Parameters
[in]alphaThe real value to scale with
[in,out]xThe vector to be scaled

Definition at line 190 of file LinearAlgebraExprT.h.

References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.

Here is the call graph for this function:

◆ scal() [3/3]

template<class Tag, class TagV = Tag>
void Alien::LinearAlgebraExpr< Tag, TagV >::scal ( Real alpha,
UniqueArray< Real > & x ) const

Scale a vector by a factor.

Parameters
[in]alphaThe real value to scale with
[in,out]xThe vector to be scaled

Member Data Documentation

◆ m_algebra

template<class Tag, class TagV = Tag>
std::unique_ptr<KernelAlgebraExpr> Alien::LinearAlgebraExpr< Tag, TagV >::m_algebra
private

The linear algebra kernel.

Definition at line 284 of file LinearAlgebraExpr.h.

Referenced by add(), axpy(), axpy(), aypx(), aypx(), copy(), copy(), diagonal(), dot(), dot(), dump(), dump(), mult(), mult(), norm0(), norm1(), norm2(), norm2(), normInf(), pointwiseMult(), reciprocal(), scal(), and scal().


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