Chemical Data Processing Library C++ API - Version 1.4.0
Classes | Namespaces | Functions
MatrixExpression.hpp File Reference

Definition of various matrix expression types and operations. More...

#include <type_traits>
#include "CDPL/Math/Check.hpp"
#include "CDPL/Math/Expression.hpp"
#include "CDPL/Math/CommonType.hpp"
#include "CDPL/Math/Functional.hpp"
#include "CDPL/Math/TypeTraits.hpp"
#include "CDPL/Base/Exceptions.hpp"

Go to the source code of this file.

Classes

class  CDPL::Math::MatrixUnary< E, F >
 Expression-template node applying a unary functor F element-wise to a matrix expression E. More...
 
struct  CDPL::Math::MatrixUnaryTraits< E, F >
 Traits selecting the expression-template node and its result type for the Math::MatrixUnary instantiation <E, F>. More...
 
class  CDPL::Math::VectorMatrixUnary< E, F >
 Expression-template node interpreting a vector expression E as a column matrix via the per-element functor F. More...
 
struct  CDPL::Math::VectorMatrixUnaryTraits< E, F >
 Traits selecting the expression-template node and its result type for the Math::VectorMatrixUnary instantiation <E, F>. More...
 
class  CDPL::Math::MatrixBinary1< E1, E2, F >
 Expression-template node combining two matrix expressions E1 and E2 element-wise via the binary functor F. More...
 
struct  CDPL::Math::MatrixBinary1Traits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::MatrixBinary1 instantiation <E1, E2, F>. More...
 
class  CDPL::Math::MatrixBinary2< E1, E2, F >
 Expression-template node combining two matrix expressions E1 and E2 via a binary functor F that is invoked with both expressions plus the (i, j) cell indices. More...
 
struct  CDPL::Math::MatrixBinary2Traits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::MatrixBinary2 instantiation <E1, E2, F>. More...
 
class  CDPL::Math::VectorMatrixBinary< E1, E2, F >
 Expression-template node interpreting a binary combination of two vector expressions as a matrix (e.g. outer product), via the per-cell functor F invoked with both expressions and the cell coordinates. More...
 
struct  CDPL::Math::VectorMatrixBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::VectorMatrixBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Matrix1VectorBinary< E1, E2, F >
 Expression-template node interpreting a binary combination of a matrix expression E1 and a vector expression E2 as a vector (e.g. matrix-vector product), via the per-element functor F invoked with both expressions and the index. More...
 
struct  CDPL::Math::Matrix1VectorBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Matrix1VectorBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Matrix2VectorBinary< E1, E2, F >
 Expression-template node interpreting a binary combination of a vector expression E1 and a matrix expression E2 as a vector (e.g. vector-matrix product), via the per-element functor F invoked with both expressions and the index. More...
 
struct  CDPL::Math::Matrix2VectorBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Matrix2VectorBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Scalar1MatrixBinary< E1, E2, F >
 Expression-template node combining a scalar E1 (lhs) and a matrix expression E2 (rhs) element-wise via the binary functor F. More...
 
struct  CDPL::Math::Scalar1MatrixBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Scalar1MatrixBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Scalar2MatrixBinary< E1, E2, F >
 Expression-template node combining a matrix expression E1 (lhs) and a scalar E2 (rhs) element-wise via the binary functor F. More...
 
struct  CDPL::Math::Scalar2MatrixBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Scalar2MatrixBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::MatrixTranspose< M >
 Mutable view adapter that exposes the transpose of a matrix M as a matrix expression ( \( (i, j) \to M(j, i) \)). More...
 
struct  CDPL::Math::VectorTemporaryTraits< MatrixTranspose< M > >
 Math::VectorTemporaryTraits specialization inheriting the temporary type of the wrapped matrix for a Math::MatrixTranspose view. More...
 
struct  CDPL::Math::VectorTemporaryTraits< const MatrixTranspose< M > >
 Math::VectorTemporaryTraits specialization inheriting the temporary type of the wrapped matrix for a const Math::MatrixTranspose view. More...
 
struct  CDPL::Math::MatrixTemporaryTraits< MatrixTranspose< M > >
 Math::MatrixTemporaryTraits specialization inheriting the temporary type of the wrapped matrix for a Math::MatrixTranspose view. More...
 
