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

Linear algebra interface. More...

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

Inheritance diagram for Alien::LinearAlgebra< Tag, TagV >:
Collaboration diagram for Alien::LinearAlgebra< Tag, TagV >:

Public Member Functions

template<typename... T>
 LinearAlgebra (T... args)
 Creates a linear algebra.
virtual ~LinearAlgebra ()
 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.
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.
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 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 (const 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.
Public Member Functions inherited from Alien::ILinearAlgebra
virtual ~ILinearAlgebra ()
 Free resources.

Private Types

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

Private Attributes

std::unique_ptr< KernelAlgebram_algebra
 The linear algebra kernel.

Detailed Description

template<class Tag, class TagV = Tag>
class Alien::LinearAlgebra< 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 49 of file LinearAlgebra.h.

Member Typedef Documentation

◆ KernelAlgebra

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

The type of the linear algebra.

Definition at line 250 of file LinearAlgebra.h.

Constructor & Destructor Documentation

◆ LinearAlgebra()

template<class Tag, class TagV = Tag>
template<typename... T>
Alien::LinearAlgebra< Tag, TagV >::LinearAlgebra ( 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 61 of file LinearAlgebra.h.

◆ ~LinearAlgebra()

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

Free resources.

Definition at line 33 of file LinearAlgebraT.h.

Member Function Documentation

◆ axpy() [1/2]

template<class Tag, class TagV = Tag>
void Alien::LinearAlgebra< Tag, TagV >::axpy ( const 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

◆ axpy() [2/2]

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

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

Implements Alien::ILinearAlgebra.

Definition at line 94 of file LinearAlgebraT.h.

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

Here is the call graph for this function:

◆ aypx() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebra< 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 106 of file LinearAlgebraT.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 = Tag>
void Alien::LinearAlgebra< 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

◆ copy() [1/2]

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

Copy a vector in another one.

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

Implements Alien::ILinearAlgebra.

Definition at line 117 of file LinearAlgebraT.h.

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

Here is the call graph for this function:

◆ copy() [2/2]

template<class Tag, class TagV = Tag>
void Alien::LinearAlgebra< 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::LinearAlgebra< 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 139 of file LinearAlgebraT.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::LinearAlgebra< Tag, TagV >::dot ( const IVector & x,
const IVector & y ) const
virtual

Compute the dot product of two vectors.

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

Implements Alien::ILinearAlgebra.

Definition at line 128 of file LinearAlgebraT.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 = Tag>
Real Alien::LinearAlgebra< 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

◆ dump() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebra< 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 189 of file LinearAlgebraT.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::LinearAlgebra< 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 199 of file LinearAlgebraT.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::LinearAlgebra< Tag, TagV >::mult ( const IMatrix & a,
const IVector & x,
IVector & r ) const
virtual

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

Implements Alien::ILinearAlgebra.

Definition at line 80 of file LinearAlgebraT.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 = Tag>
void Alien::LinearAlgebra< 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

◆ norm0()

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

Compute L0 norm of a vector.

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

Implements Alien::ILinearAlgebra.

Definition at line 39 of file LinearAlgebraT.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::LinearAlgebra< Tag, TagV >::norm1 ( const IVector & x) const
virtual

Compute L1 norm of a vector.

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

Implements Alien::ILinearAlgebra.

Definition at line 49 of file LinearAlgebraT.h.

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

Here is the call graph for this function:

◆ norm2()

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

Compute L2 norm of a vector.

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

Implements Alien::ILinearAlgebra.

Definition at line 60 of file LinearAlgebraT.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::LinearAlgebra< Tag, TagV >::normInf ( const IVector & x) const

Compute LInf norm of a vector.

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

Definition at line 71 of file LinearAlgebraT.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::LinearAlgebra< 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 172 of file LinearAlgebraT.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::LinearAlgebra< Tag, TagV >::reciprocal ( IVector & x) const

Compute the reciprocal of a vector.

Parameters
[in,out]xThe vector to be processed

Definition at line 152 of file LinearAlgebraT.h.

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

Here is the call graph for this function:

◆ scal() [1/2]

template<class Tag, class TagV>
void Alien::LinearAlgebra< 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 162 of file LinearAlgebraT.h.

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

Here is the call graph for this function:

◆ scal() [2/2]

template<class Tag, class TagV = Tag>
void Alien::LinearAlgebra< 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<KernelAlgebra> Alien::LinearAlgebra< Tag, TagV >::m_algebra
private

The linear algebra kernel.

Definition at line 252 of file LinearAlgebra.h.

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


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