|
Chemical Data Processing Library C++ API - Version 1.1.1
|
Go to the documentation of this file.
27 #ifndef CDPL_MATH_VECTOREXPRESSION_HPP
28 #define CDPL_MATH_VECTOREXPRESSION_HPP
30 #include <type_traits>
46 template <
typename E,
typename F>
51 typedef F FunctorType;
52 typedef E ExpressionType;
53 typedef typename E::ConstClosureType ExpressionClosureType;
69 return expr.getSize();
74 return FunctorType::apply(expr(i));
79 return FunctorType::apply(expr[i]);
83 ExpressionClosureType expr;
86 template <
typename E,
typename F>
94 template <
typename E1,
typename E2,
typename F>
99 typedef F FunctorType;
100 typedef E1 Expression1Type;
101 typedef E2 Expression2Type;
102 typedef typename E1::ConstClosureType Expression1ClosureType;
103 typedef typename E2::ConstClosureType Expression2ClosureType;
115 expr1(e1), expr2(e2) {}
124 return FunctorType::apply(expr1(i), expr2(i));
129 return FunctorType::apply(expr1[i], expr2[i]);
133 Expression1ClosureType expr1;
134 Expression2ClosureType expr2;
137 template <
typename E1,
typename E2,
typename F>
145 template <
typename E1,
typename E2,
typename F>
150 typedef F FunctorType;
151 typedef E1 Expression1Type;
152 typedef E2 Expression2Type;
153 typedef typename E1::ConstClosureType Expression1ClosureType;
154 typedef typename E2::ConstClosureType Expression2ClosureType;
166 expr1(e1), expr2(e2) {}
175 return FunctorType::apply(expr1, expr2, i);
180 return FunctorType::apply(expr1, expr2, i);
184 Expression1ClosureType expr1;
185 Expression2ClosureType expr2;
188 template <
typename E1,
typename E2,
typename F>
196 template <
typename E1,
typename E2,
typename F>
201 typedef F FunctorType;
202 typedef E1 Expression1Type;
203 typedef E2 Expression2Type;
204 typedef const E1 Expression1ClosureType;
205 typedef typename E2::ConstClosureType Expression2ClosureType;
217 expr1(e1), expr2(e2) {}
221 return expr2.getSize();
226 return FunctorType::apply(expr1, expr2(i));
231 return FunctorType::apply(expr1, expr2[i]);
235 Expression1ClosureType expr1;
236 Expression2ClosureType expr2;
239 template <
typename E1,
typename E2,
typename F>
247 template <
typename E1,
typename E2,
typename F>
252 typedef F FunctorType;
253 typedef E1 Expression1Type;
254 typedef E2 Expression2Type;
255 typedef typename E1::ConstClosureType Expression1ClosureType;
256 typedef const E2 Expression2ClosureType;
268 expr1(e1), expr2(e2) {}
272 return expr1.getSize();
277 return FunctorType::apply(expr1(i), expr2);
282 return FunctorType::apply(expr1[i], expr2);
286 Expression1ClosureType expr1;
287 Expression2ClosureType expr2;
290 template <
typename E1,
typename E2,
typename F>
298 template <
typename E1,
typename E2,
typename F>
303 typedef F FunctorType;
304 typedef E1 Expression1Type;
305 typedef E2 Expression2Type;
306 typedef typename E1::ConstClosureType Expression1ClosureType;
307 typedef typename E2::ConstClosureType Expression2ClosureType;
319 expr1(e1), expr2(e2) {}
323 return expr2.getSize();
328 return FunctorType::apply(expr1, expr2, i);
333 return FunctorType::apply(expr1, expr2, i);
337 Expression1ClosureType expr1;
338 Expression2ClosureType expr2;
341 template <
typename E1,
typename E2,
typename F>
349 template <
typename E>
355 return ExpressionType(e());
358 template <
typename E>
365 template <
typename E1,
typename E2>
366 typename VectorBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
372 return ExpressionType(e1(), e2());
375 template <
typename E1,
typename E2>
376 typename VectorBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
382 return ExpressionType(e1(), e2());
385 template <
typename E,
typename T>
386 typename std::enable_if<IsScalar<T>::value,
typename Scalar2VectorBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
392 return ExpressionType(e(), t);
395 template <
typename T,
typename E>
396 typename std::enable_if<IsScalar<T>::value,
typename Scalar1VectorBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
402 return ExpressionType(t, e());
405 template <
typename E,
typename T>
406 typename std::enable_if<IsScalar<T>::value,
typename Scalar2VectorBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
412 return ExpressionType(e(), t);
415 template <
typename E1,
typename E2>
422 template <
typename E1,
typename E2>
429 template <
typename E1,
typename E2,
typename T>
436 template <
typename E>
437 typename VectorUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
442 return ExpressionType(e());
445 template <
typename E>
446 typename VectorUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
451 return ExpressionType(e());
454 template <
typename E>
455 typename VectorUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
460 return ExpressionType(e());
463 template <
typename E>
464 typename VectorUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
469 return ExpressionType(e());
472 template <
typename E1,
typename E2>
473 typename VectorBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
479 return ExpressionType(e1(), e2());
482 template <
typename E1,
typename E2>
483 typename VectorBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
489 return ExpressionType(e1(), e2());
492 template <
typename E1,
typename E2>
493 typename VectorBinary2Traits<E1, E2, VectorCrossProduct<E1, E2> >::ResultType
499 return ExpressionType(e1(), e2());
502 template <
typename E1,
typename E2>
509 template <
typename E1,
typename E2,
typename T>
516 template <
typename E>
523 template <
typename E>
530 template <
typename E>
537 template <
typename E>
544 template <
typename E>
551 template <
typename E>
558 template <
typename E>
565 template <
typename E>
572 template <
typename E1,
typename E2>
573 typename QuaternionVectorBinaryTraits<E1, E2, QuaternionVectorRotation<E1, E2> >::ResultType
578 return ExpressionType(e1(), e2());
583 #endif // CDPL_MATH_VECTOREXPRESSION_HPP
CommonType< typename VectorInnerProduct< V1, V2 >::ResultType, T >::Type ResultType
Definition: Functional.hpp:296
const SelfType ConstClosureType
Definition: VectorExpression.hpp:59
Definition: VectorExpression.hpp:198
VectorScalarRealUnaryFunctor< V >::ResultType ResultType
Definition: Functional.hpp:474
E2::SizeType SizeType
Definition: VectorExpression.hpp:213
QuaternionVectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: VectorExpression.hpp:318
Definition: VectorExpression.hpp:292
ExpressionType ResultType
Definition: VectorExpression.hpp:295
GridEquality< E1, E2 >::ResultType operator!=(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:346
#define CDPL_MATH_CHECK_SIZE_EQUALITY(size1, size2, e)
Definition: Check.hpp:62
const unsigned int E
Specifies that the stereocenter has E configuration.
Definition: CIPDescriptor.hpp:96
Definition: VectorExpression.hpp:300
std::common_type< T1, T2 >::type Type
Definition: CommonType.hpp:43
const ValueType ConstReference
Definition: VectorExpression.hpp:260
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: VectorExpression.hpp:112
MatrixTranspose< E > trans(MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:941
F::ResultType ValueType
Definition: VectorExpression.hpp:56
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:127
static ResultType apply(const VectorExpression< V1 > &e1, const VectorExpression< V2 > &e2)
Definition: Functional.hpp:278
const ValueType Reference
Definition: VectorExpression.hpp:312
VectorScalarRealUnaryFunctor< V >::ResultType ResultType
Definition: Functional.hpp:453
E2::DifferenceType DifferenceType
Definition: VectorExpression.hpp:214
Definition: VectorExpression.hpp:139
static ResultType apply(const VectorExpression< V > &e)
Definition: Functional.hpp:476
QuaternionNorm2< E >::ResultType norm2(const QuaternionExpression< E > &e)
Definition: QuaternionExpression.hpp:804
ExpressionType ResultType
Definition: VectorExpression.hpp:142
QuaternionVectorBinary< E1, E2, F > ExpressionType
Definition: VectorExpression.hpp:345
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type operator*(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:309
SizeType getSize() const
Definition: VectorExpression.hpp:117
SelfType ClosureType
Definition: VectorExpression.hpp:161
VectorBinary1(const Expression1Type &e1, const Expression2Type &e2)
Definition: VectorExpression.hpp:114
VectorScalarUnaryFunctor< V >::ResultType ResultType
Definition: Functional.hpp:423
static ResultType apply(const VectorExpression< V > &e)
Definition: Functional.hpp:455
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:339
Definition: Expression.hpp:54
E1::DifferenceType DifferenceType
Definition: VectorExpression.hpp:265
Scalar3VectorBooleanTernaryFunctor< V1, V2, T >::ResultType ResultType
Definition: Functional.hpp:355
VectorInnerProduct< E1, E2 >::ResultType innerProd(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: VectorExpression.hpp:504
QuaternionVectorBinaryTraits< E1, E2, QuaternionVectorRotation< E1, E2 > >::ResultType rotate(const QuaternionExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: VectorExpression.hpp:574
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType herm(const GridExpression< E > &e)
Definition: GridExpression.hpp:369
const ValueType Reference
Definition: VectorExpression.hpp:159
const SelfType ConstClosureType
Definition: VectorExpression.hpp:109
E::SizeType SizeType
Definition: VectorExpression.hpp:61
GridUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType real(const GridExpression< E > &e)
Definition: GridExpression.hpp:378
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:72
Definition: VectorExpression.hpp:249
E2::SizeType SizeType
Definition: VectorExpression.hpp:315
Definition: VectorExpression.hpp:147
GridUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType operator-(const GridExpression< E > &e)
Definition: GridExpression.hpp:272
Definition: Functional.hpp:239
Definition: Functional.hpp:211
E2::DifferenceType DifferenceType
Definition: VectorExpression.hpp:316
VectorBinary2(const Expression1Type &e1, const Expression2Type &e2)
Definition: VectorExpression.hpp:165
Definition: VectorExpression.hpp:190
F::ResultType ValueType
Definition: VectorExpression.hpp:208
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:275
const ValueType Reference
Definition: VectorExpression.hpp:210
Definition: Expression.hpp:98
Definition: Functional.hpp:253
ExpressionType ResultType
Definition: VectorExpression.hpp:346
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: VectorExpression.hpp:162
static ResultType apply(const VectorExpression< V > &e)
Definition: Functional.hpp:534
static ResultType apply(const VectorExpression< V > &e)
Definition: Functional.hpp:425
Scalar1VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: VectorExpression.hpp:216
Definition: VectorExpression.hpp:343
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:326
GridBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType elemDiv(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:396
F::ResultType ValueType
Definition: VectorExpression.hpp:106
F::ResultType ValueType
Definition: VectorExpression.hpp:259
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:331
static ResultType apply(const VectorExpression< V > &e)
Definition: Functional.hpp:500
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
SizeType getSize() const
Definition: VectorExpression.hpp:270
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
VectorBinary2Traits< E1, E2, VectorCrossProduct< E1, E2 > >::ResultType crossProd(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: VectorExpression.hpp:494
VectorUnary< E, F > ExpressionType
Definition: VectorExpression.hpp:90
Scalar1VectorBinary< E1, E2, F > ExpressionType
Definition: VectorExpression.hpp:243
Definition of type traits.
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:173
Definition: Functional.hpp:225
Definition: VectorExpression.hpp:96
VectorScalarIndexUnaryFunctor< V >::ResultType ResultType
Definition: Functional.hpp:532
const E & operator+(const GridExpression< E > &e)
Definition: GridExpression.hpp:282
SelfType ClosureType
Definition: VectorExpression.hpp:212
const ValueType Reference
Definition: VectorExpression.hpp:58
VectorAngleCosine< E1, E2, T >::ResultType angleCos(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2, const T &sd, bool clamp=true)
Definition: VectorExpression.hpp:511
const ValueType ConstReference
Definition: VectorExpression.hpp:209
const ValueType ConstReference
Definition: VectorExpression.hpp:57
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: VectorExpression.hpp:111
static ResultType apply(const VectorExpression< V1 > &e1, const VectorExpression< V2 > &e2, const T &sd, bool clamp)
Definition: Functional.hpp:298
Definition of various functors.
const SelfType ConstClosureType
Definition: VectorExpression.hpp:211
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:122
SizeType getSize() const
Definition: VectorExpression.hpp:219
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType conj(const GridExpression< E > &e)
Definition: GridExpression.hpp:360
const SelfType ConstClosureType
Definition: VectorExpression.hpp:262
const unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
SizeType getSize() const
Definition: VectorExpression.hpp:168
SelfType ClosureType
Definition: VectorExpression.hpp:314
GridBinary1Traits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType elemProd(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:406
SizeType getSize() const
Definition: VectorExpression.hpp:321
ExpressionType ResultType
Definition: VectorExpression.hpp:193
Definition of exception classes.
SelfType ClosureType
Definition: VectorExpression.hpp:60
Scalar2VectorBinary< E1, E2, F > ExpressionType
Definition: VectorExpression.hpp:294
SizeType getSize() const
Definition: VectorExpression.hpp:67
E1::SizeType SizeType
Definition: VectorExpression.hpp:264
Scalar2VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: VectorExpression.hpp:267
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:77
The namespace of the Chemical Data Processing Library.
static ResultType apply(const VectorExpression< V1 > &e1, const VectorExpression< V2 > &e2)
Definition: Functional.hpp:326
VectorBinary2< E1, E2, F > ExpressionType
Definition: VectorExpression.hpp:192
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: VectorExpression.hpp:163
VectorUnary(const ExpressionType &e)
Definition: VectorExpression.hpp:64
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:917
E::DifferenceType DifferenceType
Definition: VectorExpression.hpp:62
const ValueType Reference
Definition: VectorExpression.hpp:261
const SelfType ConstClosureType
Definition: VectorExpression.hpp:160
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type operator/(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:329
SelfType ClosureType
Definition: VectorExpression.hpp:110
ExpressionType ResultType
Definition: VectorExpression.hpp:244
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:178
ExpressionType ResultType
Definition: VectorExpression.hpp:91
const ValueType ConstReference
Definition: VectorExpression.hpp:158
VectorBooleanBinaryFunctor< V1, V2 >::ResultType ResultType
Definition: Functional.hpp:324
VectorScalarRealUnaryFunctor< V >::ResultType ResultType
Definition: Functional.hpp:498
const ValueType Reference
Definition: VectorExpression.hpp:108
F::ResultType ValueType
Definition: VectorExpression.hpp:157
VectorScalarBinaryFunctor< V1, V2 >::ResultType ResultType
Definition: Functional.hpp:276
MatrixNorm1< E >::ResultType norm1(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:903
GridUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType imag(const GridExpression< E > &e)
Definition: GridExpression.hpp:387
const SelfType ConstClosureType
Definition: VectorExpression.hpp:313
VectorBinary1< E1, E2, F > ExpressionType
Definition: VectorExpression.hpp:141
std::enable_if< std::is_arithmetic< T >::value, typename GridToleranceEquality< E1, E2, T >::ResultType >::type equals(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2, const T &eps)
Definition: GridExpression.hpp:353
const ValueType ConstReference
Definition: VectorExpression.hpp:311
Definition: VectorExpression.hpp:241
Definition: VectorExpression.hpp:48
const ValueType ConstReference
Definition: VectorExpression.hpp:107
Definition of various preprocessor macros for error checking.
static ResultType apply(const VectorExpression< V1 > &e1, const VectorExpression< V2 > &e2, Argument3Type epsilon)
Definition: Functional.hpp:358
Definition of basic expression types.
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:280
ConstReference operator()(SizeType i) const
Definition: VectorExpression.hpp:224
const unsigned int F
Specifies Fluorine.
Definition: AtomType.hpp:107
Definition: Functional.hpp:384
Definition: VectorExpression.hpp:88
SelfType ClosureType
Definition: VectorExpression.hpp:263
VectorNormInfinityIndex< E >::ResultType normInfIndex(const VectorExpression< E > &e)
Definition: VectorExpression.hpp:546
F::ResultType ValueType
Definition: VectorExpression.hpp:310
ConstReference operator[](SizeType i) const
Definition: VectorExpression.hpp:229
VectorNorm2< E >::ResultType length(const VectorExpression< E > &e)
Definition: VectorExpression.hpp:553