Linear algebra interface. More...
#include <core/alien/core/backend/LinearAlgebra.h>
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< KernelAlgebra > | m_algebra |
| The linear algebra kernel. | |
Linear algebra interface.
Interface for all linear algebra package
| Tag | The tag of the type of matrix used |
| TagV | The tag of the type of vector used |
Definition at line 49 of file LinearAlgebra.h.
|
private |
The type of the linear algebra.
Definition at line 250 of file LinearAlgebra.h.
|
inline |
Creates a linear algebra.
Creates a linear algebra using traits and the linear algebra factory
| T | Variadics type of linear algebra |
| [in] | args | Linear algebras |
Definition at line 61 of file LinearAlgebra.h.
|
virtual |
Free resources.
Definition at line 33 of file LinearAlgebraT.h.
| 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
| [in] | alpha | The real value to scale with |
| [in] | x | The vector to be scaled |
| [in,out] | y | The resulting vector |
|
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
| [in] | alpha | The real value to scale with |
| [in] | x | The vector to be scaled |
| [in,out] | y | The resulting vector |
Implements Alien::ILinearAlgebra.
Definition at line 94 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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
| [in] | alpha | The real value to scale with |
| [in,out] | y | The vector to be scaled |
| [in] | x | The vector to add |
Definition at line 106 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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
| [in] | alpha | The real value to scale with |
| [in,out] | y | The vector to be scaled |
| [in] | x | The vector to add |
|
virtual |
Copy a vector in another one.
| [in] | x | The vector to copy |
| [in,out] | r | The copied vector |
Implements Alien::ILinearAlgebra.
Definition at line 117 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebra< Tag, TagV >::copy | ( | const UniqueArray< Real > & | x, |
| UniqueArray< Real > & | r ) const |
Copy a vector in another one.
| [in] | x | The vector to copy |
| [in,out] | r | The copied vector |
| void Alien::LinearAlgebra< Tag, TagV >::diagonal | ( | const IMatrix & | a, |
| IVector & | x ) const |
Extract the diagonal of a matrix in a vector.
| [in] | a | The matrix to extract the diagonal |
| [in,out] | x | The 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.
|
virtual |
Compute the dot product of two vectors.
| [in] | x | The first vector |
| [in] | y | The second vector |
Implements Alien::ILinearAlgebra.
Definition at line 128 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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.
| [in] | local_size | The size of the vectors |
| [in] | x | The first vector |
| [in] | y | The second vector |
| void Alien::LinearAlgebra< Tag, TagV >::dump | ( | IMatrix const & | a, |
| std::string const & | filename ) const |
Dumps a matrix to a file.
| [in] | a | The matrix to dump |
| [in] | filename | The name of the file |
Definition at line 189 of file LinearAlgebraT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| void Alien::LinearAlgebra< Tag, TagV >::dump | ( | IVector const & | x, |
| std::string const & | filename ) const |
Dumps a vector to a file.
| [in] | x | The vector to dump |
| [in] | filename | The name of the file |
Definition at line 199 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
|
virtual |
Compute a matrix vector product.
Compute the matrix-vector product a by x and store it in r : r = a * x
| [in] | a | The matrix to be multiplied |
| [in] | x | The vector to be multipled |
| [in,out] | r | The 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.
| 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
| [in] | a | The matrix to be multiplied |
| [in] | x | The vector to be multipled |
| [in,out] | r | The resulting vector |
|
virtual |
Compute L0 norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Implements Alien::ILinearAlgebra.
Definition at line 39 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
|
virtual |
Compute L1 norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Implements Alien::ILinearAlgebra.
Definition at line 49 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
|
virtual |
Compute L2 norm of a vector.
| [in] | x | The vector on which norm2 is computed |
Implements Alien::ILinearAlgebra.
Definition at line 60 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebra< Tag, TagV >::normInf | ( | const IVector & | x | ) | const |
Compute LInf norm of a vector.
| [in] | x | The vector on which norm2 is computed |
Definition at line 71 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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.
| [in] | x | The first vector |
| [in] | y | The second vector |
| [in,out] | w | The resulting vector |
Definition at line 172 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebra< Tag, TagV >::reciprocal | ( | IVector & | x | ) | const |
Compute the reciprocal of a vector.
| [in,out] | x | The vector to be processed |
Definition at line 152 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebra< Tag, TagV >::scal | ( | Real | alpha, |
| IVector & | x ) const |
Scale a vector by a factor.
| [in] | alpha | The real value to scale with |
| [in,out] | x | The vector to be scaled |
Definition at line 162 of file LinearAlgebraT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebra< Tag, TagV >::scal | ( | Real | alpha, |
| UniqueArray< Real > & | x ) const |
Scale a vector by a factor.
| [in] | alpha | The real value to scale with |
| [in,out] | x | The vector to be scaled |
|
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().