Chemical Data Processing Library C++ API - Version 1.4.0
QuaternionExpression.hpp
Go to the documentation of this file.
1 /*
2  * QuaternionExpression.hpp
3  *
4  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef CDPL_MATH_QUATERNIONEXPRESSION_HPP
28 #define CDPL_MATH_QUATERNIONEXPRESSION_HPP
29 
30 #include <type_traits>
31 
32 #include "CDPL/Math/Expression.hpp"
33 #include "CDPL/Math/CommonType.hpp"
34 #include "CDPL/Math/Functional.hpp"
35 #include "CDPL/Math/TypeTraits.hpp"
36 
37 
38 namespace CDPL
39 {
40 
41  namespace Math
42  {
43 
49  template <typename E, typename F>
50  class QuaternionUnary1 : public QuaternionExpression<QuaternionUnary1<E, F> >
51  {
52 
54  typedef F FunctorType;
55  typedef E ExpressionType;
56  typedef typename E::ConstClosureType ExpressionClosureType;
57 
58  public:
60  typedef typename F::ResultType ValueType;
62  typedef const ValueType ConstReference;
64  typedef const ValueType Reference;
66  typedef const SelfType ConstClosureType;
69 
75  expr(e) {}
76 
82  {
83  return FunctorType::apply(expr.getC1());
84  }
85 
91  {
92  return FunctorType::apply(expr.getC2());
93  }
94 
100  {
101  return FunctorType::apply(expr.getC3());
102  }
103 
109  {
110  return FunctorType::apply(expr.getC4());
111  }
112 
113  private:
114  ExpressionClosureType expr;
115  };
116 
122  template <typename E, typename F>
124  {
125 
130  };
131 
139  template <typename E, typename F>
140  class QuaternionUnary2 : public QuaternionExpression<QuaternionUnary2<E, F> >
141  {
142 
144  typedef F FunctorType;
145  typedef E ExpressionType;
146  typedef typename E::ConstClosureType ExpressionClosureType;
147 
148  public:
150  typedef typename F::ResultType ValueType;
152  typedef const ValueType ConstReference;
154  typedef const ValueType Reference;
156  typedef const SelfType ConstClosureType;
159 
165  expr(e) {}
166 
172  {
173  return FunctorType::applyC1(expr);
174  }
175 
181  {
182  return FunctorType::applyC2(expr);
183  }
184 
190  {
191  return FunctorType::applyC3(expr);
192  }
193 
199  {
200  return FunctorType::applyC4(expr);
201  }
202 
203  private:
204  ExpressionClosureType expr;
205  };
206 
212  template <typename E, typename F>
214  {
215 
220  };
221 
228  template <typename E1, typename E2, typename F>
229  class QuaternionBinary1 : public QuaternionExpression<QuaternionBinary1<E1, E2, F> >
230  {
231 
233  typedef F FunctorType;
234  typedef E1 Expression1Type;
235  typedef E2 Expression2Type;
236  typedef typename E1::ConstClosureType Expression1ClosureType;
237  typedef typename E2::ConstClosureType Expression2ClosureType;
238 
239  public:
241  typedef typename F::ResultType ValueType;
243  typedef const ValueType ConstReference;
245  typedef const ValueType Reference;
247  typedef const SelfType ConstClosureType;
250 
256  QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
257  expr1(e1), expr2(e2) {}
258 
264  {
265  return FunctorType::apply(expr1.getC1(), expr2.getC1());
266  }
267 
273  {
274  return FunctorType::apply(expr1.getC2(), expr2.getC2());
275  }
276 
282  {
283  return FunctorType::apply(expr1.getC3(), expr2.getC3());
284  }
285 
291  {
292  return FunctorType::apply(expr1.getC4(), expr2.getC4());
293  }
294 
295  private:
296  Expression1ClosureType expr1;
297  Expression2ClosureType expr2;
298  };
299 
306  template <typename E1, typename E2, typename F>
308  {
309 
314  };
315 
323  template <typename E1, typename E2, typename F>
324  class QuaternionBinary2 : public QuaternionExpression<QuaternionBinary2<E1, E2, F> >
325  {
326 
328  typedef F FunctorType;
329  typedef E1 Expression1Type;
330  typedef E2 Expression2Type;
331  typedef typename E1::ConstClosureType Expression1ClosureType;
332  typedef typename E2::ConstClosureType Expression2ClosureType;
333 
334  public:
336  typedef typename F::ResultType ValueType;
338  typedef const ValueType ConstReference;
340  typedef const ValueType Reference;
342  typedef const SelfType ConstClosureType;
345 
351  QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
352  expr1(e1), expr2(e2) {}
353 
359  {
360  return FunctorType::applyC1(expr1, expr2);
361  }
362 
368  {
369  return FunctorType::applyC2(expr1, expr2);
370  }
371 
377  {
378  return FunctorType::applyC3(expr1, expr2);
379  }
380 
386  {
387  return FunctorType::applyC4(expr1, expr2);
388  }
389 
390  private:
391  Expression1ClosureType expr1;
392  Expression2ClosureType expr2;
393  };
394 
401  template <typename E1, typename E2, typename F>
403  {
404 
409  };
410 
417  template <typename E1, typename E2, typename F>
418  class Scalar1QuaternionBinary1 : public QuaternionExpression<Scalar1QuaternionBinary1<E1, E2, F> >
419  {
420 
422  typedef F FunctorType;
423  typedef E1 Expression1Type;
424  typedef E2 Expression2Type;
425  typedef const E1 Expression1ClosureType;
426  typedef typename E2::ConstClosureType Expression2ClosureType;
427 
428  public:
430  typedef typename F::ResultType ValueType;
432  typedef const ValueType ConstReference;
434  typedef const ValueType Reference;
436  typedef const SelfType ConstClosureType;
439 
445  Scalar1QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
446  expr1(e1), expr2(e2) {}
447 
453  {
454  return FunctorType::apply(expr1, expr2.getC1());
455  }
456 
462  {
463  return FunctorType::apply(expr1, expr2.getC2());
464  }
465 
471  {
472  return FunctorType::apply(expr1, expr2.getC3());
473  }
474 
480  {
481  return FunctorType::apply(expr1, expr2.getC4());
482  }
483 
484  private:
485  Expression1ClosureType expr1;
486  Expression2ClosureType expr2;
487  };
488 
495  template <typename E1, typename E2, typename F>
497  {
498 
503  };
504 
512  template <typename E1, typename E2, typename F>
513  class Scalar1QuaternionBinary2 : public QuaternionExpression<Scalar1QuaternionBinary2<E1, E2, F> >
514  {
515 
517  typedef F FunctorType;
518  typedef E1 Expression1Type;
519  typedef E2 Expression2Type;
520  typedef const E1 Expression1ClosureType;
521  typedef typename E2::ConstClosureType Expression2ClosureType;
522 
523  public:
525  typedef typename F::ResultType ValueType;
527  typedef const ValueType ConstReference;
529  typedef const ValueType Reference;
531  typedef const SelfType ConstClosureType;
534 
540  Scalar1QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
541  expr1(e1), expr2(e2) {}
542 
548  {
549  return FunctorType::applyC1(expr1, expr2);
550  }
551 
557  {
558  return FunctorType::applyC2(expr1, expr2);
559  }
560 
566  {
567  return FunctorType::applyC3(expr1, expr2);
568  }
569 
575  {
576  return FunctorType::applyC4(expr1, expr2);
577  }
578 
579  private:
580  Expression1ClosureType expr1;
581  Expression2ClosureType expr2;
582  };
583 
590  template <typename E1, typename E2, typename F>
592  {
593 
598  };
599 
606  template <typename E1, typename E2, typename F>
607  class Scalar2QuaternionBinary1 : public QuaternionExpression<Scalar2QuaternionBinary1<E1, E2, F> >
608  {
609 
611  typedef F FunctorType;
612  typedef E1 Expression1Type;
613  typedef E2 Expression2Type;
614  typedef typename E1::ConstClosureType Expression1ClosureType;
615  typedef const E2 Expression2ClosureType;
616 
617  public:
619  typedef typename F::ResultType ValueType;
621  typedef const ValueType ConstReference;
623  typedef const ValueType Reference;
625  typedef const SelfType ConstClosureType;
628 
634  Scalar2QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
635  expr1(e1), expr2(e2) {}
636 
642  {
643  return FunctorType::apply(expr1.getC1(), expr2);
644  }
645 
651  {
652  return FunctorType::apply(expr1.getC2(), expr2);
653  }
654 
660  {
661  return FunctorType::apply(expr1.getC3(), expr2);
662  }
663 
669  {
670  return FunctorType::apply(expr1.getC4(), expr2);
671  }
672 
673  private:
674  Expression1ClosureType expr1;
675  Expression2ClosureType expr2;
676  };
677 
684  template <typename E1, typename E2, typename F>
686  {
687 
692  };
693 
701  template <typename E1, typename E2, typename F>
702  class Scalar2QuaternionBinary2 : public QuaternionExpression<Scalar2QuaternionBinary2<E1, E2, F> >
703  {
704 
706  typedef F FunctorType;
707  typedef E1 Expression1Type;
708  typedef E2 Expression2Type;
709  typedef typename E1::ConstClosureType Expression1ClosureType;
710  typedef const E2 Expression2ClosureType;
711 
712  public:
714  typedef typename F::ResultType ValueType;
716  typedef const ValueType ConstReference;
718  typedef const ValueType Reference;
720  typedef const SelfType ConstClosureType;
723 
729  Scalar2QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
730  expr1(e1), expr2(e2) {}
731 
737  {
738  return FunctorType::applyC1(expr1, expr2);
739  }
740 
746  {
747  return FunctorType::applyC2(expr1, expr2);
748  }
749 
755  {
756  return FunctorType::applyC3(expr1, expr2);
757  }
758 
764  {
765  return FunctorType::applyC4(expr1, expr2);
766  }
767 
768  private:
769  Expression1ClosureType expr1;
770  Expression2ClosureType expr2;
771  };
772 
779  template <typename E1, typename E2, typename F>
781  {
782 
787  };
788 
797  template <typename E1, typename E2, typename E3, typename F>
798  class Scalar3QuaternionTernary : public QuaternionExpression<Scalar3QuaternionTernary<E1, E2, E3, F> >
799  {
800 
802  typedef F FunctorType;
803  typedef E1 Expression1Type;
804  typedef E2 Expression2Type;
805  typedef E3 Expression3Type;
806  typedef typename E1::ConstClosureType Expression1ClosureType;
807  typedef typename E2::ConstClosureType Expression2ClosureType;
808  typedef const E3 Expression3ClosureType;
809 
810  public:
812  typedef typename F::ResultType ValueType;
814  typedef const ValueType ConstReference;
816  typedef const ValueType Reference;
818  typedef const SelfType ConstClosureType;
821 
828  Scalar3QuaternionTernary(const Expression1Type& e1, const Expression2Type& e2, const Expression3Type& e3):
829  expr1(e1), expr2(e2), expr3(e3) {}
830 
836  {
837  return FunctorType::applyC1(expr1, expr2, expr3);
838  }
839 
845  {
846  return FunctorType::applyC2(expr1, expr2, expr3);
847  }
848 
854  {
855  return FunctorType::applyC3(expr1, expr2, expr3);
856  }
857 
863  {
864  return FunctorType::applyC4(expr1, expr2, expr3);
865  }
866 
867  private:
868  Expression1ClosureType expr1;
869  Expression2ClosureType expr2;
870  Expression3ClosureType expr3;
871  };
872 
880  template <typename E1, typename E2, typename E3, typename F>
882  {
883 
888  };
889 
898  template <typename E1, typename E2, typename E3, typename F>
899  class Scalar13QuaternionTernary : public QuaternionExpression<Scalar13QuaternionTernary<E1, E2, E3, F> >
900  {
901 
903  typedef F FunctorType;
904  typedef E1 Expression1Type;
905  typedef E2 Expression2Type;
906  typedef E3 Expression3Type;
907  typedef const E1 Expression1ClosureType;
908  typedef typename E2::ConstClosureType Expression2ClosureType;
909  typedef const E3 Expression3ClosureType;
910 
911  public:
913  typedef typename F::ResultType ValueType;
915  typedef const ValueType ConstReference;
917  typedef const ValueType Reference;
919  typedef const SelfType ConstClosureType;
922 
929  Scalar13QuaternionTernary(const Expression1Type& e1, const Expression2Type& e2, const Expression3Type& e3):
930  expr1(e1), expr2(e2), expr3(e3) {}
931 
937  {
938  return FunctorType::applyC1(expr1, expr2, expr3);
939  }
940 
946  {
947  return FunctorType::applyC2(expr1, expr2, expr3);
948  }
949 
955  {
956  return FunctorType::applyC3(expr1, expr2, expr3);
957  }
958 
964  {
965  return FunctorType::applyC4(expr1, expr2, expr3);
966  }
967 
968  private:
969  Expression1ClosureType expr1;
970  Expression2ClosureType expr2;
971  Expression3ClosureType expr3;
972  };
973 
981  template <typename E1, typename E2, typename E3, typename F>
983  {
984 
989  };
990 
997  template <typename E>
1000  {
1001  typedef typename QuaternionUnary1Traits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
1002 
1003  return ExpressionType(e());
1004  }
1005 
1012  template <typename E>
1013  const E&
1015  {
1016  return e();
1017  }
1018 
1027  template <typename E1, typename E2>
1028  typename QuaternionBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
1030  {
1031  typedef typename QuaternionBinary1Traits<E1, E2,
1032  ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1033 
1034  return ExpressionType(e1(), e2());
1035  }
1036 
1045  template <typename E, typename T>
1046  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionAddition<E, T> >::ResultType>::type
1048  {
1049  typedef typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionAddition<E, T> >::ExpressionType ExpressionType;
1050 
1051  return ExpressionType(e(), t);
1052  }
1053 
1062  template <typename T, typename E>
1063  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionAddition<T, E> >::ResultType>::type
1065  {
1066  typedef typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionAddition<T, E> >::ExpressionType ExpressionType;
1067 
1068  return ExpressionType(t, e());
1069  }
1070 
1079  template <typename E1, typename E2>
1080  typename QuaternionBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
1082  {
1083  typedef typename QuaternionBinary1Traits<E1, E2,
1085 
1086  return ExpressionType(e1(), e2());
1087  }
1088 
1097  template <typename E, typename T>
1098  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionSubtraction<E, T> >::ResultType>::type
1100  {
1101  typedef typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionSubtraction<E, T> >::ExpressionType ExpressionType;
1102 
1103  return ExpressionType(e(), t);
1104  }
1105 
1114  template <typename T, typename E>
1115  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionSubtraction<T, E> >::ResultType>::type
1117  {
1118  typedef typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionSubtraction<T, E> >::ExpressionType ExpressionType;
1119 
1120  return ExpressionType(t, e());
1121  }
1122 
1131  template <typename E1, typename E2>
1132  typename QuaternionBinary2Traits<E1, E2, QuaternionProduct<E1, E2> >::ResultType
1134  {
1135  typedef typename QuaternionBinary2Traits<E1, E2, QuaternionProduct<E1, E2> >::ExpressionType ExpressionType;
1136 
1137  return ExpressionType(e1(), e2());
1138  }
1139 
1148  template <typename E, typename T>
1149  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary1Traits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
1151  {
1152  typedef typename Scalar2QuaternionBinary1Traits<E, T,
1153  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
1154 
1155  return ExpressionType(e(), t);
1156  }
1157 
1166  template <typename T, typename E>
1167  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary1Traits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
1169  {
1170  typedef typename Scalar1QuaternionBinary1Traits<T, E,
1171  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
1172 
1173  return ExpressionType(t, e());
1174  }
1175 
1184  template <typename E1, typename E2>
1188  {
1191 
1192  return ExpressionType(e1(), e2(), norm2(e2));
1193  }
1194 
1203  template <typename E, typename T>
1204  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary1Traits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
1206  {
1207  typedef typename Scalar2QuaternionBinary1Traits<E, T,
1208  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
1209 
1210  return ExpressionType(e(), t);
1211  }
1212 
1221  template <typename T, typename E>
1222  typename std::enable_if<IsScalar<T>::value,
1226  {
1229 
1230  return ExpressionType(t, e(), norm2(e));
1231  }
1232 
1241  template <typename E1, typename E2>
1244  {
1245  return QuaternionEquality<E1, E2>::apply(e1, e2);
1246  }
1247 
1256  template <typename E1, typename E2>
1259  {
1260  return !QuaternionEquality<E1, E2>::apply(e1, e2);
1261  }
1262 
1273  template <typename E1, typename E2, typename T>
1274  typename std::enable_if<std::is_arithmetic<T>::value, typename QuaternionToleranceEquality<E1, E2, T>::ResultType>::type
1275  equals(const QuaternionExpression<E1>& e1, const QuaternionExpression<E2>& e2, const T& eps)
1276  {
1278  }
1279 
1288  template <typename E1, typename E2>
1289  typename QuaternionBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
1291  {
1292  typedef typename QuaternionBinary1Traits<E1, E2,
1293  ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1294 
1295  return ExpressionType(e1(), e2());
1296  }
1297 
1306  template <typename E1, typename E2>
1307  typename QuaternionBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1309  {
1310  typedef typename QuaternionBinary1Traits<E1, E2,
1312 
1313  return ExpressionType(e1(), e2());
1314  }
1315 
1322  template <typename E>
1323  typename E::ValueType
1325  {
1326  return e().getC1();
1327  }
1328 
1335  template <typename E>
1336  typename QuaternionUnary2Traits<E, QuaternionUnreal<E> >::ResultType
1338  {
1339  typedef typename QuaternionUnary2Traits<E, QuaternionUnreal<E> >::ExpressionType ExpressionType;
1340 
1341  return ExpressionType(e());
1342  }
1343 
1350  template <typename E>
1351  typename QuaternionUnary2Traits<E, QuaternionConjugate<E> >::ResultType
1353  {
1354  typedef typename QuaternionUnary2Traits<E, QuaternionConjugate<E> >::ExpressionType ExpressionType;
1355 
1356  return ExpressionType(e());
1357  }
1358 
1365  template <typename E>
1369  {
1371  QuaternionInverse<E, typename QuaternionNorm2<E>::ResultType> >::ExpressionType ExpressionType;
1372 
1373  return ExpressionType(e(), norm2(e));
1374  }
1375 
1382  template <typename E>
1385  {
1386  return QuaternionNorm<E>::apply(e);
1387  }
1388 
1395  template <typename E>
1398  {
1399  return QuaternionNorm2<E>::apply(e);
1400  }
1401 
1408  template <typename E>
1411  {
1413  }
1414  } // namespace Math
1415 } // namespace CDPL
1416 
1417 #endif // CDPL_MATH_QUATERNIONEXPRESSION_HPP
Common type deduction.
Definition of basic expression types.
Definition of various functors.
Definition of type traits.
E ExpressionType
The derived expression type (made available to expression-template machinery).
Definition: Expression.hpp:47
Expression-template node combining two quaternion expressions E1 and E2 component-wise via the binary...
Definition: QuaternionExpression.hpp:230
ConstReference getC1() const
Returns the result of applying the binary functor to the C1 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:263
ConstReference getC4() const
Returns the result of applying the binary functor to the C4 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:290
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:245
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:243
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:247
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:241
QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node wrapping e1 and e2.
Definition: QuaternionExpression.hpp:256
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:249
ConstReference getC3() const
Returns the result of applying the binary functor to the C3 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:281
ConstReference getC2() const
Returns the result of applying the binary functor to the C2 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:272
Expression-template node combining two quaternion expressions E1 and E2 via the per-component functor...
Definition: QuaternionExpression.hpp:325
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:340
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:342
QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node wrapping e1 and e2.
Definition: QuaternionExpression.hpp:351
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:385
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:344
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:338
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:358
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:376
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:367
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:336
CRTP base class for all quaternion expression types.
Definition: Expression.hpp:142
Expression-template node applying a unary functor F that returns a quaternion result to a quaternion ...
Definition: QuaternionExpression.hpp:51
ConstReference getC4() const
Returns the result of applying the unary functor to component C4 of the wrapped expression.
Definition: QuaternionExpression.hpp:108
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:60
ConstReference getC1() const
Returns the result of applying the unary functor to component C1 of the wrapped expression.
Definition: QuaternionExpression.hpp:81
ConstReference getC3() const
Returns the result of applying the unary functor to component C3 of the wrapped expression.
Definition: QuaternionExpression.hpp:99
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:62
ConstReference getC2() const
Returns the result of applying the unary functor to component C2 of the wrapped expression.
Definition: QuaternionExpression.hpp:90
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:64
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:68
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:66
QuaternionUnary1(const ExpressionType &e)
Constructs the expression-template node wrapping e.
Definition: QuaternionExpression.hpp:74
Expression-template node applying a per-component functor F to a quaternion expression E,...
Definition: QuaternionExpression.hpp:141
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:150
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the wrapped expression.
Definition: QuaternionExpression.hpp:171
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:158
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the wrapped expression.
Definition: QuaternionExpression.hpp:198
QuaternionUnary2(const ExpressionType &e)
Constructs the expression-template node wrapping e.
Definition: QuaternionExpression.hpp:164
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:152
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:156
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:154
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the wrapped expression.
Definition: QuaternionExpression.hpp:189
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the wrapped expression.
Definition: QuaternionExpression.hpp:180
Expression-template node combining a scalar E1 (lhs), a quaternion expression E2 (middle),...
Definition: QuaternionExpression.hpp:900
Scalar13QuaternionTernary(const Expression1Type &e1, const Expression2Type &e2, const Expression3Type &e3)
Constructs the expression-template node combining the two scalars and the wrapped quaternion expressi...
Definition: QuaternionExpression.hpp:929
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:954
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:963
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:936
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:921
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:917
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:913
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:915
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:919
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:945
Expression-template node combining a scalar E1 (lhs) and a quaternion expression E2 (rhs) component-w...
Definition: QuaternionExpression.hpp:419
ConstReference getC4() const
Returns the result of applying the binary functor to the scalar and the C4 component of the wrapped e...
Definition: QuaternionExpression.hpp:479
Scalar1QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the scalar e1 and the quaternion expression e2.
Definition: QuaternionExpression.hpp:445
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:432
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:434
ConstReference getC2() const
Returns the result of applying the binary functor to the scalar and the C2 component of the wrapped e...
Definition: QuaternionExpression.hpp:461
ConstReference getC3() const
Returns the result of applying the binary functor to the scalar and the C3 component of the wrapped e...
Definition: QuaternionExpression.hpp:470
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:436
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:438
ConstReference getC1() const
Returns the result of applying the binary functor to the scalar and the C1 component of the wrapped e...
Definition: QuaternionExpression.hpp:452
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:430
Expression-template node combining a scalar E1 (lhs) and a quaternion expression E2 (rhs) via the per...
Definition: QuaternionExpression.hpp:514
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:565
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:527
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:525
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:533
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:556
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:574
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:529
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:531
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:547
Scalar1QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the scalar e1 and the quaternion expression e2.
Definition: QuaternionExpression.hpp:540
Expression-template node combining a quaternion expression E1 (lhs) and a scalar E2 (rhs) component-w...
Definition: QuaternionExpression.hpp:608
ConstReference getC4() const
Returns the result of applying the binary functor to the C4 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:668
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:623
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:619
ConstReference getC3() const
Returns the result of applying the binary functor to the C3 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:659
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:621
Scalar2QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the quaternion expression e1 and the scalar e2.
Definition: QuaternionExpression.hpp:634
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:627
ConstReference getC2() const
Returns the result of applying the binary functor to the C2 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:650
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:625
ConstReference getC1() const
Returns the result of applying the binary functor to the C1 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:641
Expression-template node combining a quaternion expression E1 (lhs) and a scalar E2 (rhs) via the per...
Definition: QuaternionExpression.hpp:703
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:745
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:722
Scalar2QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the quaternion expression e1 and the scalar e2.
Definition: QuaternionExpression.hpp:729
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:718
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:754
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:763
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:716
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:714
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:720
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:736
Expression-template node combining two quaternion expressions E1 (lhs) and E2 (middle) with a scalar ...
Definition: QuaternionExpression.hpp:799
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:862
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:835
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:853
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:812
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:818
Scalar3QuaternionTernary(const Expression1Type &e1, const Expression2Type &e2, const Expression3Type &e3)
Constructs the expression-template node combining the two quaternion expressions and the scalar.
Definition: QuaternionExpression.hpp:828
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:820
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:844
const ValueType ConstReference
Constant reference type to a component value.
Definition: QuaternionExpression.hpp:814
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: QuaternionExpression.hpp:816
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int F
Specifies Fluorine.
Definition: AtomType.hpp:107
constexpr unsigned int E
Specifies that the stereocenter has E configuration.
Definition: CIPDescriptor.hpp:96
GridBinary1Traits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType elemProd(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Returns the element-wise product of the grid expressions e1 and e2 (Hadamard product).
Definition: GridExpression.hpp:704
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType conj(const GridExpression< E > &e)
Returns the element-wise complex conjugate of the grid expression e (identity for real-valued grids).
Definition: GridExpression.hpp:624
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)
Tells whether the grid expressions e1 and e2 agree element-wise within the absolute tolerance eps.
Definition: GridExpression.hpp:611
QuaternionUnary2Traits< E, QuaternionUnreal< E > >::ResultType unreal(const QuaternionExpression< E > &e)
Returns the unreal (pure-quaternion) part of the quaternion expression e (with C1 zeroed out).
Definition: QuaternionExpression.hpp:1337
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)
Returns the element-wise quotient of the grid expression e by the scalar t.
Definition: GridExpression.hpp:561
GridUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType real(const GridExpression< E > &e)
Returns the element-wise real part of the grid expression e.
Definition: GridExpression.hpp:654
QuaternionNorm2< E >::ResultType norm2(const QuaternionExpression< E > &e)
Returns the squared norm of the quaternion expression e.
Definition: QuaternionExpression.hpp:1397
GridEquality< E1, E2 >::ResultType operator!=(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Tells whether the grid expressions e1 and e2 differ in at least one element.
Definition: GridExpression.hpp:594
QuaternionNorm< E >::ResultType norm(const QuaternionExpression< E > &e)
Returns the norm (Euclidean length) of the quaternion expression e.
Definition: QuaternionExpression.hpp:1384
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Tells whether the grid expressions e1 and e2 are element-wise equal.
Definition: GridExpression.hpp:579
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)
Returns the element-wise product of the grid expression e and the scalar t.
Definition: GridExpression.hpp:525
GridBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType elemDiv(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Returns the element-wise quotient of the grid expressions e1 and e2.
Definition: GridExpression.hpp:686
GridUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType operator-(const GridExpression< E > &e)
Returns the element-wise negation of the grid expression e.
Definition: GridExpression.hpp:458
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Returns the sum of all elements of the grid expression e.
Definition: GridExpression.hpp:720
const E & operator+(const GridExpression< E > &e)
Returns the grid expression e unchanged (unary +).
Definition: GridExpression.hpp:474
Scalar2QuaternionBinary2Traits< E, typename QuaternionNorm2< E >::ResultType, QuaternionInverse< E, typename QuaternionNorm2< E >::ResultType > >::ResultType inv(const QuaternionExpression< E > &e)
Returns the multiplicative inverse of the quaternion expression e ( ).
Definition: QuaternionExpression.hpp:1368
The namespace of the Chemical Data Processing Library.
Traits selecting the expression-template node and its result type for the Math::QuaternionBinary1 ins...
Definition: QuaternionExpression.hpp:308
QuaternionBinary1< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:311
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:313
Traits selecting the expression-template node and its result type for the Math::QuaternionBinary2 ins...
Definition: QuaternionExpression.hpp:403
QuaternionBinary2< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:406
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:408
Per-component functor returning the quaternion division (n2 is the precomputed squared norm of e_2).
Definition: Functional.hpp:2243
Scalar3QuaternionTernaryFunctor< Q1, Q2, T >::ResultType ResultType
Definition: Functional.hpp:2246
QuaternionScalarUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1576
static ResultType apply(const QuaternionExpression< Q > &e)
Returns the component sum of e.
Definition: Functional.hpp:1583
static ResultType apply(const QuaternionExpression< Q1 > &e1, const QuaternionExpression< Q2 > &e2)
Tells whether e1 and e2 have equal components.
Definition: Functional.hpp:1501
QuaternionBooleanBinaryFunctor< Q1, Q2 >::ResultType ResultType
Definition: Functional.hpp:1493
Per-component functor returning the multiplicative inverse of a quaternion expression (n2 is the pre...
Definition: Functional.hpp:2076
Scalar2QuaternionBinaryFunctor< Q, T >::ResultType ResultType
Definition: Functional.hpp:2079
static ResultType apply(const QuaternionExpression< Q > &e)
Returns .
Definition: Functional.hpp:1650
QuaternionScalarRealUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1643
QuaternionScalarRealUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1615
static ResultType apply(const QuaternionExpression< Q > &e)
Returns .
Definition: Functional.hpp:1622
Scalar3QuaternionBooleanTernaryFunctor< Q1, Q2, T >::ResultType ResultType
Definition: Functional.hpp:1536
static ResultType apply(const QuaternionExpression< Q1 > &e1, const QuaternionExpression< Q2 > &e2, Argument3Type epsilon)
Tells whether e1 and e2 agree component-wise within the absolute tolerance epsilon.
Definition: Functional.hpp:1546
Traits selecting the expression-template node and its result type for the Math::QuaternionUnary1 inst...
Definition: QuaternionExpression.hpp:124
QuaternionUnary1< E, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:127
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:129
Traits selecting the expression-template node and its result type for the Math::QuaternionUnary2 inst...
Definition: QuaternionExpression.hpp:214
QuaternionUnary2< E, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:217
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:219
Traits selecting the expression-template node and its result type for the Math::Scalar13QuaternionTer...
Definition: QuaternionExpression.hpp:983
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:988
Scalar13QuaternionTernary< E1, E2, E3, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:986
Traits selecting the expression-template node and its result type for the Math::Scalar1QuaternionBina...
Definition: QuaternionExpression.hpp:497
Scalar1QuaternionBinary1< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:500
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:502
Traits selecting the expression-template node and its result type for the Math::Scalar1QuaternionBina...
Definition: QuaternionExpression.hpp:592
Scalar1QuaternionBinary2< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:595
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:597
Traits selecting the expression-template node and its result type for the Math::Scalar2QuaternionBina...
Definition: QuaternionExpression.hpp:686
Scalar2QuaternionBinary1< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:689
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:691
Traits selecting the expression-template node and its result type for the Math::Scalar2QuaternionBina...
Definition: QuaternionExpression.hpp:781
Scalar2QuaternionBinary2< E1, E2, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:784
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:786
Traits selecting the expression-template node and its result type for the Math::Scalar3QuaternionTern...
Definition: QuaternionExpression.hpp:882
Scalar3QuaternionTernary< E1, E2, E3, F > ExpressionType
The expression-template node type.
Definition: QuaternionExpression.hpp:885
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:887
Scalar binary addition functor: apply(t1, t2) returns t1 + t2.
Definition: Functional.hpp:344
Scalar binary division functor: apply(t1, t2) returns t1 / t2.
Definition: Functional.hpp:419
Scalar binary multiplication functor: apply(t1, t2) returns t1 * t2.
Definition: Functional.hpp:394
Per-component functor returning the scalar/quaternion division (n2 is the precomputed squared norm o...
Definition: Functional.hpp:2339
Scalar13QuaternionTernaryFunctor< T1, Q, T2 >::ResultType ResultType
Definition: Functional.hpp:2343
Scalar binary subtraction functor: apply(t1, t2) returns t1 - t2.
Definition: Functional.hpp:369