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

Definition of various vector 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::VectorUnary< E, F >
 Expression-template node applying a unary functor F element-wise to a vector expression E. More...
 
struct  CDPL::Math::VectorUnaryTraits< E, F >
 Traits selecting the expression-template node and its result type for the Math::VectorUnary instantiation <E, F>. More...
 
class  CDPL::Math::VectorBinary1< E1, E2, F >
 Expression-template node combining two vector expressions E1 and E2 element-wise via the binary functor F. More...
 
struct  CDPL::Math::VectorBinary1Traits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::VectorBinary1 instantiation <E1, E2, F>. More...
 
class  CDPL::Math::VectorBinary2< E1, E2, F >
 Expression-template node combining two vector expressions E1 and E2 via a binary functor F invoked with both expressions plus the element index i. More...
 
struct  CDPL::Math::VectorBinary2Traits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::VectorBinary2 instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Scalar1VectorBinary< E1, E2, F >
 Expression-template node combining a scalar E1 (lhs) and a vector expression E2 (rhs) element-wise via the binary functor F. More...
 
struct  CDPL::Math::Scalar1VectorBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Scalar1VectorBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::Scalar2VectorBinary< E1, E2, F >
 Expression-template node combining a vector expression E1 (lhs) and a scalar E2 (rhs) element-wise via the binary functor F. More...
 
struct  CDPL::Math::Scalar2VectorBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::Scalar2VectorBinary instantiation <E1, E2, F>. More...
 
class  CDPL::Math::QuaternionVectorBinary< E1, E2, F >
 Expression-template node combining a quaternion expression E1 and a vector expression E2 into a vector expression via the per-element functor F (used e.g. for quaternion-vector rotation). More...
 
struct  CDPL::Math::QuaternionVectorBinaryTraits< E1, E2, F >
 Traits selecting the expression-template node and its result type for the Math::QuaternionVectorBinary instantiation <E1, E2, F>. More...
 

Namespaces

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

Functions

template<typename E >
VectorUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType CDPL::Math::operator- (const VectorExpression< E > &e)
 Returns the element-wise negation of the vector expression e. More...
 
template<typename E >
const E & CDPL::Math::operator+ (const VectorExpression< E > &e)
 Returns the vector expression e unchanged (unary +). More...
 
