Linear algebra interface. More...
#include <core/alien/core/backend/LinearAlgebraExpr.h>
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. | |
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 48 of file LinearAlgebraExpr.h.
|
private |
The type of the linear algebra.
Definition at line 281 of file LinearAlgebraExpr.h.
|
private |
Definition at line 282 of file LinearAlgebraExpr.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 60 of file LinearAlgebraExpr.h.
|
virtual |
Free resources.
Definition at line 32 of file LinearAlgebraExprT.h.
| void Alien::LinearAlgebraExpr< Tag, TagV >::add | ( | const IMatrix & | a, |
| IMatrix & | b ) const |
Add two matrices A and B.
| [in] | a | The matrix A |
| [in] | b | The matrix B |
| [in,out] | c | The resulting matrix |
Definition at line 145 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| 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
| [in] | alpha | The real value to scale with |
| [in] | x | The vector to be scaled |
| [in,out] | y | The resulting vector |
Definition at line 104 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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
| [in] | alpha | The real value to scale with |
| [in] | x | The vector to be scaled |
| [in,out] | y | The resulting vector |
Definition at line 233 of file LinearAlgebraExprT.h.
References m_algebra.
| 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
| [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 116 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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
| [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 242 of file LinearAlgebraExprT.h.
References m_algebra.
| void Alien::LinearAlgebraExpr< Tag, TagV >::copy | ( | const IMatrix & | x, |
| IMatrix & | r ) const |
Copy a matrix in another one.
| [in] | x | The matrix to copy |
| [in,out] | r | The copied matrix |
Definition at line 136 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< Tag, TagV >::copy | ( | const IVector & | x, |
| IVector & | r ) const |
Copy a vector in another one.
| [in] | x | The vector to copy |
| [in,out] | r | The copied vector |
Definition at line 127 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< 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::LinearAlgebraExpr< 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 167 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::MultiVectorImpl::get(), Alien::IMatrix::impl(), Alien::IVector::impl(), and m_algebra.
| Real Alien::LinearAlgebraExpr< Tag, TagV >::dot | ( | const IVector & | x, |
| const IVector & | y ) const |
Compute the dot product of two vectors.
| [in] | x | The first vector |
| [in] | y | The second vector |
Definition at line 156 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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.
| [in] | local_size | The size of the vectors |
| [in] | x | The first vector |
| [in] | y | The second vector |
Definition at line 261 of file LinearAlgebraExprT.h.
References m_algebra.
| void Alien::LinearAlgebraExpr< 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 280 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< 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 290 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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
| [in] | a | The matrix to be multiplied |
| [in] | x | The vector to be multipled |
| [in,out] | r | The 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.
| 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
| [in] | a | The matrix to be multiplied |
| [in] | x | The vector to be multipled |
| [in,out] | r | The resulting vector |
Definition at line 222 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm0 | ( | const IVector & | x | ) | const |
Compute L0 norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Definition at line 38 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm1 | ( | const IVector & | x | ) | const |
Compute L1 norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Definition at line 48 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm2 | ( | const IMatrix & | x | ) | const |
Compute L2 (Frobenous) norm of a matrix.
| [in] | x | The matrix on which norm2 is computed |
Definition at line 81 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::norm2 | ( | const IVector & | x | ) | const |
Compute L2 norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Definition at line 59 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| Arccore::Real Alien::LinearAlgebraExpr< Tag, TagV >::normInf | ( | const IVector & | x | ) | const |
Compute LInf norm of a vector.
| [in] | x | The vector on which norm0 is computed |
Definition at line 70 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| 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.
| [in] | x | The first vector |
| [in] | y | The second vector |
| [in,out] | w | The resulting vector |
Definition at line 207 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< Tag, TagV >::reciprocal | ( | IVector & | x | ) | const |
Compute the reciprocal of a vector.
| [in,out] | x | The vector to be processed |
Definition at line 180 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< Tag, TagV >::scal | ( | Real | alpha, |
| IMatrix & | a ) const |
Scale a matrix by a factor.
| [in] | alpha | The real value to scale with |
| [in,out] | x | The vector to be scaled |
Definition at line 197 of file LinearAlgebraExprT.h.
References Alien::MultiMatrixImpl::get(), Alien::IMatrix::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< 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 190 of file LinearAlgebraExprT.h.
References Alien::MultiVectorImpl::get(), Alien::IVector::impl(), and m_algebra.
| void Alien::LinearAlgebraExpr< 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 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().