struct  CDPL::Math::MatrixTemporaryTraits< const MatrixTranspose< M > >
 Math::MatrixTemporaryTraits specialization inheriting the temporary type of the wrapped matrix for a const Math::MatrixTranspose view. More...
 

Namespaces

 CDPL
 The namespace of the Chemical Data Processing Library.
 
 CDPL::Math
 Contains classes and functions related to mathematics.
 

Functions

template<typename E >
MatrixUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType CDPL::Math::operator- (const MatrixExpression< E > &e)
 Returns the element-wise negation of the matrix expression e. More...
 
template<typename E >
const E & CDPL::Math::operator+ (const MatrixExpression< E > &e)
 Returns the matrix expression e unchanged (unary +). More...
 
template<typename E1 , typename E2 >
MatrixBinary1Traits< E1, E2, ScalarAddition< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::operator+ (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the element-wise sum of the matrix expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
MatrixBinary1Traits< E1, E2, ScalarSubtraction< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::operator- (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the element-wise difference of the matrix expressions e1 and e2. More...
 
template<typename E , typename T >
std::enable_if< IsScalar< T >::value, typename Scalar2MatrixBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type CDPL::Math::operator* (const MatrixExpression< E > &e, const T &t)
 Returns the element-wise product of the matrix expression e and the scalar t. More...
 
template<typename T , typename E >
std::enable_if< IsScalar< T >::value, typename Scalar1MatrixBinaryTraits< T, E, ScalarMultiplication< T, typename E::ValueType > >::ResultType >::type CDPL::Math::operator* (const T &t, const MatrixExpression< E > &e)
 Returns the element-wise product of the scalar t and the matrix expression e. More...
 
template<typename E , typename T >
std::enable_if< IsScalar< T >::value, typename Scalar2MatrixBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type CDPL::Math::operator/ (const MatrixExpression< E > &e, const T &t)
 Returns the element-wise quotient of the matrix expression e by the scalar t. More...
 
template<typename E1 , typename E2 >
MatrixEquality< E1, E2 >::ResultType CDPL::Math::operator== (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Tells whether the matrix expressions e1 and e2 are element-wise equal. More...
 
template<typename E1 , typename E2 >
MatrixEquality< E1, E2 >::ResultType CDPL::Math::operator!= (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Tells whether the matrix expressions e1 and e2 differ in at least one element. More...
 
template<typename E1 , typename E2 , typename T >
std::enable_if< std::is_arithmetic< T >::value, typename MatrixToleranceEquality< E1, E2, T >::ResultType >::type CDPL::Math::equals (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2, const T &eps)
 Tells whether the matrix expressions e1 and e2 agree element-wise within the absolute tolerance eps. More...
 
template<typename E >
MatrixUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType CDPL::Math::conj (const MatrixExpression< E > &e)
 Returns the element-wise complex conjugate of the matrix expression e (identity for real-valued matrices). More...
 
template<typename E >
MatrixUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType CDPL::Math::herm (const MatrixExpression< E > &e)
 Returns the Hermitian conjugate (conjugate transpose) of the matrix expression e — currently aliased to conj() pending transpose support. More...
 
template<typename E >
MatrixUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType CDPL::Math::real (const MatrixExpression< E > &e)
 Returns the element-wise real part of the matrix expression e. More...
 
template<typename E >
MatrixUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType CDPL::Math::imag (const MatrixExpression< E > &e)
 Returns the element-wise imaginary part of the matrix expression e. More...
 
template<typename E1 , typename E2 >
VectorMatrixBinaryTraits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::outerProd (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the outer product of the vector expressions e1 and e2 as a matrix expression \( e_1 \cdot e_2^T \). More...
 
template<typename E1 , typename E2 >
MatrixBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::elemDiv (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the element-wise quotient of the matrix expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
MatrixBinary1Traits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::elemProd (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the element-wise product (Hadamard product) of the matrix expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType CDPL::Math::operator* (const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the matrix-vector product \( e_1 \cdot e_2 \) as a vector expression. More...
 
template<typename E1 , typename E2 >
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType CDPL::Math::prod (const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the matrix-vector product \( e_1 \cdot e_2 \) as a vector expression (named-function form of operator*). More...
 
template<typename C , typename E1 , typename E2 >
C & CDPL::Math::prod (const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2, VectorContainer< C > &c)
 Computes the matrix-vector product \( e_1 \cdot e_2 \) and stores it in c. More...
 
template<typename E1 , typename E2 >
Matrix2VectorBinaryTraits< E1, E2, VectorMatrixProduct< E1, E2 > >::ResultType CDPL::Math::operator* (const VectorExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the vector-matrix product \( e_1 \cdot e_2 \) as a vector expression. More...
 
template<typename E1 , typename E2 >
Matrix2VectorBinaryTraits< E1, E2, VectorMatrixProduct< E1, E2 > >::ResultType CDPL::Math::prod (const VectorExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the vector-matrix product \( e_1 \cdot e_2 \) as a vector expression (named-function form of operator*). More...
 
template<typename C , typename E1 , typename E2 >
C & CDPL::Math::prod (const VectorExpression< E1 > &e1, const MatrixExpression< E2 > &e2, VectorContainer< C > &c)
 Computes the vector-matrix product \( e_1 \cdot e_2 \) and stores it in c. More...
 
template<typename E1 , typename E2 >
MatrixBinary2Traits< E1, E2, MatrixProduct< E1, E2 > >::ResultType CDPL::Math::operator* (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the matrix-matrix product \( e_1 \cdot e_2 \) as a matrix expression. More...
 
template<typename E1 , typename E2 >
MatrixBinary2Traits< E1, E2, MatrixProduct< E1, E2 > >::ResultType CDPL::Math::prod (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2)
 Returns the matrix-matrix product \( e_1 \cdot e_2 \) as a matrix expression (named-function form of operator*). More...
 
template<typename C , typename E1 , typename E2 >
C & CDPL::Math::prod (const MatrixExpression< E1 > &e1, const MatrixExpression< E2 > &e2, MatrixContainer< C > &c)
 Computes the matrix-matrix product \( e_1 \cdot e_2 \) and stores it in c. More...
 
template<typename E >
MatrixTrace< E >::ResultType CDPL::Math::trace (const MatrixExpression< E > &e)
 Returns the trace (sum of diagonal elements) of the matrix expression e. More...
 
template<typename E >
MatrixNorm1< E >::ResultType CDPL::Math::norm1 (const MatrixExpression< E > &e)
 Returns the L1 (maximum absolute column sum) norm of the matrix expression e. More...
 
template<typename E >
MatrixNormFrobenius< E >::ResultType CDPL::Math::normFrob (const MatrixExpression< E > &e)
 Returns the Frobenius norm of the matrix expression e ( \( \sqrt{\sum_{i, j} |e(i, j)|^2} \)). More...
 
template<typename E >
MatrixNormInfinity< E >::ResultType CDPL::Math::normInf (const MatrixExpression< E > &e)
 Returns the L∞ (maximum absolute row sum) norm of the matrix expression e. More...
 
template<typename E >
VectorMatrixUnaryTraits< E, DiagonalMatrixFromVector< E > >::ResultType CDPL::Math::diag (const VectorExpression< E > &e)
 Returns a diagonal matrix whose diagonal entries are the components of the vector expression e. More...
 
template<typename E >
VectorMatrixUnaryTraits< E, CrossProductMatrixFromVector< E > >::ResultType CDPL::Math::cross (const VectorExpression< E > &e)
 Returns the cross-product (skew-symmetric) matrix corresponding to the 3-vector expression e (such that cross(e) * v == crossProd(e, v)). More...
 
template<typename E >
MatrixTranspose< E > CDPL::Math::trans (MatrixExpression< E > &e)
 Returns a mutable Math::MatrixTranspose view of the matrix expression e. More...
 
template<typename E >
MatrixTranspose< const E > CDPL::Math::trans (const MatrixExpression< E > &e)
 Returns a constant Math::MatrixTranspose view of the matrix expression e. More...
 
template<typename E >
MatrixElementSum< E >::ResultType CDPL::Math::sum (const MatrixExpression< E > &e)
 Returns the sum of all elements of the matrix expression e. More...
 

Detailed Description

Definition of various matrix expression types and operations.