template<typename E1 , typename E2 >
VectorBinary1Traits< E1, E2, ScalarAddition< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::operator+ (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the element-wise sum of the vector expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
VectorBinary1Traits< E1, E2, ScalarSubtraction< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::operator- (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the element-wise difference of the vector expressions e1 and e2. More...
 
template<typename E , typename T >
std::enable_if< IsScalar< T >::value, typename Scalar2VectorBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type CDPL::Math::operator* (const VectorExpression< E > &e, const T &t)
 Returns the element-wise product of the vector expression e and the scalar t. More...
 
template<typename T , typename E >
std::enable_if< IsScalar< T >::value, typename Scalar1VectorBinaryTraits< T, E, ScalarMultiplication< T, typename E::ValueType > >::ResultType >::type CDPL::Math::operator* (const T &t, const VectorExpression< E > &e)
 Returns the element-wise product of the scalar t and the vector expression e. More...
 
template<typename E , typename T >
std::enable_if< IsScalar< T >::value, typename Scalar2VectorBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type CDPL::Math::operator/ (const VectorExpression< E > &e, const T &t)
 Returns the element-wise quotient of the vector expression e by the scalar t. More...
 
template<typename E1 , typename E2 >
VectorEquality< E1, E2 >::ResultType CDPL::Math::operator== (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Tells whether the vector expressions e1 and e2 are element-wise equal. More...
 
template<typename E1 , typename E2 >
VectorEquality< E1, E2 >::ResultType CDPL::Math::operator!= (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Tells whether the vector 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 VectorToleranceEquality< E1, E2, T >::ResultType >::type CDPL::Math::equals (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2, const T &eps)
 Tells whether the vector expressions e1 and e2 agree element-wise within the absolute tolerance eps. More...
 
template<typename E >
VectorUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType CDPL::Math::conj (const VectorExpression< E > &e)
 Returns the element-wise complex conjugate of the vector expression e (identity for real-valued vectors). More...
 
template<typename E >
VectorUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType CDPL::Math::herm (const VectorExpression< E > &e)
 Returns the Hermitian conjugate of the vector expression e (alias of conj() for vectors). More...
 
template<typename E >
VectorUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType CDPL::Math::real (const VectorExpression< E > &e)
 Returns the element-wise real part of the vector expression e. More...
 
template<typename E >
VectorUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType CDPL::Math::imag (const VectorExpression< E > &e)
 Returns the element-wise imaginary part of the vector expression e. More...
 
template<typename E1 , typename E2 >
VectorBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::elemDiv (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the element-wise quotient of the vector expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
VectorBinary1Traits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType CDPL::Math::elemProd (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the element-wise product (Hadamard product) of the vector expressions e1 and e2. More...
 
template<typename E1 , typename E2 >
VectorBinary2Traits< E1, E2, VectorCrossProduct< E1, E2 > >::ResultType CDPL::Math::crossProd (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the 3-vector cross product \( e_1 \times e_2 \) as an expression-template node. More...
 
template<typename E1 , typename E2 >
VectorInnerProduct< E1, E2 >::ResultType CDPL::Math::innerProd (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Returns the inner (dot) product of the vector expressions e1 and e2. More...
 
template<typename E1 , typename E2 , typename T >
VectorAngleCosine< E1, E2, T >::ResultType CDPL::Math::angleCos (const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2, const T &sd, bool clamp=true)
 Returns the cosine of the angle between the vector expressions e1 and e2 (optionally clamped to [-1, 1]). More...
 
template<typename E >
VectorElementSum< E >::ResultType CDPL::Math::sum (const VectorExpression< E > &e)
 Returns the sum of all elements of the vector expression e. More...
 
template<typename E >
VectorNorm1< E >::ResultType CDPL::Math::norm1 (const VectorExpression< E > &e)
 Returns the L1 norm of the vector expression e ( \( \sum_i |e(i)| \)). More...
 
template<typename E >
VectorNorm2< E >::ResultType CDPL::Math::norm2 (const VectorExpression< E > &e)
 Returns the L2 (Euclidean) norm of the vector expression e ( \( \sqrt{\sum_i |e(i)|^2} \)). More...
 
template<typename E >
VectorNormInfinity< E >::ResultType CDPL::Math::normInf (const VectorExpression< E > &e)
 Returns the L∞ norm of the vector expression e ( \( \max_i |e(i)| \)). More...
 
template<typename E >
VectorNormInfinityIndex< E >::ResultType CDPL::Math::normInfIndex (const VectorExpression< E > &e)
 Returns the (first) index at which the vector expression e attains its L∞ norm. More...
 
template<typename E >
VectorNorm2< E >::ResultType CDPL::Math::length (const VectorExpression< E > &e)
 Returns the length (L2 norm) of the vector expression e (alias of norm2()). More...
 
template<typename E >
const E & CDPL::Math::trans (const VectorExpression< E > &e)
 Returns the transpose of the vector expression e (the identity for vectors — provided for matrix-API symmetry). More...
 
template<typename E >
E & CDPL::Math::trans (VectorExpression< E > &e)
 Returns the transpose of the mutable vector expression e (the identity for vectors — provided for matrix-API symmetry). More...
 
template<typename E1 , typename E2 >
QuaternionVectorBinaryTraits< E1, E2, QuaternionVectorRotation< E1, E2 > >::ResultType CDPL::Math::rotate (const QuaternionExpression< E1 > &e1, const VectorExpression< E2 > &e2)
 Rotates the vector expression e2 by the quaternion expression e1. More...
 

Detailed Description

Definition of various vector expression types and operations.