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:
62  typedef typename F::ResultType ValueType;
63 
67  typedef const ValueType ConstReference;
68 
72  typedef const ValueType Reference;
73 
77  typedef const SelfType ConstClosureType;
78 
83 
89  expr(e) {}
90 
96  {
97  return FunctorType::apply(expr.getC1());
98  }
99 
105  {
106  return FunctorType::apply(expr.getC2());
107  }
108 
114  {
115  return FunctorType::apply(expr.getC3());
116  }
117 
123  {
124  return FunctorType::apply(expr.getC4());
125  }
126 
127  private:
128  ExpressionClosureType expr;
129  };
130 
136  template <typename E, typename F>
138  {
139 
144 
149  };
150 
158  template <typename E, typename F>
159  class QuaternionUnary2 : public QuaternionExpression<QuaternionUnary2<E, F> >
160  {
161 
163  typedef F FunctorType;
164  typedef E ExpressionType;
165  typedef typename E::ConstClosureType ExpressionClosureType;
166 
167  public:
171  typedef typename F::ResultType ValueType;
172 
176  typedef const ValueType ConstReference;
177 
181  typedef const ValueType Reference;
182 
186  typedef const SelfType ConstClosureType;
187 
192 
198  expr(e) {}
199 
205  {
206  return FunctorType::applyC1(expr);
207  }
208 
214  {
215  return FunctorType::applyC2(expr);
216  }
217 
223  {
224  return FunctorType::applyC3(expr);
225  }
226 
232  {
233  return FunctorType::applyC4(expr);
234  }
235 
236  private:
237  ExpressionClosureType expr;
238  };
239 
245  template <typename E, typename F>
247  {
248 
253 
258  };
259 
266  template <typename E1, typename E2, typename F>
267  class QuaternionBinary1 : public QuaternionExpression<QuaternionBinary1<E1, E2, F> >
268  {
269 
271  typedef F FunctorType;
272  typedef E1 Expression1Type;
273  typedef E2 Expression2Type;
274  typedef typename E1::ConstClosureType Expression1ClosureType;
275  typedef typename E2::ConstClosureType Expression2ClosureType;
276 
277  public:
281  typedef typename F::ResultType ValueType;
282 
286  typedef const ValueType ConstReference;
287 
291  typedef const ValueType Reference;
292 
296  typedef const SelfType ConstClosureType;
297 
302 
308  QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
309  expr1(e1), expr2(e2) {}
310 
316  {
317  return FunctorType::apply(expr1.getC1(), expr2.getC1());
318  }
319 
325  {
326  return FunctorType::apply(expr1.getC2(), expr2.getC2());
327  }
328 
334  {
335  return FunctorType::apply(expr1.getC3(), expr2.getC3());
336  }
337 
343  {
344  return FunctorType::apply(expr1.getC4(), expr2.getC4());
345  }
346 
347  private:
348  Expression1ClosureType expr1;
349  Expression2ClosureType expr2;
350  };
351 
358  template <typename E1, typename E2, typename F>
360  {
361 
366 
371  };
372 
380  template <typename E1, typename E2, typename F>
381  class QuaternionBinary2 : public QuaternionExpression<QuaternionBinary2<E1, E2, F> >
382  {
383 
385  typedef F FunctorType;
386  typedef E1 Expression1Type;
387  typedef E2 Expression2Type;
388  typedef typename E1::ConstClosureType Expression1ClosureType;
389  typedef typename E2::ConstClosureType Expression2ClosureType;
390 
391  public:
395  typedef typename F::ResultType ValueType;
396 
400  typedef const ValueType ConstReference;
401 
405  typedef const ValueType Reference;
406 
410  typedef const SelfType ConstClosureType;
411 
416 
422  QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
423  expr1(e1), expr2(e2) {}
424 
430  {
431  return FunctorType::applyC1(expr1, expr2);
432  }
433 
439  {
440  return FunctorType::applyC2(expr1, expr2);
441  }
442 
448  {
449  return FunctorType::applyC3(expr1, expr2);
450  }
451 
457  {
458  return FunctorType::applyC4(expr1, expr2);
459  }
460 
461  private:
462  Expression1ClosureType expr1;
463  Expression2ClosureType expr2;
464  };
465 
472  template <typename E1, typename E2, typename F>
474  {
475 
480 
485  };
486 
493  template <typename E1, typename E2, typename F>
494  class Scalar1QuaternionBinary1 : public QuaternionExpression<Scalar1QuaternionBinary1<E1, E2, F> >
495  {
496 
498  typedef F FunctorType;
499  typedef E1 Expression1Type;
500  typedef E2 Expression2Type;
501  typedef const E1 Expression1ClosureType;
502  typedef typename E2::ConstClosureType Expression2ClosureType;
503 
504  public:
508  typedef typename F::ResultType ValueType;
509 
513  typedef const ValueType ConstReference;
514 
518  typedef const ValueType Reference;
519 
523  typedef const SelfType ConstClosureType;
524 
529 
535  Scalar1QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
536  expr1(e1), expr2(e2) {}
537 
543  {
544  return FunctorType::apply(expr1, expr2.getC1());
545  }
546 
552  {
553  return FunctorType::apply(expr1, expr2.getC2());
554  }
555 
561  {
562  return FunctorType::apply(expr1, expr2.getC3());
563  }
564 
570  {
571  return FunctorType::apply(expr1, expr2.getC4());
572  }
573 
574  private:
575  Expression1ClosureType expr1;
576  Expression2ClosureType expr2;
577  };
578 
585  template <typename E1, typename E2, typename F>
587  {
588 
593 
598  };
599 
607  template <typename E1, typename E2, typename F>
608  class Scalar1QuaternionBinary2 : public QuaternionExpression<Scalar1QuaternionBinary2<E1, E2, F> >
609  {
610 
612  typedef F FunctorType;
613  typedef E1 Expression1Type;
614  typedef E2 Expression2Type;
615  typedef const E1 Expression1ClosureType;
616  typedef typename E2::ConstClosureType Expression2ClosureType;
617 
618  public:
622  typedef typename F::ResultType ValueType;
623 
627  typedef const ValueType ConstReference;
628 
632  typedef const ValueType Reference;
633 
637  typedef const SelfType ConstClosureType;
638 
643 
649  Scalar1QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
650  expr1(e1), expr2(e2) {}
651 
657  {
658  return FunctorType::applyC1(expr1, expr2);
659  }
660 
666  {
667  return FunctorType::applyC2(expr1, expr2);
668  }
669 
675  {
676  return FunctorType::applyC3(expr1, expr2);
677  }
678 
684  {
685  return FunctorType::applyC4(expr1, expr2);
686  }
687 
688  private:
689  Expression1ClosureType expr1;
690  Expression2ClosureType expr2;
691  };
692 
699  template <typename E1, typename E2, typename F>
701  {
702 
707 
712  };
713 
720  template <typename E1, typename E2, typename F>
721  class Scalar2QuaternionBinary1 : public QuaternionExpression<Scalar2QuaternionBinary1<E1, E2, F> >
722  {
723 
725  typedef F FunctorType;
726  typedef E1 Expression1Type;
727  typedef E2 Expression2Type;
728  typedef typename E1::ConstClosureType Expression1ClosureType;
729  typedef const E2 Expression2ClosureType;
730 
731  public:
735  typedef typename F::ResultType ValueType;
736 
740  typedef const ValueType ConstReference;
741 
745  typedef const ValueType Reference;
746 
750  typedef const SelfType ConstClosureType;
751 
756 
762  Scalar2QuaternionBinary1(const Expression1Type& e1, const Expression2Type& e2):
763  expr1(e1), expr2(e2) {}
764 
770  {
771  return FunctorType::apply(expr1.getC1(), expr2);
772  }
773 
779  {
780  return FunctorType::apply(expr1.getC2(), expr2);
781  }
782 
788  {
789  return FunctorType::apply(expr1.getC3(), expr2);
790  }
791 
797  {
798  return FunctorType::apply(expr1.getC4(), expr2);
799  }
800 
801  private:
802  Expression1ClosureType expr1;
803  Expression2ClosureType expr2;
804  };
805 
812  template <typename E1, typename E2, typename F>
814  {
815 
820 
825  };
826 
834  template <typename E1, typename E2, typename F>
835  class Scalar2QuaternionBinary2 : public QuaternionExpression<Scalar2QuaternionBinary2<E1, E2, F> >
836  {
837 
839  typedef F FunctorType;
840  typedef E1 Expression1Type;
841  typedef E2 Expression2Type;
842  typedef typename E1::ConstClosureType Expression1ClosureType;
843  typedef const E2 Expression2ClosureType;
844 
845  public:
849  typedef typename F::ResultType ValueType;
850 
854  typedef const ValueType ConstReference;
855 
859  typedef const ValueType Reference;
860 
864  typedef const SelfType ConstClosureType;
865 
870 
876  Scalar2QuaternionBinary2(const Expression1Type& e1, const Expression2Type& e2):
877  expr1(e1), expr2(e2) {}
878 
884  {
885  return FunctorType::applyC1(expr1, expr2);
886  }
887 
893  {
894  return FunctorType::applyC2(expr1, expr2);
895  }
896 
902  {
903  return FunctorType::applyC3(expr1, expr2);
904  }
905 
911  {
912  return FunctorType::applyC4(expr1, expr2);
913  }
914 
915  private:
916  Expression1ClosureType expr1;
917  Expression2ClosureType expr2;
918  };
919 
926  template <typename E1, typename E2, typename F>
928  {
929 
934 
939  };
940 
949  template <typename E1, typename E2, typename E3, typename F>
950  class Scalar3QuaternionTernary : public QuaternionExpression<Scalar3QuaternionTernary<E1, E2, E3, F> >
951  {
952 
954  typedef F FunctorType;
955  typedef E1 Expression1Type;
956  typedef E2 Expression2Type;
957  typedef E3 Expression3Type;
958  typedef typename E1::ConstClosureType Expression1ClosureType;
959  typedef typename E2::ConstClosureType Expression2ClosureType;
960  typedef const E3 Expression3ClosureType;
961 
962  public:
966  typedef typename F::ResultType ValueType;
967 
971  typedef const ValueType ConstReference;
972 
976  typedef const ValueType Reference;
977 
981  typedef const SelfType ConstClosureType;
982 
987 
994  Scalar3QuaternionTernary(const Expression1Type& e1, const Expression2Type& e2, const Expression3Type& e3):
995  expr1(e1), expr2(e2), expr3(e3) {}
996 
1002  {
1003  return FunctorType::applyC1(expr1, expr2, expr3);
1004  }
1005 
1011  {
1012  return FunctorType::applyC2(expr1, expr2, expr3);
1013  }
1014 
1020  {
1021  return FunctorType::applyC3(expr1, expr2, expr3);
1022  }
1023 
1029  {
1030  return FunctorType::applyC4(expr1, expr2, expr3);
1031  }
1032 
1033  private:
1034  Expression1ClosureType expr1;
1035  Expression2ClosureType expr2;
1036  Expression3ClosureType expr3;
1037  };
1038 
1046  template <typename E1, typename E2, typename E3, typename F>
1048  {
1049 
1054 
1059  };
1060 
1069  template <typename E1, typename E2, typename E3, typename F>
1070  class Scalar13QuaternionTernary : public QuaternionExpression<Scalar13QuaternionTernary<E1, E2, E3, F> >
1071  {
1072 
1074  typedef F FunctorType;
1075  typedef E1 Expression1Type;
1076  typedef E2 Expression2Type;
1077  typedef E3 Expression3Type;
1078  typedef const E1 Expression1ClosureType;
1079  typedef typename E2::ConstClosureType Expression2ClosureType;
1080  typedef const E3 Expression3ClosureType;
1081 
1082  public:
1086  typedef typename F::ResultType ValueType;
1087 
1091  typedef const ValueType ConstReference;
1092 
1096  typedef const ValueType Reference;
1097 
1102 
1107 
1114  Scalar13QuaternionTernary(const Expression1Type& e1, const Expression2Type& e2, const Expression3Type& e3):
1115  expr1(e1), expr2(e2), expr3(e3) {}
1116 
1122  {
1123  return FunctorType::applyC1(expr1, expr2, expr3);
1124  }
1125 
1131  {
1132  return FunctorType::applyC2(expr1, expr2, expr3);
1133  }
1134 
1140  {
1141  return FunctorType::applyC3(expr1, expr2, expr3);
1142  }
1143 
1149  {
1150  return FunctorType::applyC4(expr1, expr2, expr3);
1151  }
1152 
1153  private:
1154  Expression1ClosureType expr1;
1155  Expression2ClosureType expr2;
1156  Expression3ClosureType expr3;
1157  };
1158 
1166  template <typename E1, typename E2, typename E3, typename F>
1168  {
1169 
1174 
1179  };
1180 
1187  template <typename E>
1190  {
1191  typedef typename QuaternionUnary1Traits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
1192 
1193  return ExpressionType(e());
1194  }
1195 
1202  template <typename E>
1203  const E&
1205  {
1206  return e();
1207  }
1208 
1217  template <typename E1, typename E2>
1218  typename QuaternionBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
1220  {
1221  typedef typename QuaternionBinary1Traits<E1, E2,
1222  ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1223 
1224  return ExpressionType(e1(), e2());
1225  }
1226 
1235  template <typename E, typename T>
1236  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionAddition<E, T> >::ResultType>::type
1238  {
1239  typedef typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionAddition<E, T> >::ExpressionType ExpressionType;
1240 
1241  return ExpressionType(e(), t);
1242  }
1243 
1252  template <typename T, typename E>
1253  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionAddition<T, E> >::ResultType>::type
1255  {
1256  typedef typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionAddition<T, E> >::ExpressionType ExpressionType;
1257 
1258  return ExpressionType(t, e());
1259  }
1260 
1269  template <typename E1, typename E2>
1270  typename QuaternionBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
1272  {
1273  typedef typename QuaternionBinary1Traits<E1, E2,
1275 
1276  return ExpressionType(e1(), e2());
1277  }
1278 
1287  template <typename E, typename T>
1288  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionSubtraction<E, T> >::ResultType>::type
1290  {
1291  typedef typename Scalar2QuaternionBinary2Traits<E, T, Scalar2QuaternionSubtraction<E, T> >::ExpressionType ExpressionType;
1292 
1293  return ExpressionType(e(), t);
1294  }
1295 
1304  template <typename T, typename E>
1305  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionSubtraction<T, E> >::ResultType>::type
1307  {
1308  typedef typename Scalar1QuaternionBinary2Traits<T, E, Scalar1QuaternionSubtraction<T, E> >::ExpressionType ExpressionType;
1309 
1310  return ExpressionType(t, e());
1311  }
1312 
1321  template <typename E1, typename E2>
1322  typename QuaternionBinary2Traits<E1, E2, QuaternionProduct<E1, E2> >::ResultType
1324  {
1325  typedef typename QuaternionBinary2Traits<E1, E2, QuaternionProduct<E1, E2> >::ExpressionType ExpressionType;
1326 
1327  return ExpressionType(e1(), e2());
1328  }
1329 
1338  template <typename E, typename T>
1339  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary1Traits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
1341  {
1342  typedef typename Scalar2QuaternionBinary1Traits<E, T,
1343  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
1344 
1345  return ExpressionType(e(), t);
1346  }
1347 
1356  template <typename T, typename E>
1357  typename std::enable_if<IsScalar<T>::value, typename Scalar1QuaternionBinary1Traits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
1359  {
1360  typedef typename Scalar1QuaternionBinary1Traits<T, E,
1361  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
1362 
1363  return ExpressionType(t, e());
1364  }
1365 
1374  template <typename E1, typename E2>
1378  {
1381 
1382  return ExpressionType(e1(), e2(), norm2(e2));
1383  }
1384 
1393  template <typename E, typename T>
1394  typename std::enable_if<IsScalar<T>::value, typename Scalar2QuaternionBinary1Traits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
1396  {
1397  typedef typename Scalar2QuaternionBinary1Traits<E, T,
1398  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
1399 
1400  return ExpressionType(e(), t);
1401  }
1402 
1411  template <typename T, typename E>
1412  typename std::enable_if<IsScalar<T>::value,
1416  {
1419 
1420  return ExpressionType(t, e(), norm2(e));
1421  }
1422 
1431  template <typename E1, typename E2>
1434  {
1435  return QuaternionEquality<E1, E2>::apply(e1, e2);
1436  }
1437 
1446  template <typename E1, typename E2>
1449  {
1450  return !QuaternionEquality<E1, E2>::apply(e1, e2);
1451  }
1452 
1463  template <typename E1, typename E2, typename T>
1464  typename std::enable_if<std::is_arithmetic<T>::value, typename QuaternionToleranceEquality<E1, E2, T>::ResultType>::type
1465  equals(const QuaternionExpression<E1>& e1, const QuaternionExpression<E2>& e2, const T& eps)
1466  {
1468  }
1469 
1478  template <typename E1, typename E2>
1479  typename QuaternionBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
1481  {
1482  typedef typename QuaternionBinary1Traits<E1, E2,
1483  ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1484 
1485  return ExpressionType(e1(), e2());
1486  }
1487 
1496  template <typename E1, typename E2>
1497  typename QuaternionBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1499  {
1500  typedef typename QuaternionBinary1Traits<E1, E2,
1502 
1503  return ExpressionType(e1(), e2());
1504  }
1505 
1512  template <typename E>
1513  typename E::ValueType
1515  {
1516  return e().getC1();
1517  }
1518 
1525  template <typename E>
1526  typename QuaternionUnary2Traits<E, QuaternionUnreal<E> >::ResultType
1528  {
1529  typedef typename QuaternionUnary2Traits<E, QuaternionUnreal<E> >::ExpressionType ExpressionType;
1530 
1531  return ExpressionType(e());
1532  }
1533 
1540  template <typename E>
1541  typename QuaternionUnary2Traits<E, QuaternionConjugate<E> >::ResultType
1543  {
1544  typedef typename QuaternionUnary2Traits<E, QuaternionConjugate<E> >::ExpressionType ExpressionType;
1545 
1546  return ExpressionType(e());
1547  }
1548 
1555  template <typename E>
1559  {
1561  QuaternionInverse<E, typename QuaternionNorm2<E>::ResultType> >::ExpressionType ExpressionType;
1562 
1563  return ExpressionType(e(), norm2(e));
1564  }
1565 
1572  template <typename E>
1575  {
1576  return QuaternionNorm<E>::apply(e);
1577  }
1578 
1585  template <typename E>
1588  {
1589  return QuaternionNorm2<E>::apply(e);
1590  }
1591 
1598  template <typename E>
1601  {
1603  }
1604  } // namespace Math
1605 } // namespace CDPL
1606 
1607 #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.
Definition: Expression.hpp:49
Expression template node combining two quaternion expressions E1 and E2 component-wise via the binary...
Definition: QuaternionExpression.hpp:268
ConstReference getC1() const
Returns the result of applying the binary functor to the C1 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:315
ConstReference getC4() const
Returns the result of applying the binary functor to the C4 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:342
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:291
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:286
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:296
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:281
QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping e1 and e2.
Definition: QuaternionExpression.hpp:308
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:301
ConstReference getC3() const
Returns the result of applying the binary functor to the C3 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:333
ConstReference getC2() const
Returns the result of applying the binary functor to the C2 components of the two wrapped expressions...
Definition: QuaternionExpression.hpp:324
Expression template node combining two quaternion expressions E1 and E2 via the per-component functor...
Definition: QuaternionExpression.hpp:382
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:405
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:410
QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping e1 and e2.
Definition: QuaternionExpression.hpp:422
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:456
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:415
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:400
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:429
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:447
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two wrapped expressions.
Definition: QuaternionExpression.hpp:438
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:395
CRTP base class of all quaternion expression types.
Definition: Expression.hpp:148
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:122
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:62
ConstReference getC1() const
Returns the result of applying the unary functor to component C1 of the wrapped expression.
Definition: QuaternionExpression.hpp:95
ConstReference getC3() const
Returns the result of applying the unary functor to component C3 of the wrapped expression.
Definition: QuaternionExpression.hpp:113
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:67
ConstReference getC2() const
Returns the result of applying the unary functor to component C2 of the wrapped expression.
Definition: QuaternionExpression.hpp:104
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:72
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:82
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:77
QuaternionUnary1(const ExpressionType &e)
Constructs the expression template node wrapping e.
Definition: QuaternionExpression.hpp:88
Expression template node applying a per-component functor F to a quaternion expression E,...
Definition: QuaternionExpression.hpp:160
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:171
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the wrapped expression.
Definition: QuaternionExpression.hpp:204
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:191
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the wrapped expression.
Definition: QuaternionExpression.hpp:231
QuaternionUnary2(const ExpressionType &e)
Constructs the expression template node wrapping e.
Definition: QuaternionExpression.hpp:197
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:176
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:186
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:181
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the wrapped expression.
Definition: QuaternionExpression.hpp:222
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the wrapped expression.
Definition: QuaternionExpression.hpp:213
Expression template node combining a scalar E1 (lhs), a quaternion expression E2 (middle),...
Definition: QuaternionExpression.hpp:1071
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:1114
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:1139
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:1148
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:1121
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:1106
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:1096
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:1086
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:1091
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:1101
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two scalars and the wrapped expres...
Definition: QuaternionExpression.hpp:1130
Expression template node combining a scalar E1 (lhs) and a quaternion expression E2 (rhs) component-w...
Definition: QuaternionExpression.hpp:495
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:569
Scalar1QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the scalar e1 and the quaternion expression e2.
Definition: QuaternionExpression.hpp:535
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:513
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:518
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:551
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:560
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:523
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:528
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:542
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:508
Expression template node combining a scalar E1 (lhs) and a quaternion expression E2 (rhs) via the per...
Definition: QuaternionExpression.hpp:609
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:674
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:627
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:622
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:642
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:665
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:683
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:632
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:637
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the scalar and the wrapped expression.
Definition: QuaternionExpression.hpp:656
Scalar1QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the scalar e1 and the quaternion expression e2.
Definition: QuaternionExpression.hpp:649
Expression template node combining a quaternion expression E1 (lhs) and a scalar E2 (rhs) component-w...
Definition: QuaternionExpression.hpp:722
ConstReference getC4() const
Returns the result of applying the binary functor to the C4 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:796
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:745
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:735
ConstReference getC3() const
Returns the result of applying the binary functor to the C3 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:787
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:740
Scalar2QuaternionBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the quaternion expression e1 and the scalar e2.
Definition: QuaternionExpression.hpp:762
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:755
ConstReference getC2() const
Returns the result of applying the binary functor to the C2 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:778
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:750
ConstReference getC1() const
Returns the result of applying the binary functor to the C1 component of the wrapped expression and t...
Definition: QuaternionExpression.hpp:769
Expression template node combining a quaternion expression E1 (lhs) and a scalar E2 (rhs) via the per...
Definition: QuaternionExpression.hpp:836
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:892
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:869
Scalar2QuaternionBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the quaternion expression e1 and the scalar e2.
Definition: QuaternionExpression.hpp:876
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:859
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:901
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:910
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:854
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:849
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:864
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the wrapped expression and the scalar.
Definition: QuaternionExpression.hpp:883
Expression template node combining two quaternion expressions E1 (lhs) and E2 (middle) with a scalar ...
Definition: QuaternionExpression.hpp:951
ConstReference getC4() const
Returns the result of applying the functor's applyC4 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:1028
ConstReference getC1() const
Returns the result of applying the functor's applyC1 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:1001
ConstReference getC3() const
Returns the result of applying the functor's applyC3 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:1019
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: QuaternionExpression.hpp:966
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:981
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:994
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: QuaternionExpression.hpp:986
ConstReference getC2() const
Returns the result of applying the functor's applyC2 method to the two wrapped expressions and the sc...
Definition: QuaternionExpression.hpp:1010
const ValueType ConstReference
Constant component reference type.
Definition: QuaternionExpression.hpp:971
const ValueType Reference
Mutable component reference type (degrades to const for expression template results).
Definition: QuaternionExpression.hpp:976
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:802
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:722
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:709
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:1527
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:659
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:752
QuaternionNorm2< E >::ResultType norm2(const QuaternionExpression< E > &e)
Returns the squared norm of the quaternion expression e.
Definition: QuaternionExpression.hpp:1587
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:692
QuaternionNorm< E >::ResultType norm(const QuaternionExpression< E > &e)
Returns the norm (Euclidean length) of the quaternion expression e.
Definition: QuaternionExpression.hpp:1574
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:677
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:623
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:784
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:557
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Returns the sum of all elements of the grid expression e.
Definition: GridExpression.hpp:818
const E & operator+(const GridExpression< E > &e)
Returns the grid expression e unchanged (unary +).
Definition: GridExpression.hpp:572
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:1558
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:360
QuaternionBinary1< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:365
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:370
Traits selecting the expression template node and its result type for the Math::QuaternionBinary2 ins...
Definition: QuaternionExpression.hpp:474
QuaternionBinary2< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:479
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:484
Per-component functor returning the quaternion division (n2 is the precomputed squared norm of e_2).
Definition: Functional.hpp:2408
Scalar3QuaternionTernaryFunctor< Q1, Q2, T >::ResultType ResultType
Definition: Functional.hpp:2411
QuaternionScalarUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1714
static ResultType apply(const QuaternionExpression< Q > &e)
Returns the component sum of e.
Definition: Functional.hpp:1721
static ResultType apply(const QuaternionExpression< Q1 > &e1, const QuaternionExpression< Q2 > &e2)
Tells whether e1 and e2 have equal components.
Definition: Functional.hpp:1629
QuaternionBooleanBinaryFunctor< Q1, Q2 >::ResultType ResultType
Definition: Functional.hpp:1621
Per-component functor returning the multiplicative inverse of a quaternion expression (n2 is the pre...
Definition: Functional.hpp:2234
Scalar2QuaternionBinaryFunctor< Q, T >::ResultType ResultType
Definition: Functional.hpp:2237
static ResultType apply(const QuaternionExpression< Q > &e)
Returns .
Definition: Functional.hpp:1796
QuaternionScalarRealUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1789
QuaternionScalarRealUnaryFunctor< Q >::ResultType ResultType
Definition: Functional.hpp:1761
static ResultType apply(const QuaternionExpression< Q > &e)
Returns .
Definition: Functional.hpp:1768
Scalar3QuaternionBooleanTernaryFunctor< Q1, Q2, T >::ResultType ResultType
Definition: Functional.hpp:1672
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:1682
Traits selecting the expression template node and its result type for the Math::QuaternionUnary1 inst...
Definition: QuaternionExpression.hpp:138
QuaternionUnary1< E, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:143
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:148
Traits selecting the expression template node and its result type for the Math::QuaternionUnary2 inst...
Definition: QuaternionExpression.hpp:247
QuaternionUnary2< E, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:252
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:257
Traits selecting the expression template node and its result type for the Math::Scalar13QuaternionTer...
Definition: QuaternionExpression.hpp:1168
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:1178
Scalar13QuaternionTernary< E1, E2, E3, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:1173
Traits selecting the expression template node and its result type for the Math::Scalar1QuaternionBina...
Definition: QuaternionExpression.hpp:587
Scalar1QuaternionBinary1< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:592
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::Scalar1QuaternionBina...
Definition: QuaternionExpression.hpp:701
Scalar1QuaternionBinary2< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:706
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:711
Traits selecting the expression template node and its result type for the Math::Scalar2QuaternionBina...
Definition: QuaternionExpression.hpp:814
Scalar2QuaternionBinary1< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:819
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:824
Traits selecting the expression template node and its result type for the Math::Scalar2QuaternionBina...
Definition: QuaternionExpression.hpp:928
Scalar2QuaternionBinary2< E1, E2, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:933
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:938
Traits selecting the expression template node and its result type for the Math::Scalar3QuaternionTern...
Definition: QuaternionExpression.hpp:1048
Scalar3QuaternionTernary< E1, E2, E3, F > ExpressionType
The expression template node type.
Definition: QuaternionExpression.hpp:1053
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: QuaternionExpression.hpp:1058
Scalar binary addition functor: apply(t1, t2) returns t1 + t2.
Definition: Functional.hpp:373
Scalar binary division functor: apply(t1, t2) returns t1 / t2.
Definition: Functional.hpp:448
Scalar binary multiplication functor: apply(t1, t2) returns t1 * t2.
Definition: Functional.hpp:423
Per-component functor returning the scalar/quaternion division (n2 is the precomputed squared norm o...
Definition: Functional.hpp:2512
Scalar13QuaternionTernaryFunctor< T1, Q, T2 >::ResultType ResultType
Definition: Functional.hpp:2516
Scalar binary subtraction functor: apply(t1, t2) returns t1 - t2.
Definition: Functional.hpp:398