Chemical Data Processing Library C++ API - Version 1.4.0
MatrixExpression.hpp
Go to the documentation of this file.
1 /*
2  * MatrixExpression.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_MATRIXEXPRESSION_HPP
28 #define CDPL_MATH_MATRIXEXPRESSION_HPP
29 
30 #include <type_traits>
31 
32 #include "CDPL/Math/Check.hpp"
33 #include "CDPL/Math/Expression.hpp"
34 #include "CDPL/Math/CommonType.hpp"
35 #include "CDPL/Math/Functional.hpp"
36 #include "CDPL/Math/TypeTraits.hpp"
37 #include "CDPL/Base/Exceptions.hpp"
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Math
44  {
45 
46  template <typename C>
47  class VectorContainer;
48  template <typename C>
49  class MatrixContainer;
50 
56  template <typename E, typename F>
57  class MatrixUnary : public MatrixExpression<MatrixUnary<E, F> >
58  {
59 
61  typedef F FunctorType;
62  typedef E ExpressionType;
63  typedef typename E::ConstClosureType ExpressionClosureType;
64 
65  public:
69  typedef typename F::ResultType ValueType;
70 
74  typedef const ValueType ConstReference;
75 
79  typedef const ValueType Reference;
80 
84  typedef const SelfType ConstClosureType;
85 
90 
94  typedef typename E::SizeType SizeType;
95 
99  typedef typename E::DifferenceType DifferenceType;
100 
106  expr(e) {}
107 
113  {
114  return expr.getSize1();
115  }
116 
122  {
123  return expr.getSize2();
124  }
125 
133  {
134  return FunctorType::apply(expr(i, j));
135  }
136 
137  private:
138  ExpressionClosureType expr;
139  };
140 
146  template <typename E, typename F>
148  {
149 
154 
159  };
160 
166  template <typename E, typename F>
167  class VectorMatrixUnary : public MatrixExpression<VectorMatrixUnary<E, F> >
168  {
169 
171  typedef F FunctorType;
172  typedef E ExpressionType;
173  typedef typename E::ConstClosureType ExpressionClosureType;
174 
175  public:
179  typedef typename F::ResultType ValueType;
180 
184  typedef const ValueType ConstReference;
185 
189  typedef const ValueType Reference;
190 
194  typedef const SelfType ConstClosureType;
195 
200 
204  typedef typename E::SizeType SizeType;
205 
209  typedef typename E::DifferenceType DifferenceType;
210 
216  expr(e) {}
217 
223  {
224  return expr.getSize();
225  }
226 
232  {
233  return expr.getSize();
234  }
235 
243  {
244  return FunctorType::apply(expr, i, j);
245  }
246 
247  private:
248  ExpressionClosureType expr;
249  };
250 
256  template <typename E, typename F>
258  {
259 
264 
269  };
270 
277  template <typename E1, typename E2, typename F>
278  class MatrixBinary1 : public MatrixExpression<MatrixBinary1<E1, E2, F> >
279  {
280 
282  typedef F FunctorType;
283  typedef E1 Expression1Type;
284  typedef E2 Expression2Type;
285  typedef typename E1::ConstClosureType Expression1ClosureType;
286  typedef typename E2::ConstClosureType Expression2ClosureType;
287 
288  public:
292  typedef typename F::ResultType ValueType;
293 
297  typedef const ValueType ConstReference;
298 
302  typedef const ValueType Reference;
303 
307  typedef const SelfType ConstClosureType;
308 
313 
318 
323 
329  MatrixBinary1(const Expression1Type& e1, const Expression2Type& e2):
330  expr1(e1), expr2(e2) {}
331 
338  {
339  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize1()), SizeType(expr2.getSize1()), Base::SizeError);
340  }
341 
348  {
349  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize2()), SizeType(expr2.getSize2()), Base::SizeError);
350  }
351 
359  {
360  return FunctorType::apply(expr1(i, j), expr2(i, j));
361  }
362 
363  private:
364  Expression1ClosureType expr1;
365  Expression2ClosureType expr2;
366  };
367 
374  template <typename E1, typename E2, typename F>
376  {
377 
382 
387  };
388 
400  template <typename E1, typename E2, typename F>
401  class MatrixBinary2 : public MatrixExpression<MatrixBinary2<E1, E2, F> >
402  {
403 
405  typedef F FunctorType;
406  typedef E1 Expression1Type;
407  typedef E2 Expression2Type;
408  typedef typename E1::ConstClosureType Expression1ClosureType;
409  typedef typename E2::ConstClosureType Expression2ClosureType;
410 
411  public:
415  typedef typename F::ResultType ValueType;
416 
420  typedef const ValueType ConstReference;
421 
425  typedef const ValueType Reference;
426 
430  typedef const SelfType ConstClosureType;
431 
436 
441 
446 
452  MatrixBinary2(const Expression1Type& e1, const Expression2Type& e2):
453  expr1(e1), expr2(e2) {}
454 
460  {
461  return expr1.getSize1();
462  }
463 
469  {
470  return expr2.getSize2();
471  }
472 
480  {
481  return FunctorType::apply(expr1, expr2, i, j);
482  }
483 
484  private:
485  Expression1ClosureType expr1;
486  Expression2ClosureType expr2;
487  };
488 
495  template <typename E1, typename E2, typename F>
497  {
498 
503 
508  };
509 
517  template <typename E1, typename E2, typename F>
518  class VectorMatrixBinary : public MatrixExpression<VectorMatrixBinary<E1, E2, F> >
519  {
520 
522  typedef F FunctorType;
523  typedef E1 Expression1Type;
524  typedef E2 Expression2Type;
525  typedef typename E1::ConstClosureType Expression1ClosureType;
526  typedef typename E2::ConstClosureType Expression2ClosureType;
527 
528  public:
532  typedef typename F::ResultType ValueType;
533 
537  typedef const ValueType ConstReference;
538 
542  typedef const ValueType Reference;
543 
547  typedef const SelfType ConstClosureType;
548 
553 
558 
563 
569  VectorMatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
570  expr1(e1), expr2(e2) {}
571 
577  {
578  return expr1.getSize();
579  }
580 
586  {
587  return expr2.getSize();
588  }
589 
597  {
598  return FunctorType::apply(expr1(i), expr2(j));
599  }
600 
601  private:
602  Expression1ClosureType expr1;
603  Expression2ClosureType expr2;
604  };
605 
612  template <typename E1, typename E2, typename F>
614  {
615 
620 
625  };
626 
637  template <typename E1, typename E2, typename F>
638  class Matrix1VectorBinary : public VectorExpression<Matrix1VectorBinary<E1, E2, F> >
639  {
640 
642  typedef F FunctorType;
643  typedef E1 Expression1Type;
644  typedef E2 Expression2Type;
645  typedef typename E1::ConstClosureType Expression1ClosureType;
646  typedef typename E2::ConstClosureType Expression2ClosureType;
647 
648  public:
652  typedef typename F::ResultType ValueType;
653 
657  typedef const ValueType ConstReference;
658 
662  typedef const ValueType Reference;
663 
667  typedef const SelfType ConstClosureType;
668 
673 
678 
683 
689  Matrix1VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
690  expr1(e1), expr2(e2) {}
691 
697  {
698  return expr1.getSize1();
699  }
700 
707  {
708  return FunctorType::apply(expr1, expr2, i);
709  }
710 
717  {
718  return FunctorType::apply(expr1, expr2, i);
719  }
720 
721  private:
722  Expression1ClosureType expr1;
723  Expression2ClosureType expr2;
724  };
725 
732  template <typename E1, typename E2, typename F>
734  {
735 
740 
745  };
746 
757  template <typename E1, typename E2, typename F>
758  class Matrix2VectorBinary : public VectorExpression<Matrix2VectorBinary<E1, E2, F> >
759  {
760 
762  typedef F FunctorType;
763  typedef E1 Expression1Type;
764  typedef E2 Expression2Type;
765  typedef typename E1::ConstClosureType Expression1ClosureType;
766  typedef typename E2::ConstClosureType Expression2ClosureType;
767 
768  public:
772  typedef typename F::ResultType ValueType;
773 
777  typedef const ValueType ConstReference;
778 
782  typedef const ValueType Reference;
783 
787  typedef const SelfType ConstClosureType;
788 
793 
798 
803 
809  Matrix2VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
810  expr1(e1), expr2(e2) {}
811 
817  {
818  return expr2.getSize2();
819  }
820 
827  {
828  return FunctorType::apply(expr1, expr2, i);
829  }
830 
837  {
838  return FunctorType::apply(expr1, expr2, i);
839  }
840 
841  private:
842  Expression1ClosureType expr1;
843  Expression2ClosureType expr2;
844  };
845 
852  template <typename E1, typename E2, typename F>
854  {
855 
860 
865  };
866 
873  template <typename E1, typename E2, typename F>
874  class Scalar1MatrixBinary : public MatrixExpression<Scalar1MatrixBinary<E1, E2, F> >
875  {
876 
878  typedef F FunctorType;
879  typedef E1 Expression1Type;
880  typedef E2 Expression2Type;
881  typedef const E1 Expression1ClosureType;
882  typedef typename E2::ConstClosureType Expression2ClosureType;
883 
884  public:
888  typedef typename F::ResultType ValueType;
889 
893  typedef const ValueType ConstReference;
894 
898  typedef const ValueType Reference;
899 
903  typedef const SelfType ConstClosureType;
904 
909 
913  typedef typename E2::SizeType SizeType;
914 
918  typedef typename E2::DifferenceType DifferenceType;
919 
925  Scalar1MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
926  expr1(e1), expr2(e2) {}
927 
933  {
934  return expr2.getSize1();
935  }
936 
942  {
943  return expr2.getSize2();
944  }
945 
953  {
954  return FunctorType::apply(expr1, expr2(i, j));
955  }
956 
957  private:
958  Expression1ClosureType expr1;
959  Expression2ClosureType expr2;
960  };
961 
968  template <typename E1, typename E2, typename F>
970  {
971 
976 
981  };
982 
989  template <typename E1, typename E2, typename F>
990  class Scalar2MatrixBinary : public MatrixExpression<Scalar2MatrixBinary<E1, E2, F> >
991  {
992 
994  typedef F FunctorType;
995  typedef E1 Expression1Type;
996  typedef E2 Expression2Type;
997  typedef typename E1::ConstClosureType Expression1ClosureType;
998  typedef const E2 Expression2ClosureType;
999 
1000  public:
1004  typedef typename F::ResultType ValueType;
1005 
1009  typedef const ValueType ConstReference;
1010 
1014  typedef const ValueType Reference;
1015 
1020 
1025 
1029  typedef typename E1::SizeType SizeType;
1030 
1034  typedef typename E1::DifferenceType DifferenceType;
1035 
1041  Scalar2MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
1042  expr1(e1), expr2(e2) {}
1043 
1049  {
1050  return expr1.getSize1();
1051  }
1052 
1058  {
1059  return expr1.getSize2();
1060  }
1061 
1069  {
1070  return FunctorType::apply(expr1(i, j), expr2);
1071  }
1072 
1073  private:
1074  Expression1ClosureType expr1;
1075  Expression2ClosureType expr2;
1076  };
1077 
1084  template <typename E1, typename E2, typename F>
1086  {
1087 
1092 
1097  };
1098 
1103  template <typename M>
1104  class MatrixTranspose : public MatrixExpression<MatrixTranspose<M> >
1105  {
1106 
1107  typedef MatrixTranspose<M> SelfType;
1108 
1109  public:
1113  typedef M MatrixType;
1114 
1118  typedef typename M::SizeType SizeType;
1119 
1123  typedef typename M::DifferenceType DifferenceType;
1124 
1128  typedef typename M::ValueType ValueType;
1129 
1133  typedef typename M::ConstReference ConstReference;
1134 
1138  typedef typename std::conditional<std::is_const<M>::value,
1139  typename M::ConstReference,
1140  typename M::Reference>::type Reference;
1141 
1145  typedef typename std::conditional<std::is_const<M>::value,
1146  typename M::ConstClosureType,
1147  typename M::ClosureType>::type MatrixClosureType;
1148 
1153 
1158 
1164  data(m) {}
1165 
1173  {
1174  return data(j, i);
1175  }
1176 
1184  {
1185  return data(j, i);
1186  }
1187 
1193  {
1194  return data.getSize2();
1195  }
1196 
1202  {
1203  return data.getSize1();
1204  }
1205 
1211  {
1212  return data.getMaxSize();
1213  }
1214 
1219  bool isEmpty() const
1220  {
1221  return (data.getSize1() == 0 || data.getSize2() == 0);
1222  }
1223 
1229  {
1230  return data;
1231  }
1232 
1238  {
1239  return data;
1240  }
1241 
1248  {
1249  data.operator=(mt.data);
1250  return *this;
1251  }
1252 
1259  template <typename M1>
1261  {
1262  data.operator=(mt.getData());
1263  return *this;
1264  }
1265 
1272  template <typename E>
1274  {
1275  data.operator=(MatrixTranspose<const E>(e()));
1276  return *this;
1277  }
1278 
1285  template <typename E>
1287  {
1288  data.operator+=(MatrixTranspose<const E>(e()));
1289  return *this;
1290  }
1291 
1298  template <typename E>
1300  {
1301  data.operator-=(MatrixTranspose<const E>(e()));
1302  return *this;
1303  }
1304 
1311  template <typename T>
1312  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator*=(const T& t)
1313  {
1314  data.operator*=(t);
1315  return *this;
1316  }
1317 
1324  template <typename T>
1325  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator/=(const T& t)
1326  {
1327  data.operator/=(t);
1328  return *this;
1329  }
1330 
1337  template <typename E>
1339  {
1340  data.assign((MatrixTranspose<const E>(e())));
1341  return *this;
1342  }
1343 
1350  template <typename E>
1352  {
1353  data.plusAssign((MatrixTranspose<const E>(e())));
1354  return *this;
1355  }
1356 
1363  template <typename E>
1365  {
1366  data.minusAssign((MatrixTranspose<const E>(e())));
1367  return *this;
1368  }
1369 
1375  {
1376  data.swap(mt.data);
1377  }
1378 
1384  friend void swap(MatrixTranspose& mt1, MatrixTranspose& mt2)
1385  {
1386  mt1.swap(mt2);
1387  }
1388 
1389  private:
1390  MatrixClosureType data;
1391  };
1392 
1397  template <typename M>
1399  {};
1400 
1405  template <typename M>
1407  {};
1408 
1413  template <typename M>
1415  {};
1416 
1421  template <typename M>
1423  {};
1424 
1431  template <typename E>
1434  {
1435  typedef typename MatrixUnaryTraits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
1436 
1437  return ExpressionType(e());
1438  }
1439 
1446  template <typename E>
1447  const E&
1449  {
1450  return e();
1451  }
1452 
1461  template <typename E1, typename E2>
1462  typename MatrixBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
1464  {
1465  typedef typename MatrixBinary1Traits<E1, E2,
1466  ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1467 
1468  return ExpressionType(e1(), e2());
1469  }
1470 
1479  template <typename E1, typename E2>
1480  typename MatrixBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
1482  {
1483  typedef typename MatrixBinary1Traits<E1, E2,
1485 
1486  return ExpressionType(e1(), e2());
1487  }
1488 
1497  template <typename E, typename T>
1498  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
1499  operator*(const MatrixExpression<E>& e, const T& t)
1500  {
1501  typedef typename Scalar2MatrixBinaryTraits<E, T,
1502  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
1503 
1504  return ExpressionType(e(), t);
1505  }
1506 
1515  template <typename T, typename E>
1516  typename std::enable_if<IsScalar<T>::value, typename Scalar1MatrixBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
1517  operator*(const T& t, const MatrixExpression<E>& e)
1518  {
1519  typedef typename Scalar1MatrixBinaryTraits<T, E,
1520  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
1521 
1522  return ExpressionType(t, e());
1523  }
1524 
1533  template <typename E, typename T>
1534  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
1535  operator/(const MatrixExpression<E>& e, const T& t)
1536  {
1537  typedef typename Scalar2MatrixBinaryTraits<E, T,
1538  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
1539 
1540  return ExpressionType(e(), t);
1541  }
1542 
1551  template <typename E1, typename E2>
1554  {
1555  return MatrixEquality<E1, E2>::apply(e1, e2);
1556  }
1557 
1566  template <typename E1, typename E2>
1569  {
1570  return !MatrixEquality<E1, E2>::apply(e1, e2);
1571  }
1572 
1583  template <typename E1, typename E2, typename T>
1584  typename std::enable_if<std::is_arithmetic<T>::value, typename MatrixToleranceEquality<E1, E2, T>::ResultType>::type
1585  equals(const MatrixExpression<E1>& e1, const MatrixExpression<E2>& e2, const T& eps)
1586  {
1587  return MatrixToleranceEquality<E1, E2, T>::apply(e1, e2, eps);
1588  }
1589 
1596  template <typename E>
1597  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
1599  {
1600  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
1601 
1602  return ExpressionType(e());
1603  }
1604 
1611  template <typename E>
1612  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
1614  {
1615  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
1616 
1617  return ExpressionType(e());
1618  }
1619 
1626  template <typename E>
1627  typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
1629  {
1630  typedef typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ExpressionType ExpressionType;
1631 
1632  return ExpressionType(e());
1633  }
1634 
1641  template <typename E>
1642  typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
1644  {
1645  typedef typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ExpressionType ExpressionType;
1646 
1647  return ExpressionType(e());
1648  }
1649 
1658  template <typename E1, typename E2>
1659  typename VectorMatrixBinaryTraits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1661  {
1662  typedef typename VectorMatrixBinaryTraits<E1, E2,
1664 
1665  return ExpressionType(e1(), e2());
1666  }
1667 
1676  template <typename E1, typename E2>
1677  typename MatrixBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
1679  {
1680  typedef typename MatrixBinary1Traits<E1, E2,
1681  ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1682 
1683  return ExpressionType(e1(), e2());
1684  }
1685 
1694  template <typename E1, typename E2>
1695  typename MatrixBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1697  {
1698  typedef typename MatrixBinary1Traits<E1, E2,
1700 
1701  return ExpressionType(e1(), e2());
1702  }
1703 
1712  template <typename E1, typename E2>
1713  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
1715  {
1716  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
1717 
1718  return ExpressionType(e1(), e2());
1719  }
1720 
1729  template <typename E1, typename E2>
1730  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
1732  {
1733  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
1734 
1735  return ExpressionType(e1(), e2());
1736  }
1737 
1748  template <typename C, typename E1, typename E2>
1750  {
1751  return c().assign(prod(e1, e2));
1752  }
1753 
1762  template <typename E1, typename E2>
1763  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
1765  {
1766  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1767 
1768  return ExpressionType(e1(), e2());
1769  }
1770 
1779  template <typename E1, typename E2>
1780  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
1782  {
1783  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1784 
1785  return ExpressionType(e1(), e2());
1786  }
1787 
1798  template <typename C, typename E1, typename E2>
1800  {
1801  return c().assign(prod(e1, e2));
1802  }
1803 
1812  template <typename E1, typename E2>
1813  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
1815  {
1816  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1817 
1818  return ExpressionType(e1(), e2());
1819  }
1820 
1829  template <typename E1, typename E2>
1830  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
1832  {
1833  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1834 
1835  return ExpressionType(e1(), e2());
1836  }
1837 
1848  template <typename C, typename E1, typename E2>
1850  {
1851  return c().assign(prod(e1, e2));
1852  }
1853 
1860  template <typename E>
1863  {
1864  return MatrixTrace<E>::apply(e);
1865  }
1866 
1873  template <typename E>
1876  {
1877  return MatrixNorm1<E>::apply(e);
1878  }
1879 
1886  template <typename E>
1889  {
1891  }
1892 
1899  template <typename E>
1902  {
1903  return MatrixNormInfinity<E>::apply(e);
1904  }
1905 
1912  template <typename E>
1913  typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ResultType
1915  {
1916  typedef typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ExpressionType ExpressionType;
1917 
1918  return ExpressionType(e());
1919  }
1920 
1927  template <typename E>
1928  typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ResultType
1930  {
1931  typedef typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ExpressionType ExpressionType;
1932 
1933  return ExpressionType(e());
1934  }
1935 
1942  template <typename E>
1944  {
1945  return MatrixTranspose<E>(e());
1946  }
1947 
1954  template <typename E>
1956  {
1957  return MatrixTranspose<const E>(e());
1958  }
1959 
1966  template <typename E>
1969  {
1970  return MatrixElementSum<E>::apply(e);
1971  }
1972  } // namespace Math
1973 } // namespace CDPL
1974 
1975 #endif // CDPL_MATH_MATRIXEXPRESSION_HPP
Definition of exception classes.
Definition of various preprocessor macros for error checking.
#define CDPL_MATH_CHECK_SIZE_EQUALITY(size1, size2, e)
Throws the exception e if size1 differs from size2, otherwise returns std::min(size1,...
Definition: Check.hpp:84
Common type deduction.
Definition of basic expression types.
Definition of various functors.
Definition of type traits.
Thrown to indicate that the size of a (multidimensional) array is not correct.
Definition: Base/Exceptions.hpp:133
E ExpressionType
The derived expression type.
Definition: Expression.hpp:49
Expression template node interpreting a binary combination of a matrix expression E1 and a vector exp...
Definition: MatrixExpression.hpp:639
SizeType getSize() const
Returns the wrapped matrix expression's number of rows (number of rows = size of the result vector).
Definition: MatrixExpression.hpp:696
ConstReference operator[](SizeType i) const
Alias for operator() — invokes the functor with the matrix expression, the vector expression,...
Definition: MatrixExpression.hpp:716
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:667
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:652
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:657
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:672
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the wrapped matrix and vector expressions.
Definition: MatrixExpression.hpp:682
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the wrapped matrix and vector expressions.
Definition: MatrixExpression.hpp:677
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:662
Matrix1VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping the matrix expression e1 and the vector expression e...
Definition: MatrixExpression.hpp:689
ConstReference operator()(SizeType i) const
Invokes the functor with the matrix expression, the vector expression, and the index i to compute ele...
Definition: MatrixExpression.hpp:706
Expression template node interpreting a binary combination of a vector expression E1 and a matrix exp...
Definition: MatrixExpression.hpp:759
ConstReference operator()(SizeType i) const
Invokes the functor with the vector expression, the matrix expression, and the index i to compute ele...
Definition: MatrixExpression.hpp:826
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:777
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:772
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the wrapped vector and matrix expressions.
Definition: MatrixExpression.hpp:797
ConstReference operator[](SizeType i) const
Alias for operator() — invokes the functor with the vector expression, the matrix expression,...
Definition: MatrixExpression.hpp:836
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the wrapped vector and matrix expressions.
Definition: MatrixExpression.hpp:802
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:792
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:787
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:782
Matrix2VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping the vector expression e1 and the matrix expression e...
Definition: MatrixExpression.hpp:809
SizeType getSize() const
Returns the wrapped matrix expression's number of columns (number of columns = size of the result vec...
Definition: MatrixExpression.hpp:816
Expression template node combining two matrix expressions E1 and E2 element-wise via the binary funct...
Definition: MatrixExpression.hpp:279
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:312
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped expressions.
Definition: MatrixExpression.hpp:317
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:302
SizeType getSize1() const
Returns the number of rows after verifying that both wrapped expressions agree on it.
Definition: MatrixExpression.hpp:337
SizeType getSize2() const
Returns the number of columns after verifying that both wrapped expressions agree on it.
Definition: MatrixExpression.hpp:347
ConstReference operator()(SizeType i, SizeType j) const
Applies the binary functor element-wise at (i, j) of the two wrapped expressions and returns the resu...
Definition: MatrixExpression.hpp:358
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:307
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped expressions.
Definition: MatrixExpression.hpp:322
MatrixBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:329
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:297
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:292
Expression template node combining two matrix expressions E1 and E2 via a binary functor F that is in...
Definition: MatrixExpression.hpp:402
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:420
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:430
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:425
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:435
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped expressions.
Definition: MatrixExpression.hpp:445
ConstReference operator()(SizeType i, SizeType j) const
Invokes the functor with both wrapped expressions and the indices (i, j) and returns the result.
Definition: MatrixExpression.hpp:479
MatrixBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:452
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:415
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped expressions.
Definition: MatrixExpression.hpp:440
SizeType getSize1() const
Returns the first wrapped expression's number of rows (= number of rows of the result).
Definition: MatrixExpression.hpp:459
SizeType getSize2() const
Returns the second wrapped expression's number of columns (= number of columns of the result).
Definition: MatrixExpression.hpp:468
Refinement of Math::MatrixExpression marking the derived type as a concrete (writable) matrix contain...
Definition: Expression.hpp:262
CRTP base class of all matrix expression types.
Definition: Expression.hpp:108
Mutable view adapter that exposes the transpose of a matrix M as a matrix expression ( ).
Definition: MatrixExpression.hpp:1105
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Closure type used to store the wrapped matrix internally.
Definition: MatrixExpression.hpp:1147
M::ConstReference ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:1133
SizeType getMaxSize() const
Returns the maximum number of elements the wrapped matrix can hold.
Definition: MatrixExpression.hpp:1210
void swap(MatrixTranspose &mt)
Swaps the underlying matrices of the two transpose views.
Definition: MatrixExpression.hpp:1374
SelfType ClosureType
Closure type used when this proxy appears inside another expression.
Definition: MatrixExpression.hpp:1157
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator/=(const T &t)
Divides every element of the wrapped matrix by the scalar t.
Definition: MatrixExpression.hpp:1325
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator*=(const T &t)
Multiplies every element of the wrapped matrix by the scalar t.
Definition: MatrixExpression.hpp:1312
MatrixTranspose & operator-=(const MatrixExpression< E > &e)
Subtracts the matrix expression e from this transpose view.
Definition: MatrixExpression.hpp:1299
M::ValueType ValueType
The element value type of the wrapped matrix.
Definition: MatrixExpression.hpp:1128
MatrixTranspose(MatrixType &m)
Constructs the transpose view proxy referring to m.
Definition: MatrixExpression.hpp:1163
SizeType getSize1() const
Returns the number of rows of the transpose view (= number of columns of the wrapped matrix).
Definition: MatrixExpression.hpp:1192
M::SizeType SizeType
The size type used by the wrapped matrix.
Definition: MatrixExpression.hpp:1118
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Mutable element reference type (degrades to ConstReference when the wrapped matrix is const).
Definition: MatrixExpression.hpp:1140
MatrixTranspose & operator=(const MatrixTranspose &mt)
Copy-assigns the wrapped matrix from the contents of mt's wrapped matrix.
Definition: MatrixExpression.hpp:1247
M::DifferenceType DifferenceType
The signed difference type used by the wrapped matrix.
Definition: MatrixExpression.hpp:1123
MatrixTranspose & minusAssign(const MatrixExpression< E > &e)
Subtracts the matrix expression e from this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1364
MatrixTranspose & operator=(const MatrixExpression< E > &e)
Assigns the matrix expression e to this transpose view (writes the transpose into the wrapped matrix)...
Definition: MatrixExpression.hpp:1273
MatrixTranspose & operator=(const MatrixTranspose< M1 > &mt)
Assigns the wrapped matrix from mt's wrapped matrix (possibly differing types).
Definition: MatrixExpression.hpp:1260
SizeType getSize2() const
Returns the number of columns of the transpose view (= number of rows of the wrapped matrix).
Definition: MatrixExpression.hpp:1201
ConstReference operator()(SizeType i, SizeType j) const
Returns a const reference to the wrapped matrix's element at (j, i).
Definition: MatrixExpression.hpp:1183
Reference operator()(SizeType i, SizeType j)
Returns a mutable reference to the wrapped matrix's element at (j, i).
Definition: MatrixExpression.hpp:1172
M MatrixType
The wrapped matrix type.
Definition: MatrixExpression.hpp:1113
MatrixTranspose & plusAssign(const MatrixExpression< E > &e)
Adds the matrix expression e to this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1351
friend void swap(MatrixTranspose &mt1, MatrixTranspose &mt2)
ADL-enabled free-function form of swap().
Definition: MatrixExpression.hpp:1384
const SelfType ConstClosureType
Constant closure type used when this proxy appears inside another expression.
Definition: MatrixExpression.hpp:1152
MatrixTranspose & operator+=(const MatrixExpression< E > &e)
Adds the matrix expression e to this transpose view.
Definition: MatrixExpression.hpp:1286
bool isEmpty() const
Tells whether the view is empty (the wrapped matrix has zero rows or zero columns).
Definition: MatrixExpression.hpp:1219
MatrixClosureType & getData()
Returns a reference to the wrapped matrix (via its stored closure).
Definition: MatrixExpression.hpp:1228
const MatrixClosureType & getData() const
Returns a const reference to the wrapped matrix (via its stored closure).
Definition: MatrixExpression.hpp:1237
MatrixTranspose & assign(const MatrixExpression< E > &e)
Assigns the matrix expression e to this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1338
Expression template node applying a unary functor F element-wise to a matrix expression E.
Definition: MatrixExpression.hpp:58
E::DifferenceType DifferenceType
The signed difference type inherited from the wrapped expression.
Definition: MatrixExpression.hpp:99
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:84
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:74
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:79
MatrixUnary(const ExpressionType &e)
Constructs the expression template node wrapping e.
Definition: MatrixExpression.hpp:105
SizeType getSize2() const
Returns the wrapped expression's number of columns.
Definition: MatrixExpression.hpp:121
SizeType getSize1() const
Returns the wrapped expression's number of rows.
Definition: MatrixExpression.hpp:112
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:69
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:89
E::SizeType SizeType
The size type inherited from the wrapped expression.
Definition: MatrixExpression.hpp:94
ConstReference operator()(SizeType i, SizeType j) const
Applies the unary functor to element (i, j) of the wrapped expression and returns the result.
Definition: MatrixExpression.hpp:132
Expression template node combining a scalar E1 (lhs) and a matrix expression E2 (rhs) element-wise vi...
Definition: MatrixExpression.hpp:875
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:893
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:898
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:908
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:888
SizeType getSize1() const
Returns the wrapped matrix expression's number of rows.
Definition: MatrixExpression.hpp:932
Scalar1MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the scalar e1 and the matrix expression e2.
Definition: MatrixExpression.hpp:925
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:903
E2::SizeType SizeType
The size type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:913
E2::DifferenceType DifferenceType
The signed difference type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:918
ConstReference operator()(SizeType i, SizeType j) const
Applies the binary functor to the scalar and the element at (i, j) of the wrapped matrix expression a...
Definition: MatrixExpression.hpp:952
SizeType getSize2() const
Returns the wrapped matrix expression's number of columns.
Definition: MatrixExpression.hpp:941
Expression template node combining a matrix expression E1 (lhs) and a scalar E2 (rhs) element-wise vi...
Definition: MatrixExpression.hpp:991
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:1019
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:1024
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:1014
Scalar2MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node combining the matrix expression e1 and the scalar e2.
Definition: MatrixExpression.hpp:1041
E1::SizeType SizeType
The size type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:1029
E1::DifferenceType DifferenceType
The signed difference type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:1034
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:1004
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:1009
ConstReference operator()(SizeType i, SizeType j) const
Applies the binary functor to the element at (i, j) of the wrapped matrix expression and the scalar a...
Definition: MatrixExpression.hpp:1068
SizeType getSize1() const
Returns the wrapped matrix expression's number of rows.
Definition: MatrixExpression.hpp:1048
SizeType getSize2() const
Returns the wrapped matrix expression's number of columns.
Definition: MatrixExpression.hpp:1057
Refinement of Math::VectorExpression marking the derived type as a concrete (writable) vector contain...
Definition: Expression.hpp:225
CRTP base class of all vector expression types.
Definition: Expression.hpp:68
Expression template node interpreting a binary combination of two vector expressions as a matrix (e....
Definition: MatrixExpression.hpp:519
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:532
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:552
VectorMatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:569
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:542
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped vector expressions.
Definition: MatrixExpression.hpp:562
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:547
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:537
ConstReference operator()(SizeType i, SizeType j) const
Applies the binary functor to e1(i) and e2(j) to produce the matrix element at (i,...
Definition: MatrixExpression.hpp:596
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped vector expressions.
Definition: MatrixExpression.hpp:557
SizeType getSize1() const
Returns the first wrapped vector expression's size (number of rows of the resulting matrix view).
Definition: MatrixExpression.hpp:576
SizeType getSize2() const
Returns the second wrapped vector expression's size (number of columns of the resulting matrix view).
Definition: MatrixExpression.hpp:585
Expression template node interpreting a vector expression E as a column matrix via the per-element fu...
Definition: MatrixExpression.hpp:168
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:194
SizeType getSize2() const
Returns the wrapped vector expression's size (used as the number of columns of the resulting matrix v...
Definition: MatrixExpression.hpp:231
E::DifferenceType DifferenceType
The signed difference type inherited from the wrapped vector expression.
Definition: MatrixExpression.hpp:209
ConstReference operator()(SizeType i, SizeType j) const
Applies the functor to the wrapped vector expression and the index pair (i, j) to produce the matrix ...
Definition: MatrixExpression.hpp:242
const ValueType ConstReference
Constant element reference type.
Definition: MatrixExpression.hpp:184
SizeType getSize1() const
Returns the wrapped vector expression's size (used as the number of rows of the resulting matrix view...
Definition: MatrixExpression.hpp:222
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:179
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:199
const ValueType Reference
Mutable element reference type (degrades to const for expression template results).
Definition: MatrixExpression.hpp:189
E::SizeType SizeType
The size type inherited from the wrapped vector expression.
Definition: MatrixExpression.hpp:204
VectorMatrixUnary(const ExpressionType &e)
Constructs the expression template node wrapping the vector expression e.
Definition: MatrixExpression.hpp:215
constexpr unsigned int M
Generic type that covers any element that is a metal.
Definition: AtomType.hpp:657
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
constexpr unsigned int F
Specifies Fluorine.
Definition: AtomType.hpp:107
constexpr unsigned int C
Specifies Carbon.
Definition: AtomType.hpp:92
constexpr unsigned int E
Specifies that the stereocenter has E configuration.
Definition: CIPDescriptor.hpp:96
constexpr unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
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
MatrixTranspose< E > trans(MatrixExpression< E > &e)
Returns a mutable Math::MatrixTranspose view of the matrix expression e.
Definition: MatrixExpression.hpp:1943
MatrixTrace< E >::ResultType trace(const MatrixExpression< E > &e)
Returns the trace (sum of diagonal elements) of the matrix expression e.
Definition: MatrixExpression.hpp:1862
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType herm(const GridExpression< E > &e)
Returns the Hermitian conjugate of the grid expression e (alias of conj() for grids).
Definition: GridExpression.hpp:737
VectorMatrixUnaryTraits< E, CrossProductMatrixFromVector< E > >::ResultType cross(const VectorExpression< E > &e)
Returns the cross-product (skew-symmetric) matrix corresponding to the 3D vector expression e (such t...
Definition: MatrixExpression.hpp:1929
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
VectorMatrixUnaryTraits< E, DiagonalMatrixFromVector< E > >::ResultType diag(const VectorExpression< E > &e)
Returns a diagonal matrix whose diagonal entries are the components of the vector expression e.
Definition: MatrixExpression.hpp:1914
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
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
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
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, ScalarImaginary< typename E::ValueType > >::ResultType imag(const GridExpression< E > &e)
Returns the element-wise imaginary part of the grid expression e.
Definition: GridExpression.hpp:767
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Returns the L∞ (maximum absolute row sum) norm of the matrix expression e.
Definition: MatrixExpression.hpp:1901
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
VectorMatrixBinaryTraits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType outerProd(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Returns the outer product of the vector expressions e1 and e2 as a matrix expression .
Definition: MatrixExpression.hpp:1660
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Returns the sum of all elements of the grid expression e.
Definition: GridExpression.hpp:818
MatrixNorm1< E >::ResultType norm1(const MatrixExpression< E > &e)
Returns the L1 (maximum absolute column sum) norm of the matrix expression e.
Definition: MatrixExpression.hpp:1875
const E & operator+(const GridExpression< E > &e)
Returns the grid expression e unchanged (unary +).
Definition: GridExpression.hpp:572
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType prod(const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Returns the matrix-vector product as a vector expression (named-function form of operator*).
Definition: MatrixExpression.hpp:1731
MatrixNormFrobenius< E >::ResultType normFrob(const MatrixExpression< E > &e)
Returns the Frobenius norm of the matrix expression e ( ).
Definition: MatrixExpression.hpp:1888
The namespace of the Chemical Data Processing Library.
std::common_type< T1, T2 >::type Type
The common type.
Definition: CommonType.hpp:51
Traits selecting the expression template node and its result type for the Math::Matrix1VectorBinary i...
Definition: MatrixExpression.hpp:734
Matrix1VectorBinary< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:739
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:744
Traits selecting the expression template node and its result type for the Math::Matrix2VectorBinary i...
Definition: MatrixExpression.hpp:854
Matrix2VectorBinary< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:859
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:864
Traits selecting the expression template node and its result type for the Math::MatrixBinary1 instant...
Definition: MatrixExpression.hpp:376
MatrixBinary1< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:381
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:386
Traits selecting the expression template node and its result type for the Math::MatrixBinary2 instant...
Definition: MatrixExpression.hpp:497
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:507
MatrixBinary2< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:502
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1117
static ResultType apply(const MatrixExpression< M > &e)
Returns the element sum of e.
Definition: Functional.hpp:1124
MatrixBooleanBinaryFunctor< M1, M2 >::ResultType ResultType
Definition: Functional.hpp:996
static ResultType apply(const MatrixExpression< M1 > &e1, const MatrixExpression< M2 > &e2)
Tells whether e1 and e2 have the same dimensions and equal element values.
Definition: Functional.hpp:1004
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1204
static ResultType apply(const MatrixExpression< M > &e)
Returns the L1 norm of e.
Definition: Functional.hpp:1211
static ResultType apply(const MatrixExpression< M > &e)
Returns the Frobenius norm of e.
Definition: Functional.hpp:1250
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1243
static ResultType apply(const MatrixExpression< M > &e)
Returns the L∞ norm of e.
Definition: Functional.hpp:1287
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1280
Selects a concrete temporary matrix type compatible with the matrix expression M.
Definition: TypeTraits.hpp:337
static ResultType apply(const MatrixExpression< M1 > &e1, const MatrixExpression< M2 > &e2, Argument3Type epsilon)
Tells whether e1 and e2 agree element-wise within the absolute tolerance epsilon.
Definition: Functional.hpp:1074
Scalar3MatrixBooleanTernaryFunctor< M1, M2, T >::ResultType ResultType
Definition: Functional.hpp:1064
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1148
static ResultType apply(const MatrixExpression< M > &e)
Returns the trace of e.
Definition: Functional.hpp:1156
Traits selecting the expression template node and its result type for the Math::MatrixUnary instantia...
Definition: MatrixExpression.hpp:148
MatrixUnary< E, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:153
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:158
Traits selecting the expression template node and its result type for the Math::Scalar1MatrixBinary i...
Definition: MatrixExpression.hpp:970
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:980
Scalar1MatrixBinary< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:975
Traits selecting the expression template node and its result type for the Math::Scalar2MatrixBinary i...
Definition: MatrixExpression.hpp:1086
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:1096
Scalar2MatrixBinary< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:1091
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
Scalar binary subtraction functor: apply(t1, t2) returns t1 - t2.
Definition: Functional.hpp:398
Traits selecting the expression template node and its result type for the Math::VectorMatrixBinary in...
Definition: MatrixExpression.hpp:614
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:624
VectorMatrixBinary< E1, E2, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:619
Traits selecting the expression template node and its result type for the Math::VectorMatrixUnary ins...
Definition: MatrixExpression.hpp:258
VectorMatrixUnary< E, F > ExpressionType
The expression template node type.
Definition: MatrixExpression.hpp:263
ExpressionType ResultType
The expression template result type returned by free-function operators.
Definition: MatrixExpression.hpp:268
Selects a concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:323