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:
67  typedef typename F::ResultType ValueType;
69  typedef const ValueType ConstReference;
71  typedef const ValueType Reference;
73  typedef const SelfType ConstClosureType;
77  typedef typename E::SizeType SizeType;
79  typedef typename E::DifferenceType DifferenceType;
80 
86  expr(e) {}
87 
93  {
94  return expr.getSize1();
95  }
96 
102  {
103  return expr.getSize2();
104  }
105 
113  {
114  return FunctorType::apply(expr(i, j));
115  }
116 
117  private:
118  ExpressionClosureType expr;
119  };
120 
126  template <typename E, typename F>
128  {
129 
134  };
135 
141  template <typename E, typename F>
142  class VectorMatrixUnary : public MatrixExpression<VectorMatrixUnary<E, F> >
143  {
144 
146  typedef F FunctorType;
147  typedef E ExpressionType;
148  typedef typename E::ConstClosureType ExpressionClosureType;
149 
150  public:
152  typedef typename F::ResultType ValueType;
154  typedef const ValueType ConstReference;
156  typedef const ValueType Reference;
158  typedef const SelfType ConstClosureType;
162  typedef typename E::SizeType SizeType;
164  typedef typename E::DifferenceType DifferenceType;
165 
171  expr(e) {}
172 
178  {
179  return expr.getSize();
180  }
181 
187  {
188  return expr.getSize();
189  }
190 
198  {
199  return FunctorType::apply(expr, i, j);
200  }
201 
202  private:
203  ExpressionClosureType expr;
204  };
205 
211  template <typename E, typename F>
213  {
214 
219  };
220 
227  template <typename E1, typename E2, typename F>
228  class MatrixBinary1 : public MatrixExpression<MatrixBinary1<E1, E2, F> >
229  {
230 
232  typedef F FunctorType;
233  typedef E1 Expression1Type;
234  typedef E2 Expression2Type;
235  typedef typename E1::ConstClosureType Expression1ClosureType;
236  typedef typename E2::ConstClosureType Expression2ClosureType;
237 
238  public:
240  typedef typename F::ResultType ValueType;
242  typedef const ValueType ConstReference;
244  typedef const ValueType Reference;
246  typedef const SelfType ConstClosureType;
253 
259  MatrixBinary1(const Expression1Type& e1, const Expression2Type& e2):
260  expr1(e1), expr2(e2) {}
261 
268  {
269  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize1()), SizeType(expr2.getSize1()), Base::SizeError);
270  }
271 
278  {
279  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize2()), SizeType(expr2.getSize2()), Base::SizeError);
280  }
281 
289  {
290  return FunctorType::apply(expr1(i, j), expr2(i, j));
291  }
292 
293  private:
294  Expression1ClosureType expr1;
295  Expression2ClosureType expr2;
296  };
297 
304  template <typename E1, typename E2, typename F>
306  {
307 
312  };
313 
325  template <typename E1, typename E2, typename F>
326  class MatrixBinary2 : public MatrixExpression<MatrixBinary2<E1, E2, F> >
327  {
328 
330  typedef F FunctorType;
331  typedef E1 Expression1Type;
332  typedef E2 Expression2Type;
333  typedef typename E1::ConstClosureType Expression1ClosureType;
334  typedef typename E2::ConstClosureType Expression2ClosureType;
335 
336  public:
338  typedef typename F::ResultType ValueType;
340  typedef const ValueType ConstReference;
342  typedef const ValueType Reference;
344  typedef const SelfType ConstClosureType;
351 
357  MatrixBinary2(const Expression1Type& e1, const Expression2Type& e2):
358  expr1(e1), expr2(e2) {}
359 
365  {
366  return expr1.getSize1();
367  }
368 
374  {
375  return expr2.getSize2();
376  }
377 
385  {
386  return FunctorType::apply(expr1, expr2, i, j);
387  }
388 
389  private:
390  Expression1ClosureType expr1;
391  Expression2ClosureType expr2;
392  };
393 
400  template <typename E1, typename E2, typename F>
402  {
403 
408  };
409 
417  template <typename E1, typename E2, typename F>
418  class VectorMatrixBinary : public MatrixExpression<VectorMatrixBinary<E1, E2, F> >
419  {
420 
422  typedef F FunctorType;
423  typedef E1 Expression1Type;
424  typedef E2 Expression2Type;
425  typedef typename E1::ConstClosureType Expression1ClosureType;
426  typedef typename E2::ConstClosureType Expression2ClosureType;
427 
428  public:
430  typedef typename F::ResultType ValueType;
432  typedef const ValueType ConstReference;
434  typedef const ValueType Reference;
436  typedef const SelfType ConstClosureType;
443 
449  VectorMatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
450  expr1(e1), expr2(e2) {}
451 
457  {
458  return expr1.getSize();
459  }
460 
466  {
467  return expr2.getSize();
468  }
469 
477  {
478  return FunctorType::apply(expr1(i), expr2(j));
479  }
480 
481  private:
482  Expression1ClosureType expr1;
483  Expression2ClosureType expr2;
484  };
485 
492  template <typename E1, typename E2, typename F>
494  {
495 
500  };
501 
512  template <typename E1, typename E2, typename F>
513  class Matrix1VectorBinary : public VectorExpression<Matrix1VectorBinary<E1, E2, F> >
514  {
515 
517  typedef F FunctorType;
518  typedef E1 Expression1Type;
519  typedef E2 Expression2Type;
520  typedef typename E1::ConstClosureType Expression1ClosureType;
521  typedef typename E2::ConstClosureType Expression2ClosureType;
522 
523  public:
525  typedef typename F::ResultType ValueType;
527  typedef const ValueType ConstReference;
529  typedef const ValueType Reference;
531  typedef const SelfType ConstClosureType;
538 
544  Matrix1VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
545  expr1(e1), expr2(e2) {}
546 
552  {
553  return expr1.getSize1();
554  }
555 
562  {
563  return FunctorType::apply(expr1, expr2, i);
564  }
565 
572  {
573  return FunctorType::apply(expr1, expr2, i);
574  }
575 
576  private:
577  Expression1ClosureType expr1;
578  Expression2ClosureType expr2;
579  };
580 
587  template <typename E1, typename E2, typename F>
589  {
590 
595  };
596 
607  template <typename E1, typename E2, typename F>
608  class Matrix2VectorBinary : public VectorExpression<Matrix2VectorBinary<E1, E2, F> >
609  {
610 
612  typedef F FunctorType;
613  typedef E1 Expression1Type;
614  typedef E2 Expression2Type;
615  typedef typename E1::ConstClosureType Expression1ClosureType;
616  typedef typename E2::ConstClosureType Expression2ClosureType;
617 
618  public:
620  typedef typename F::ResultType ValueType;
622  typedef const ValueType ConstReference;
624  typedef const ValueType Reference;
626  typedef const SelfType ConstClosureType;
633 
639  Matrix2VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
640  expr1(e1), expr2(e2) {}
641 
647  {
648  return expr2.getSize2();
649  }
650 
657  {
658  return FunctorType::apply(expr1, expr2, i);
659  }
660 
667  {
668  return FunctorType::apply(expr1, expr2, i);
669  }
670 
671  private:
672  Expression1ClosureType expr1;
673  Expression2ClosureType expr2;
674  };
675 
682  template <typename E1, typename E2, typename F>
684  {
685 
690  };
691 
698  template <typename E1, typename E2, typename F>
699  class Scalar1MatrixBinary : public MatrixExpression<Scalar1MatrixBinary<E1, E2, F> >
700  {
701 
703  typedef F FunctorType;
704  typedef E1 Expression1Type;
705  typedef E2 Expression2Type;
706  typedef const E1 Expression1ClosureType;
707  typedef typename E2::ConstClosureType Expression2ClosureType;
708 
709  public:
711  typedef typename F::ResultType ValueType;
713  typedef const ValueType ConstReference;
715  typedef const ValueType Reference;
717  typedef const SelfType ConstClosureType;
721  typedef typename E2::SizeType SizeType;
723  typedef typename E2::DifferenceType DifferenceType;
724 
730  Scalar1MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
731  expr1(e1), expr2(e2) {}
732 
738  {
739  return expr2.getSize1();
740  }
741 
747  {
748  return expr2.getSize2();
749  }
750 
758  {
759  return FunctorType::apply(expr1, expr2(i, j));
760  }
761 
762  private:
763  Expression1ClosureType expr1;
764  Expression2ClosureType expr2;
765  };
766 
773  template <typename E1, typename E2, typename F>
775  {
776 
781  };
782 
789  template <typename E1, typename E2, typename F>
790  class Scalar2MatrixBinary : public MatrixExpression<Scalar2MatrixBinary<E1, E2, F> >
791  {
792 
794  typedef F FunctorType;
795  typedef E1 Expression1Type;
796  typedef E2 Expression2Type;
797  typedef typename E1::ConstClosureType Expression1ClosureType;
798  typedef const E2 Expression2ClosureType;
799 
800  public:
802  typedef typename F::ResultType ValueType;
804  typedef const ValueType ConstReference;
806  typedef const ValueType Reference;
808  typedef const SelfType ConstClosureType;
812  typedef typename E1::SizeType SizeType;
814  typedef typename E1::DifferenceType DifferenceType;
815 
821  Scalar2MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
822  expr1(e1), expr2(e2) {}
823 
829  {
830  return expr1.getSize1();
831  }
832 
838  {
839  return expr1.getSize2();
840  }
841 
849  {
850  return FunctorType::apply(expr1(i, j), expr2);
851  }
852 
853  private:
854  Expression1ClosureType expr1;
855  Expression2ClosureType expr2;
856  };
857 
864  template <typename E1, typename E2, typename F>
866  {
867 
872  };
873 
878  template <typename M>
879  class MatrixTranspose : public MatrixExpression<MatrixTranspose<M> >
880  {
881 
883 
884  public:
886  typedef M MatrixType;
888  typedef typename M::SizeType SizeType;
890  typedef typename M::DifferenceType DifferenceType;
892  typedef typename M::ValueType ValueType;
894  typedef typename M::ConstReference ConstReference;
896  typedef typename std::conditional<std::is_const<M>::value,
897  typename M::ConstReference,
898  typename M::Reference>::type Reference;
900  typedef typename std::conditional<std::is_const<M>::value,
901  typename M::ConstClosureType,
902  typename M::ClosureType>::type MatrixClosureType;
904  typedef const SelfType ConstClosureType;
907 
913  data(m) {}
914 
922  {
923  return data(j, i);
924  }
925 
933  {
934  return data(j, i);
935  }
936 
942  {
943  return data.getSize2();
944  }
945 
951  {
952  return data.getSize1();
953  }
954 
960  {
961  return data.getMaxSize();
962  }
963 
968  bool isEmpty() const
969  {
970  return (data.getSize1() == 0 || data.getSize2() == 0);
971  }
972 
978  {
979  return data;
980  }
981 
986  const MatrixClosureType& getData() const
987  {
988  return data;
989  }
990 
997  {
998  data.operator=(mt.data);
999  return *this;
1000  }
1001 
1008  template <typename M1>
1010  {
1011  data.operator=(mt.getData());
1012  return *this;
1013  }
1014 
1021  template <typename E>
1023  {
1024  data.operator=(MatrixTranspose<const E>(e()));
1025  return *this;
1026  }
1027 
1034  template <typename E>
1036  {
1037  data.operator+=(MatrixTranspose<const E>(e()));
1038  return *this;
1039  }
1040 
1047  template <typename E>
1049  {
1050  data.operator-=(MatrixTranspose<const E>(e()));
1051  return *this;
1052  }
1053 
1060  template <typename T>
1061  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator*=(const T& t)
1062  {
1063  data.operator*=(t);
1064  return *this;
1065  }
1066 
1073  template <typename T>
1074  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator/=(const T& t)
1075  {
1076  data.operator/=(t);
1077  return *this;
1078  }
1079 
1086  template <typename E>
1088  {
1089  data.assign((MatrixTranspose<const E>(e())));
1090  return *this;
1091  }
1092 
1099  template <typename E>
1101  {
1102  data.plusAssign((MatrixTranspose<const E>(e())));
1103  return *this;
1104  }
1105 
1112  template <typename E>
1114  {
1115  data.minusAssign((MatrixTranspose<const E>(e())));
1116  return *this;
1117  }
1118 
1124  {
1125  data.swap(mt.data);
1126  }
1127 
1133  friend void swap(MatrixTranspose& mt1, MatrixTranspose& mt2)
1134  {
1135  mt1.swap(mt2);
1136  }
1137 
1138  private:
1139  MatrixClosureType data;
1140  };
1141 
1146  template <typename M>
1148  {};
1149 
1154  template <typename M>
1156  {};
1157 
1162  template <typename M>
1164  {};
1165 
1170  template <typename M>
1172  {};
1173 
1180  template <typename E>
1183  {
1184  typedef typename MatrixUnaryTraits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
1185 
1186  return ExpressionType(e());
1187  }
1188 
1195  template <typename E>
1196  const E&
1198  {
1199  return e();
1200  }
1201 
1210  template <typename E1, typename E2>
1211  typename MatrixBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
1213  {
1214  typedef typename MatrixBinary1Traits<E1, E2,
1215  ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1216 
1217  return ExpressionType(e1(), e2());
1218  }
1219 
1228  template <typename E1, typename E2>
1229  typename MatrixBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
1231  {
1232  typedef typename MatrixBinary1Traits<E1, E2,
1234 
1235  return ExpressionType(e1(), e2());
1236  }
1237 
1246  template <typename E, typename T>
1247  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
1248  operator*(const MatrixExpression<E>& e, const T& t)
1249  {
1250  typedef typename Scalar2MatrixBinaryTraits<E, T,
1251  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
1252 
1253  return ExpressionType(e(), t);
1254  }
1255 
1264  template <typename T, typename E>
1265  typename std::enable_if<IsScalar<T>::value, typename Scalar1MatrixBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
1266  operator*(const T& t, const MatrixExpression<E>& e)
1267  {
1268  typedef typename Scalar1MatrixBinaryTraits<T, E,
1269  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
1270 
1271  return ExpressionType(t, e());
1272  }
1273 
1282  template <typename E, typename T>
1283  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
1284  operator/(const MatrixExpression<E>& e, const T& t)
1285  {
1286  typedef typename Scalar2MatrixBinaryTraits<E, T,
1287  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
1288 
1289  return ExpressionType(e(), t);
1290  }
1291 
1300  template <typename E1, typename E2>
1303  {
1304  return MatrixEquality<E1, E2>::apply(e1, e2);
1305  }
1306 
1315  template <typename E1, typename E2>
1318  {
1319  return !MatrixEquality<E1, E2>::apply(e1, e2);
1320  }
1321 
1332  template <typename E1, typename E2, typename T>
1333  typename std::enable_if<std::is_arithmetic<T>::value, typename MatrixToleranceEquality<E1, E2, T>::ResultType>::type
1334  equals(const MatrixExpression<E1>& e1, const MatrixExpression<E2>& e2, const T& eps)
1335  {
1336  return MatrixToleranceEquality<E1, E2, T>::apply(e1, e2, eps);
1337  }
1338 
1345  template <typename E>
1346  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
1348  {
1349  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
1350 
1351  return ExpressionType(e());
1352  }
1353 
1360  template <typename E>
1361  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
1363  {
1364  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
1365 
1366  return ExpressionType(e());
1367  }
1368 
1375  template <typename E>
1376  typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
1378  {
1379  typedef typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ExpressionType ExpressionType;
1380 
1381  return ExpressionType(e());
1382  }
1383 
1390  template <typename E>
1391  typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
1393  {
1394  typedef typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ExpressionType ExpressionType;
1395 
1396  return ExpressionType(e());
1397  }
1398 
1407  template <typename E1, typename E2>
1408  typename VectorMatrixBinaryTraits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1410  {
1411  typedef typename VectorMatrixBinaryTraits<E1, E2,
1413 
1414  return ExpressionType(e1(), e2());
1415  }
1416 
1425  template <typename E1, typename E2>
1426  typename MatrixBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
1428  {
1429  typedef typename MatrixBinary1Traits<E1, E2,
1430  ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ExpressionType ExpressionType;
1431 
1432  return ExpressionType(e1(), e2());
1433  }
1434 
1443  template <typename E1, typename E2>
1444  typename MatrixBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
1446  {
1447  typedef typename MatrixBinary1Traits<E1, E2,
1449 
1450  return ExpressionType(e1(), e2());
1451  }
1452 
1461  template <typename E1, typename E2>
1462  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
1464  {
1465  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
1466 
1467  return ExpressionType(e1(), e2());
1468  }
1469 
1478  template <typename E1, typename E2>
1479  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
1481  {
1482  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
1483 
1484  return ExpressionType(e1(), e2());
1485  }
1486 
1497  template <typename C, typename E1, typename E2>
1499  {
1500  return c().assign(prod(e1, e2));
1501  }
1502 
1511  template <typename E1, typename E2>
1512  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
1514  {
1515  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1516 
1517  return ExpressionType(e1(), e2());
1518  }
1519 
1528  template <typename E1, typename E2>
1529  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
1531  {
1532  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1533 
1534  return ExpressionType(e1(), e2());
1535  }
1536 
1547  template <typename C, typename E1, typename E2>
1549  {
1550  return c().assign(prod(e1, e2));
1551  }
1552 
1561  template <typename E1, typename E2>
1562  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
1564  {
1565  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1566 
1567  return ExpressionType(e1(), e2());
1568  }
1569 
1578  template <typename E1, typename E2>
1579  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
1581  {
1582  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
1583 
1584  return ExpressionType(e1(), e2());
1585  }
1586 
1597  template <typename C, typename E1, typename E2>
1599  {
1600  return c().assign(prod(e1, e2));
1601  }
1602 
1609  template <typename E>
1612  {
1613  return MatrixTrace<E>::apply(e);
1614  }
1615 
1622  template <typename E>
1625  {
1626  return MatrixNorm1<E>::apply(e);
1627  }
1628 
1635  template <typename E>
1638  {
1640  }
1641 
1648  template <typename E>
1651  {
1652  return MatrixNormInfinity<E>::apply(e);
1653  }
1654 
1661  template <typename E>
1662  typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ResultType
1664  {
1665  typedef typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ExpressionType ExpressionType;
1666 
1667  return ExpressionType(e());
1668  }
1669 
1676  template <typename E>
1677  typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ResultType
1679  {
1680  typedef typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ExpressionType ExpressionType;
1681 
1682  return ExpressionType(e());
1683  }
1684 
1691  template <typename E>
1693  {
1694  return MatrixTranspose<E>(e());
1695  }
1696 
1703  template <typename E>
1705  {
1706  return MatrixTranspose<const E>(e());
1707  }
1708 
1715  template <typename E>
1718  {
1719  return MatrixElementSum<E>::apply(e);
1720  }
1721  } // namespace Math
1722 } // namespace CDPL
1723 
1724 #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 (made available to expression-template machinery).
Definition: Expression.hpp:47
Expression-template node interpreting a binary combination of a matrix expression E1 and a vector exp...
Definition: MatrixExpression.hpp:514
SizeType getSize() const
Returns the wrapped matrix expression's first-dimension size (number of rows = size of the result vec...
Definition: MatrixExpression.hpp:551
ConstReference operator[](SizeType i) const
Alias for operator() — invokes the functor with the matrix expression, the vector expression,...
Definition: MatrixExpression.hpp:571
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:531
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:525
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:527
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:533
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the wrapped matrix and vector expressions.
Definition: MatrixExpression.hpp:537
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the wrapped matrix and vector expressions.
Definition: MatrixExpression.hpp:535
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:529
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:544
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:561
Expression-template node interpreting a binary combination of a vector expression E1 and a matrix exp...
Definition: MatrixExpression.hpp:609
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:656
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:622
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:620
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the wrapped vector and matrix expressions.
Definition: MatrixExpression.hpp:630
ConstReference operator[](SizeType i) const
Alias for operator() — invokes the functor with the vector expression, the matrix expression,...
Definition: MatrixExpression.hpp:666
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the wrapped vector and matrix expressions.
Definition: MatrixExpression.hpp:632
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:628
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:626
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:624
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:639
SizeType getSize() const
Returns the wrapped matrix expression's second-dimension size (number of columns = size of the result...
Definition: MatrixExpression.hpp:646
Expression-template node combining two matrix expressions E1 and E2 element-wise via the binary funct...
Definition: MatrixExpression.hpp:229
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:248
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped expressions.
Definition: MatrixExpression.hpp:250
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:244
SizeType getSize1() const
Returns the number of rows after verifying that both wrapped expressions agree on it.
Definition: MatrixExpression.hpp:267
SizeType getSize2() const
Returns the number of columns after verifying that both wrapped expressions agree on it.
Definition: MatrixExpression.hpp:277
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:288
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:246
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped expressions.
Definition: MatrixExpression.hpp:252
MatrixBinary1(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:259
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:242
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:240
Expression-template node combining two matrix expressions E1 and E2 via a binary functor F that is in...
Definition: MatrixExpression.hpp:327
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:340
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:344
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:342
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:346
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped expressions.
Definition: MatrixExpression.hpp:350
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:384
MatrixBinary2(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:357
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:338
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped expressions.
Definition: MatrixExpression.hpp:348
SizeType getSize1() const
Returns the first wrapped expression's first-dimension size (number of rows of the result).
Definition: MatrixExpression.hpp:364
SizeType getSize2() const
Returns the second wrapped expression's second-dimension size (number of columns of the result).
Definition: MatrixExpression.hpp:373
Refinement of Math::MatrixExpression marking the derived type as a concrete (writable) matrix contain...
Definition: Expression.hpp:250
CRTP base class for all matrix expression types.
Definition: Expression.hpp:104
Mutable view adapter that exposes the transpose of a matrix M as a matrix expression ( ).
Definition: MatrixExpression.hpp:880
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:902
M::ConstReference ConstReference
Constant reference type to an element.
Definition: MatrixExpression.hpp:894
SizeType getMaxSize() const
Returns the maximum number of elements the wrapped matrix can hold.
Definition: MatrixExpression.hpp:959
void swap(MatrixTranspose &mt)
Swaps the underlying matrices of the two transpose views.
Definition: MatrixExpression.hpp:1123
SelfType ClosureType
Closure type used when this proxy appears inside another expression.
Definition: MatrixExpression.hpp:906
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:1074
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:1061
MatrixTranspose & operator-=(const MatrixExpression< E > &e)
Subtracts the matrix expression e from this transpose view.
Definition: MatrixExpression.hpp:1048
M::ValueType ValueType
The element value type of the wrapped matrix.
Definition: MatrixExpression.hpp:892
MatrixTranspose(MatrixType &m)
Constructs the transpose view proxy referring to m.
Definition: MatrixExpression.hpp:912
SizeType getSize1() const
Returns the number of rows of the transpose view (= number of columns of the wrapped matrix).
Definition: MatrixExpression.hpp:941
M::SizeType SizeType
The size type used by the wrapped matrix.
Definition: MatrixExpression.hpp:888
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Mutable reference type (degrades to ConstReference when the wrapped matrix is const).
Definition: MatrixExpression.hpp:898
MatrixTranspose & operator=(const MatrixTranspose &mt)
Copy-assigns the wrapped matrix from the contents of mt's wrapped matrix.
Definition: MatrixExpression.hpp:996
M::DifferenceType DifferenceType
The signed difference type used by the wrapped matrix.
Definition: MatrixExpression.hpp:890
MatrixTranspose & minusAssign(const MatrixExpression< E > &e)
Subtracts the matrix expression e from this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1113
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:1022
MatrixTranspose & operator=(const MatrixTranspose< M1 > &mt)
Assigns the wrapped matrix from mt's wrapped matrix (possibly differing types).
Definition: MatrixExpression.hpp:1009
SizeType getSize2() const
Returns the number of columns of the transpose view (= number of rows of the wrapped matrix).
Definition: MatrixExpression.hpp:950
ConstReference operator()(SizeType i, SizeType j) const
Returns a const reference to the wrapped matrix's element at (j, i).
Definition: MatrixExpression.hpp:932
Reference operator()(SizeType i, SizeType j)
Returns a mutable reference to the wrapped matrix's element at (j, i).
Definition: MatrixExpression.hpp:921
M MatrixType
The wrapped matrix type.
Definition: MatrixExpression.hpp:886
MatrixTranspose & plusAssign(const MatrixExpression< E > &e)
Adds the matrix expression e to this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1100
friend void swap(MatrixTranspose &mt1, MatrixTranspose &mt2)
ADL-enabled free-function form of swap().
Definition: MatrixExpression.hpp:1133
const SelfType ConstClosureType
Constant closure type used when this proxy appears inside another expression.
Definition: MatrixExpression.hpp:904
MatrixTranspose & operator+=(const MatrixExpression< E > &e)
Adds the matrix expression e to this transpose view.
Definition: MatrixExpression.hpp:1035
bool isEmpty() const
Tells whether the view is empty (the wrapped matrix has zero rows or zero columns).
Definition: MatrixExpression.hpp:968
MatrixClosureType & getData()
Returns a reference to the wrapped matrix (via its stored closure).
Definition: MatrixExpression.hpp:977
const MatrixClosureType & getData() const
Returns a const reference to the wrapped matrix (via its stored closure).
Definition: MatrixExpression.hpp:986
MatrixTranspose & assign(const MatrixExpression< E > &e)
Assigns the matrix expression e to this transpose view without intermediate temporary.
Definition: MatrixExpression.hpp:1087
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:79
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:73
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:69
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:71
MatrixUnary(const ExpressionType &e)
Constructs the expression-template node wrapping e.
Definition: MatrixExpression.hpp:85
SizeType getSize2() const
Returns the wrapped expression's second-dimension size.
Definition: MatrixExpression.hpp:101
SizeType getSize1() const
Returns the wrapped expression's first-dimension size.
Definition: MatrixExpression.hpp:92
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:67
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:75
E::SizeType SizeType
The size type inherited from the wrapped expression.
Definition: MatrixExpression.hpp:77
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:112
Expression-template node combining a scalar E1 (lhs) and a matrix expression E2 (rhs) element-wise vi...
Definition: MatrixExpression.hpp:700
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:713
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:715
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:719
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:711
SizeType getSize1() const
Returns the wrapped matrix expression's first-dimension size (number of rows).
Definition: MatrixExpression.hpp:737
Scalar1MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the scalar e1 and the matrix expression e2.
Definition: MatrixExpression.hpp:730
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:717
E2::SizeType SizeType
The size type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:721
E2::DifferenceType DifferenceType
The signed difference type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:723
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:757
SizeType getSize2() const
Returns the wrapped matrix expression's second-dimension size (number of columns).
Definition: MatrixExpression.hpp:746
Expression-template node combining a matrix expression E1 (lhs) and a scalar E2 (rhs) element-wise vi...
Definition: MatrixExpression.hpp:791
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:808
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:810
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:806
Scalar2MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node combining the matrix expression e1 and the scalar e2.
Definition: MatrixExpression.hpp:821
E1::SizeType SizeType
The size type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:812
E1::DifferenceType DifferenceType
The signed difference type inherited from the wrapped matrix expression.
Definition: MatrixExpression.hpp:814
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:802
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:804
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:848
SizeType getSize1() const
Returns the wrapped matrix expression's first-dimension size (number of rows).
Definition: MatrixExpression.hpp:828
SizeType getSize2() const
Returns the wrapped matrix expression's second-dimension size (number of columns).
Definition: MatrixExpression.hpp:837
Refinement of Math::VectorExpression marking the derived type as a concrete (writable) vector contain...
Definition: Expression.hpp:215
CRTP base class for all vector expression types.
Definition: Expression.hpp:66
Expression-template node interpreting a binary combination of two vector expressions as a matrix (e....
Definition: MatrixExpression.hpp:419
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:430
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:438
VectorMatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Constructs the expression-template node wrapping e1 and e2.
Definition: MatrixExpression.hpp:449
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:434
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
The common signed difference type of the two wrapped vector expressions.
Definition: MatrixExpression.hpp:442
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:436
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:432
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:476
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
The common size type of the two wrapped vector expressions.
Definition: MatrixExpression.hpp:440
SizeType getSize1() const
Returns the first wrapped vector expression's size (number of rows of the resulting matrix view).
Definition: MatrixExpression.hpp:456
SizeType getSize2() const
Returns the second wrapped vector expression's size (number of columns of the resulting matrix view).
Definition: MatrixExpression.hpp:465
Expression-template node interpreting a vector expression E as a column matrix via the per-element fu...
Definition: MatrixExpression.hpp:143
const SelfType ConstClosureType
Constant closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:158
SizeType getSize2() const
Returns the wrapped vector expression's size (used as the number of columns of the resulting matrix v...
Definition: MatrixExpression.hpp:186
E::DifferenceType DifferenceType
The signed difference type inherited from the wrapped vector expression.
Definition: MatrixExpression.hpp:164
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:197
const ValueType ConstReference
Constant reference type to an element value.
Definition: MatrixExpression.hpp:154
SizeType getSize1() const
Returns the wrapped vector expression's size (used as the number of rows of the resulting matrix view...
Definition: MatrixExpression.hpp:177
F::ResultType ValueType
The element value type of the expression (the functor's result type).
Definition: MatrixExpression.hpp:152
SelfType ClosureType
Closure type used when this expression appears inside another expression.
Definition: MatrixExpression.hpp:160
const ValueType Reference
Mutable reference type (degrades to const for expression-template results).
Definition: MatrixExpression.hpp:156
E::SizeType SizeType
The size type inherited from the wrapped vector expression.
Definition: MatrixExpression.hpp:162
VectorMatrixUnary(const ExpressionType &e)
Constructs the expression-template node wrapping the vector expression e.
Definition: MatrixExpression.hpp:170
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:704
MatrixTranspose< E > trans(MatrixExpression< E > &e)
Returns a mutable Math::MatrixTranspose view of the matrix expression e.
Definition: MatrixExpression.hpp:1692
MatrixTrace< E >::ResultType trace(const MatrixExpression< E > &e)
Returns the trace (sum of diagonal elements) of the matrix expression e.
Definition: MatrixExpression.hpp:1611
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:639
VectorMatrixUnaryTraits< E, CrossProductMatrixFromVector< E > >::ResultType cross(const VectorExpression< E > &e)
Returns the cross-product (skew-symmetric) matrix corresponding to the 3-vector expression e (such th...
Definition: MatrixExpression.hpp:1678
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType conj(const GridExpression< E > &e)
Returns the element-wise complex conjugate of the grid expression e (identity for real-valued grids).
Definition: GridExpression.hpp:624
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:1663
std::enable_if< std::is_arithmetic< T >::value, typename GridToleranceEquality< E1, E2, T >::ResultType >::type equals(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2, const T &eps)
Tells whether the grid expressions e1 and e2 agree element-wise within the absolute tolerance eps.
Definition: GridExpression.hpp:611
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type operator/(const GridExpression< E > &e, const T &t)
Returns the element-wise quotient of the grid expression e by the scalar t.
Definition: GridExpression.hpp:561
GridUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType real(const GridExpression< E > &e)
Returns the element-wise real part of the grid expression e.
Definition: GridExpression.hpp:654
GridEquality< E1, E2 >::ResultType operator!=(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Tells whether the grid expressions e1 and e2 differ in at least one element.
Definition: GridExpression.hpp:594
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Tells whether the grid expressions e1 and e2 are element-wise equal.
Definition: GridExpression.hpp:579
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type operator*(const GridExpression< E > &e, const T &t)
Returns the element-wise product of the grid expression e and the scalar t.
Definition: GridExpression.hpp:525
GridBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType elemDiv(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Returns the element-wise quotient of the grid expressions e1 and e2.
Definition: GridExpression.hpp:686
GridUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType imag(const GridExpression< E > &e)
Returns the element-wise imaginary part of the grid expression e.
Definition: GridExpression.hpp:669
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Returns the L∞ (maximum absolute row sum) norm of the matrix expression e.
Definition: MatrixExpression.hpp:1650
GridUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType operator-(const GridExpression< E > &e)
Returns the element-wise negation of the grid expression e.
Definition: GridExpression.hpp:458
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:1409
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Returns the sum of all elements of the grid expression e.
Definition: GridExpression.hpp:720
MatrixNorm1< E >::ResultType norm1(const MatrixExpression< E > &e)
Returns the L1 (maximum absolute column sum) norm of the matrix expression e.
Definition: MatrixExpression.hpp:1624
const E & operator+(const GridExpression< E > &e)
Returns the grid expression e unchanged (unary +).
Definition: GridExpression.hpp:474
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:1480
MatrixNormFrobenius< E >::ResultType normFrob(const MatrixExpression< E > &e)
Returns the Frobenius norm of the matrix expression e ( ).
Definition: MatrixExpression.hpp:1637
The namespace of the Chemical Data Processing Library.
std::common_type< T1, T2 >::type Type
The common type.
Definition: CommonType.hpp:49
Traits selecting the expression-template node and its result type for the Math::Matrix1VectorBinary i...
Definition: MatrixExpression.hpp:589
Matrix1VectorBinary< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:592
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:594
Traits selecting the expression-template node and its result type for the Math::Matrix2VectorBinary i...
Definition: MatrixExpression.hpp:684
Matrix2VectorBinary< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:687
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:689
Traits selecting the expression-template node and its result type for the Math::MatrixBinary1 instant...
Definition: MatrixExpression.hpp:306
MatrixBinary1< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:309
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:311
Traits selecting the expression-template node and its result type for the Math::MatrixBinary2 instant...
Definition: MatrixExpression.hpp:402
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:407
MatrixBinary2< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:405
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1023
static ResultType apply(const MatrixExpression< M > &e)
Returns the element sum of e.
Definition: Functional.hpp:1030
MatrixBooleanBinaryFunctor< M1, M2 >::ResultType ResultType
Definition: Functional.hpp:915
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:923
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1102
static ResultType apply(const MatrixExpression< M > &e)
Returns the L1 norm of e.
Definition: Functional.hpp:1109
static ResultType apply(const MatrixExpression< M > &e)
Returns the Frobenius norm of e.
Definition: Functional.hpp:1148
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1141
static ResultType apply(const MatrixExpression< M > &e)
Returns the L∞ norm of e.
Definition: Functional.hpp:1185
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1178
Selects a concrete temporary matrix type compatible with the matrix expression M.
Definition: TypeTraits.hpp:313
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:982
Scalar3MatrixBooleanTernaryFunctor< M1, M2, T >::ResultType ResultType
Definition: Functional.hpp:972
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:1054
static ResultType apply(const MatrixExpression< M > &e)
Returns the trace of e.
Definition: Functional.hpp:1062
Traits selecting the expression-template node and its result type for the Math::MatrixUnary instantia...
Definition: MatrixExpression.hpp:128
MatrixUnary< E, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:131
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:133
Traits selecting the expression-template node and its result type for the Math::Scalar1MatrixBinary i...
Definition: MatrixExpression.hpp:775
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:780
Scalar1MatrixBinary< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:778
Traits selecting the expression-template node and its result type for the Math::Scalar2MatrixBinary i...
Definition: MatrixExpression.hpp:866
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:871
Scalar2MatrixBinary< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:869
Scalar binary addition functor: apply(t1, t2) returns t1 + t2.
Definition: Functional.hpp:344
Scalar binary division functor: apply(t1, t2) returns t1 / t2.
Definition: Functional.hpp:419
Scalar binary multiplication functor: apply(t1, t2) returns t1 * t2.
Definition: Functional.hpp:394
Scalar binary subtraction functor: apply(t1, t2) returns t1 - t2.
Definition: Functional.hpp:369
Traits selecting the expression-template node and its result type for the Math::VectorMatrixBinary in...
Definition: MatrixExpression.hpp:494
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:499
VectorMatrixBinary< E1, E2, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:497
Traits selecting the expression-template node and its result type for the Math::VectorMatrixUnary ins...
Definition: MatrixExpression.hpp:213
VectorMatrixUnary< E, F > ExpressionType
The expression-template node type.
Definition: MatrixExpression.hpp:216
ExpressionType ResultType
The expression-template result type returned by free-function operators.
Definition: MatrixExpression.hpp:218
Selects a concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:301