Chemical Data Processing Library C++ API - Version 1.2.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 
51  template <typename E, typename F>
52  class MatrixUnary : public MatrixExpression<MatrixUnary<E, F> >
53  {
54 
56  typedef F FunctorType;
57  typedef E ExpressionType;
58  typedef typename E::ConstClosureType ExpressionClosureType;
59 
60  public:
61  typedef typename F::ResultType ValueType;
62  typedef const ValueType ConstReference;
63  typedef const ValueType Reference;
64  typedef const SelfType ConstClosureType;
66  typedef typename E::SizeType SizeType;
67  typedef typename E::DifferenceType DifferenceType;
68 
70  expr(e) {}
71 
73  {
74  return expr.getSize1();
75  }
76 
78  {
79  return expr.getSize2();
80  }
81 
83  {
84  return FunctorType::apply(expr(i, j));
85  }
86 
87  private:
88  ExpressionClosureType expr;
89  };
90 
91  template <typename E, typename F>
93  {
94 
97  };
98 
99  template <typename E, typename F>
100  class VectorMatrixUnary : public MatrixExpression<VectorMatrixUnary<E, F> >
101  {
102 
104  typedef F FunctorType;
105  typedef E ExpressionType;
106  typedef typename E::ConstClosureType ExpressionClosureType;
107 
108  public:
109  typedef typename F::ResultType ValueType;
110  typedef const ValueType ConstReference;
111  typedef const ValueType Reference;
112  typedef const SelfType ConstClosureType;
114  typedef typename E::SizeType SizeType;
115  typedef typename E::DifferenceType DifferenceType;
116 
118  expr(e) {}
119 
121  {
122  return expr.getSize();
123  }
124 
126  {
127  return expr.getSize();
128  }
129 
131  {
132  return FunctorType::apply(expr, i, j);
133  }
134 
135  private:
136  ExpressionClosureType expr;
137  };
138 
139  template <typename E, typename F>
141  {
142 
145  };
146 
147  template <typename E1, typename E2, typename F>
148  class MatrixBinary1 : public MatrixExpression<MatrixBinary1<E1, E2, F> >
149  {
150 
152  typedef F FunctorType;
153  typedef E1 Expression1Type;
154  typedef E2 Expression2Type;
155  typedef typename E1::ConstClosureType Expression1ClosureType;
156  typedef typename E2::ConstClosureType Expression2ClosureType;
157 
158  public:
159  typedef typename F::ResultType ValueType;
160  typedef const ValueType ConstReference;
161  typedef const ValueType Reference;
162  typedef const SelfType ConstClosureType;
166 
167  MatrixBinary1(const Expression1Type& e1, const Expression2Type& e2):
168  expr1(e1), expr2(e2) {}
169 
171  {
172  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize1()), SizeType(expr2.getSize1()), Base::SizeError);
173  }
174 
176  {
177  return CDPL_MATH_CHECK_SIZE_EQUALITY(SizeType(expr1.getSize2()), SizeType(expr2.getSize2()), Base::SizeError);
178  }
179 
181  {
182  return FunctorType::apply(expr1(i, j), expr2(i, j));
183  }
184 
185  private:
186  Expression1ClosureType expr1;
187  Expression2ClosureType expr2;
188  };
189 
190  template <typename E1, typename E2, typename F>
192  {
193 
196  };
197 
198  template <typename E1, typename E2, typename F>
199  class MatrixBinary2 : public MatrixExpression<MatrixBinary2<E1, E2, F> >
200  {
201 
203  typedef F FunctorType;
204  typedef E1 Expression1Type;
205  typedef E2 Expression2Type;
206  typedef typename E1::ConstClosureType Expression1ClosureType;
207  typedef typename E2::ConstClosureType Expression2ClosureType;
208 
209  public:
210  typedef typename F::ResultType ValueType;
211  typedef const ValueType ConstReference;
212  typedef const ValueType Reference;
213  typedef const SelfType ConstClosureType;
217 
218  MatrixBinary2(const Expression1Type& e1, const Expression2Type& e2):
219  expr1(e1), expr2(e2) {}
220 
222  {
223  return expr1.getSize1();
224  }
225 
227  {
228  return expr2.getSize2();
229  }
230 
232  {
233  return FunctorType::apply(expr1, expr2, i, j);
234  }
235 
236  private:
237  Expression1ClosureType expr1;
238  Expression2ClosureType expr2;
239  };
240 
241  template <typename E1, typename E2, typename F>
243  {
244 
247  };
248 
249  template <typename E1, typename E2, typename F>
250  class VectorMatrixBinary : public MatrixExpression<VectorMatrixBinary<E1, E2, F> >
251  {
252 
254  typedef F FunctorType;
255  typedef E1 Expression1Type;
256  typedef E2 Expression2Type;
257  typedef typename E1::ConstClosureType Expression1ClosureType;
258  typedef typename E2::ConstClosureType Expression2ClosureType;
259 
260  public:
261  typedef typename F::ResultType ValueType;
262  typedef const ValueType ConstReference;
263  typedef const ValueType Reference;
264  typedef const SelfType ConstClosureType;
268 
269  VectorMatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
270  expr1(e1), expr2(e2) {}
271 
273  {
274  return expr1.getSize();
275  }
276 
278  {
279  return expr2.getSize();
280  }
281 
283  {
284  return FunctorType::apply(expr1(i), expr2(j));
285  }
286 
287  private:
288  Expression1ClosureType expr1;
289  Expression2ClosureType expr2;
290  };
291 
292  template <typename E1, typename E2, typename F>
294  {
295 
298  };
299 
300  template <typename E1, typename E2, typename F>
301  class Matrix1VectorBinary : public VectorExpression<Matrix1VectorBinary<E1, E2, F> >
302  {
303 
305  typedef F FunctorType;
306  typedef E1 Expression1Type;
307  typedef E2 Expression2Type;
308  typedef typename E1::ConstClosureType Expression1ClosureType;
309  typedef typename E2::ConstClosureType Expression2ClosureType;
310 
311  public:
312  typedef typename F::ResultType ValueType;
313  typedef const ValueType ConstReference;
314  typedef const ValueType Reference;
315  typedef const SelfType ConstClosureType;
319 
320  Matrix1VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
321  expr1(e1), expr2(e2) {}
322 
324  {
325  return expr1.getSize1();
326  }
327 
329  {
330  return FunctorType::apply(expr1, expr2, i);
331  }
332 
334  {
335  return FunctorType::apply(expr1, expr2, i);
336  }
337 
338  private:
339  Expression1ClosureType expr1;
340  Expression2ClosureType expr2;
341  };
342 
343  template <typename E1, typename E2, typename F>
345  {
346 
349  };
350 
351  template <typename E1, typename E2, typename F>
352  class Matrix2VectorBinary : public VectorExpression<Matrix2VectorBinary<E1, E2, F> >
353  {
354 
356  typedef F FunctorType;
357  typedef E1 Expression1Type;
358  typedef E2 Expression2Type;
359  typedef typename E1::ConstClosureType Expression1ClosureType;
360  typedef typename E2::ConstClosureType Expression2ClosureType;
361 
362  public:
363  typedef typename F::ResultType ValueType;
364  typedef const ValueType ConstReference;
365  typedef const ValueType Reference;
366  typedef const SelfType ConstClosureType;
370 
371  Matrix2VectorBinary(const Expression1Type& e1, const Expression2Type& e2):
372  expr1(e1), expr2(e2) {}
373 
375  {
376  return expr2.getSize2();
377  }
378 
380  {
381  return FunctorType::apply(expr1, expr2, i);
382  }
383 
385  {
386  return FunctorType::apply(expr1, expr2, i);
387  }
388 
389  private:
390  Expression1ClosureType expr1;
391  Expression2ClosureType expr2;
392  };
393 
394  template <typename E1, typename E2, typename F>
396  {
397 
400  };
401 
402  template <typename E1, typename E2, typename F>
403  class Scalar1MatrixBinary : public MatrixExpression<Scalar1MatrixBinary<E1, E2, F> >
404  {
405 
407  typedef F FunctorType;
408  typedef E1 Expression1Type;
409  typedef E2 Expression2Type;
410  typedef const E1 Expression1ClosureType;
411  typedef typename E2::ConstClosureType Expression2ClosureType;
412 
413  public:
414  typedef typename F::ResultType ValueType;
415  typedef const ValueType ConstReference;
416  typedef const ValueType Reference;
417  typedef const SelfType ConstClosureType;
419  typedef typename E2::SizeType SizeType;
420  typedef typename E2::DifferenceType DifferenceType;
421 
422  Scalar1MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
423  expr1(e1), expr2(e2) {}
424 
426  {
427  return expr2.getSize1();
428  }
429 
431  {
432  return expr2.getSize2();
433  }
434 
436  {
437  return FunctorType::apply(expr1, expr2(i, j));
438  }
439 
440  private:
441  Expression1ClosureType expr1;
442  Expression2ClosureType expr2;
443  };
444 
445  template <typename E1, typename E2, typename F>
447  {
448 
451  };
452 
453  template <typename E1, typename E2, typename F>
454  class Scalar2MatrixBinary : public MatrixExpression<Scalar2MatrixBinary<E1, E2, F> >
455  {
456 
458  typedef F FunctorType;
459  typedef E1 Expression1Type;
460  typedef E2 Expression2Type;
461  typedef typename E1::ConstClosureType Expression1ClosureType;
462  typedef const E2 Expression2ClosureType;
463 
464  public:
465  typedef typename F::ResultType ValueType;
466  typedef const ValueType ConstReference;
467  typedef const ValueType Reference;
468  typedef const SelfType ConstClosureType;
470  typedef typename E1::SizeType SizeType;
471  typedef typename E1::DifferenceType DifferenceType;
472 
473  Scalar2MatrixBinary(const Expression1Type& e1, const Expression2Type& e2):
474  expr1(e1), expr2(e2) {}
475 
477  {
478  return expr1.getSize1();
479  }
480 
482  {
483  return expr1.getSize2();
484  }
485 
487  {
488  return FunctorType::apply(expr1(i, j), expr2);
489  }
490 
491  private:
492  Expression1ClosureType expr1;
493  Expression2ClosureType expr2;
494  };
495 
496  template <typename E1, typename E2, typename F>
498  {
499 
502  };
503 
504  template <typename M>
505  class MatrixTranspose : public MatrixExpression<MatrixTranspose<M> >
506  {
507 
509 
510  public:
511  typedef M MatrixType;
512  typedef typename M::SizeType SizeType;
513  typedef typename M::DifferenceType DifferenceType;
514  typedef typename M::ValueType ValueType;
515  typedef typename M::ConstReference ConstReference;
516  typedef typename std::conditional<std::is_const<M>::value,
517  typename M::ConstReference,
518  typename M::Reference>::type Reference;
519  typedef typename std::conditional<std::is_const<M>::value,
520  typename M::ConstClosureType,
521  typename M::ClosureType>::type MatrixClosureType;
522  typedef const SelfType ConstClosureType;
524 
526  data(m) {}
527 
529  {
530  return data(j, i);
531  }
532 
534  {
535  return data(j, i);
536  }
537 
539  {
540  return data.getSize2();
541  }
542 
544  {
545  return data.getSize1();
546  }
547 
549  {
550  return data.getMaxSize();
551  }
552 
553  bool isEmpty() const
554  {
555  return (data.getSize1() == 0 || data.getSize2() == 0);
556  }
557 
559  {
560  return data;
561  }
562 
563  const MatrixClosureType& getData() const
564  {
565  return data;
566  }
567 
569  {
570  data.operator=(mt.data);
571  return *this;
572  }
573 
574  template <typename M1>
576  {
577  data.operator=(mt.getData());
578  return *this;
579  }
580 
581  template <typename E>
583  {
584  data.operator=(MatrixTranspose<const E>(e()));
585  return *this;
586  }
587 
588  template <typename E>
590  {
591  data.operator+=(MatrixTranspose<const E>(e()));
592  return *this;
593  }
594 
595  template <typename E>
597  {
598  data.operator-=(MatrixTranspose<const E>(e()));
599  return *this;
600  }
601 
602  template <typename T>
603 
604  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator*=(const T& t)
605  {
606  data.operator*=(t);
607  return *this;
608  }
609 
610  template <typename T>
611 
612  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator/=(const T& t)
613  {
614  data.operator/=(t);
615  return *this;
616  }
617 
618  template <typename E>
620  {
621  data.assign((MatrixTranspose<const E>(e())));
622  return *this;
623  }
624 
625  template <typename E>
627  {
628  data.plusAssign((MatrixTranspose<const E>(e())));
629  return *this;
630  }
631 
632  template <typename E>
634  {
635  data.minusAssign((MatrixTranspose<const E>(e())));
636  return *this;
637  }
638 
640  {
641  data.swap(mt.data);
642  }
643 
644  friend void swap(MatrixTranspose& mt1, MatrixTranspose& mt2)
645  {
646  mt1.swap(mt2);
647  }
648 
649  private:
650  MatrixClosureType data;
651  };
652 
653  template <typename M>
655  {};
656 
657  template <typename M>
659  {};
660 
661  template <typename M>
663  {};
664 
665  template <typename M>
667  {};
668 
669  template <typename E>
672  {
673  typedef typename MatrixUnaryTraits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
674 
675  return ExpressionType(e());
676  }
677 
678  template <typename E>
679  const E&
681  {
682  return e();
683  }
684 
685  template <typename E1, typename E2>
686  typename MatrixBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
688  {
689  typedef typename MatrixBinary1Traits<E1, E2,
691 
692  return ExpressionType(e1(), e2());
693  }
694 
695  template <typename E1, typename E2>
696  typename MatrixBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
698  {
699  typedef typename MatrixBinary1Traits<E1, E2,
701 
702  return ExpressionType(e1(), e2());
703  }
704 
705  template <typename E, typename T>
706  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
707  operator*(const MatrixExpression<E>& e, const T& t)
708  {
709  typedef typename Scalar2MatrixBinaryTraits<E, T,
710  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
711 
712  return ExpressionType(e(), t);
713  }
714 
715  template <typename T, typename E>
716  typename std::enable_if<IsScalar<T>::value, typename Scalar1MatrixBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
717  operator*(const T& t, const MatrixExpression<E>& e)
718  {
719  typedef typename Scalar1MatrixBinaryTraits<T, E,
720  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
721 
722  return ExpressionType(t, e());
723  }
724 
725  template <typename E, typename T>
726  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
727  operator/(const MatrixExpression<E>& e, const T& t)
728  {
729  typedef typename Scalar2MatrixBinaryTraits<E, T,
730  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
731 
732  return ExpressionType(e(), t);
733  }
734 
735  template <typename E1, typename E2>
738  {
739  return MatrixEquality<E1, E2>::apply(e1, e2);
740  }
741 
742  template <typename E1, typename E2>
745  {
746  return !MatrixEquality<E1, E2>::apply(e1, e2);
747  }
748 
749  template <typename E1, typename E2, typename T>
750  typename std::enable_if<std::is_arithmetic<T>::value, typename MatrixToleranceEquality<E1, E2, T>::ResultType>::type
751  equals(const MatrixExpression<E1>& e1, const MatrixExpression<E2>& e2, const T& eps)
752  {
753  return MatrixToleranceEquality<E1, E2, T>::apply(e1, e2, eps);
754  }
755 
756  template <typename E>
757  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
759  {
760  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
761 
762  return ExpressionType(e());
763  }
764 
765  template <typename E>
766  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
768  {
769  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
770 
771  return ExpressionType(e());
772  }
773 
774  template <typename E>
775  typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
777  {
778  typedef typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ExpressionType ExpressionType;
779 
780  return ExpressionType(e());
781  }
782 
783  template <typename E>
784  typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
786  {
787  typedef typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ExpressionType ExpressionType;
788 
789  return ExpressionType(e());
790  }
791 
792  template <typename E1, typename E2>
793  typename VectorMatrixBinaryTraits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
795  {
796  typedef typename VectorMatrixBinaryTraits<E1, E2,
798 
799  return ExpressionType(e1(), e2());
800  }
801 
802  template <typename E1, typename E2>
803  typename MatrixBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
805  {
806  typedef typename MatrixBinary1Traits<E1, E2,
808 
809  return ExpressionType(e1(), e2());
810  }
811 
812  template <typename E1, typename E2>
813  typename MatrixBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
815  {
816  typedef typename MatrixBinary1Traits<E1, E2,
818 
819  return ExpressionType(e1(), e2());
820  }
821 
822  template <typename E1, typename E2>
823  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
825  {
826  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
827 
828  return ExpressionType(e1(), e2());
829  }
830 
831  template <typename E1, typename E2>
832  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
834  {
835  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
836 
837  return ExpressionType(e1(), e2());
838  }
839 
840  template <typename C, typename E1, typename E2>
842  {
843  return c().assign(prod(e1, e2));
844  }
845 
846  template <typename E1, typename E2>
847  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
849  {
850  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
851 
852  return ExpressionType(e1(), e2());
853  }
854 
855  template <typename E1, typename E2>
856  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
858  {
859  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
860 
861  return ExpressionType(e1(), e2());
862  }
863 
864  template <typename C, typename E1, typename E2>
866  {
867  return c().assign(prod(e1, e2));
868  }
869 
870  template <typename E1, typename E2>
871  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
873  {
874  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
875 
876  return ExpressionType(e1(), e2());
877  }
878 
879  template <typename E1, typename E2>
880  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
882  {
883  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
884 
885  return ExpressionType(e1(), e2());
886  }
887 
888  template <typename C, typename E1, typename E2>
890  {
891  return c().assign(prod(e1, e2));
892  }
893 
894  template <typename E>
897  {
898  return MatrixTrace<E>::apply(e);
899  }
900 
901  template <typename E>
904  {
905  return MatrixNorm1<E>::apply(e);
906  }
907 
908  template <typename E>
911  {
913  }
914 
915  template <typename E>
918  {
920  }
921 
922  template <typename E>
923  typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ResultType
925  {
926  typedef typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ExpressionType ExpressionType;
927 
928  return ExpressionType(e());
929  }
930 
931  template <typename E>
932  typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ResultType
934  {
935  typedef typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ExpressionType ExpressionType;
936 
937  return ExpressionType(e());
938  }
939 
940  template <typename E>
942  {
943  return MatrixTranspose<E>(e());
944  }
945 
946  template <typename E>
948  {
949  return MatrixTranspose<const E>(e());
950  }
951 
952  template <typename E>
955  {
956  return MatrixElementSum<E>::apply(e);
957  }
958  } // namespace Math
959 } // namespace CDPL
960 
961 #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)
Definition: Check.hpp:62
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
Definition: Expression.hpp:42
Definition: MatrixExpression.hpp:302
SizeType getSize() const
Definition: MatrixExpression.hpp:323
ConstReference operator[](SizeType i) const
Definition: MatrixExpression.hpp:333
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:315
F::ResultType ValueType
Definition: MatrixExpression.hpp:312
const ValueType ConstReference
Definition: MatrixExpression.hpp:313
SelfType ClosureType
Definition: MatrixExpression.hpp:316
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: MatrixExpression.hpp:318
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: MatrixExpression.hpp:317
const ValueType Reference
Definition: MatrixExpression.hpp:314
Matrix1VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:320
ConstReference operator()(SizeType i) const
Definition: MatrixExpression.hpp:328
Definition: MatrixExpression.hpp:353
ConstReference operator()(SizeType i) const
Definition: MatrixExpression.hpp:379
const ValueType ConstReference
Definition: MatrixExpression.hpp:364
F::ResultType ValueType
Definition: MatrixExpression.hpp:363
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: MatrixExpression.hpp:368
ConstReference operator[](SizeType i) const
Definition: MatrixExpression.hpp:384
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: MatrixExpression.hpp:369
SelfType ClosureType
Definition: MatrixExpression.hpp:367
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:366
const ValueType Reference
Definition: MatrixExpression.hpp:365
Matrix2VectorBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:371
SizeType getSize() const
Definition: MatrixExpression.hpp:374
Definition: MatrixExpression.hpp:149
SelfType ClosureType
Definition: MatrixExpression.hpp:163
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: MatrixExpression.hpp:164
const ValueType Reference
Definition: MatrixExpression.hpp:161
SizeType getSize1() const
Definition: MatrixExpression.hpp:170
SizeType getSize2() const
Definition: MatrixExpression.hpp:175
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:180
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:162
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: MatrixExpression.hpp:165
MatrixBinary1(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:167
const ValueType ConstReference
Definition: MatrixExpression.hpp:160
F::ResultType ValueType
Definition: MatrixExpression.hpp:159
Definition: MatrixExpression.hpp:200
const ValueType ConstReference
Definition: MatrixExpression.hpp:211
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:213
const ValueType Reference
Definition: MatrixExpression.hpp:212
SelfType ClosureType
Definition: MatrixExpression.hpp:214
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: MatrixExpression.hpp:216
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:231
MatrixBinary2(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:218
F::ResultType ValueType
Definition: MatrixExpression.hpp:210
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: MatrixExpression.hpp:215
SizeType getSize1() const
Definition: MatrixExpression.hpp:221
SizeType getSize2() const
Definition: MatrixExpression.hpp:226
Definition: Expression.hpp:164
Definition: Expression.hpp:76
Definition: MatrixExpression.hpp:506
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Definition: MatrixExpression.hpp:521
M::ConstReference ConstReference
Definition: MatrixExpression.hpp:515
SizeType getMaxSize() const
Definition: MatrixExpression.hpp:548
void swap(MatrixTranspose &mt)
Definition: MatrixExpression.hpp:639
SelfType ClosureType
Definition: MatrixExpression.hpp:523
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator/=(const T &t)
Definition: MatrixExpression.hpp:612
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator*=(const T &t)
Definition: MatrixExpression.hpp:604
MatrixTranspose & operator-=(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:596
M::ValueType ValueType
Definition: MatrixExpression.hpp:514
MatrixTranspose(MatrixType &m)
Definition: MatrixExpression.hpp:525
SizeType getSize1() const
Definition: MatrixExpression.hpp:538
M::SizeType SizeType
Definition: MatrixExpression.hpp:512
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Definition: MatrixExpression.hpp:518
MatrixTranspose & operator=(const MatrixTranspose &mt)
Definition: MatrixExpression.hpp:568
M::DifferenceType DifferenceType
Definition: MatrixExpression.hpp:513
MatrixTranspose & minusAssign(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:633
MatrixTranspose & operator=(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:582
MatrixTranspose & operator=(const MatrixTranspose< M1 > &mt)
Definition: MatrixExpression.hpp:575
SizeType getSize2() const
Definition: MatrixExpression.hpp:543
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:533
Reference operator()(SizeType i, SizeType j)
Definition: MatrixExpression.hpp:528
M MatrixType
Definition: MatrixExpression.hpp:511
MatrixTranspose & plusAssign(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:626
friend void swap(MatrixTranspose &mt1, MatrixTranspose &mt2)
Definition: MatrixExpression.hpp:644
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:522
MatrixTranspose & operator+=(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:589
bool isEmpty() const
Definition: MatrixExpression.hpp:553
MatrixClosureType & getData()
Definition: MatrixExpression.hpp:558
const MatrixClosureType & getData() const
Definition: MatrixExpression.hpp:563
MatrixTranspose & assign(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:619
Definition: MatrixExpression.hpp:53
E::DifferenceType DifferenceType
Definition: MatrixExpression.hpp:67
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:64
const ValueType ConstReference
Definition: MatrixExpression.hpp:62
const ValueType Reference
Definition: MatrixExpression.hpp:63
MatrixUnary(const ExpressionType &e)
Definition: MatrixExpression.hpp:69
SizeType getSize2() const
Definition: MatrixExpression.hpp:77
SizeType getSize1() const
Definition: MatrixExpression.hpp:72
F::ResultType ValueType
Definition: MatrixExpression.hpp:61
SelfType ClosureType
Definition: MatrixExpression.hpp:65
E::SizeType SizeType
Definition: MatrixExpression.hpp:66
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:82
Definition: MatrixExpression.hpp:404
const ValueType ConstReference
Definition: MatrixExpression.hpp:415
const ValueType Reference
Definition: MatrixExpression.hpp:416
SelfType ClosureType
Definition: MatrixExpression.hpp:418
F::ResultType ValueType
Definition: MatrixExpression.hpp:414
SizeType getSize1() const
Definition: MatrixExpression.hpp:425
Scalar1MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:422
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:417
E2::SizeType SizeType
Definition: MatrixExpression.hpp:419
E2::DifferenceType DifferenceType
Definition: MatrixExpression.hpp:420
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:435
SizeType getSize2() const
Definition: MatrixExpression.hpp:430
Definition: MatrixExpression.hpp:455
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:468
SelfType ClosureType
Definition: MatrixExpression.hpp:469
const ValueType Reference
Definition: MatrixExpression.hpp:467
Scalar2MatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:473
E1::SizeType SizeType
Definition: MatrixExpression.hpp:470
E1::DifferenceType DifferenceType
Definition: MatrixExpression.hpp:471
F::ResultType ValueType
Definition: MatrixExpression.hpp:465
const ValueType ConstReference
Definition: MatrixExpression.hpp:466
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:486
SizeType getSize1() const
Definition: MatrixExpression.hpp:476
SizeType getSize2() const
Definition: MatrixExpression.hpp:481
Definition: Expression.hpp:142
Definition: Expression.hpp:54
Definition: MatrixExpression.hpp:251
F::ResultType ValueType
Definition: MatrixExpression.hpp:261
SelfType ClosureType
Definition: MatrixExpression.hpp:265
VectorMatrixBinary(const Expression1Type &e1, const Expression2Type &e2)
Definition: MatrixExpression.hpp:269
const ValueType Reference
Definition: MatrixExpression.hpp:263
CommonType< typename E1::DifferenceType, typename E2::DifferenceType >::Type DifferenceType
Definition: MatrixExpression.hpp:267
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:264
const ValueType ConstReference
Definition: MatrixExpression.hpp:262
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:282
CommonType< typename E1::SizeType, typename E2::SizeType >::Type SizeType
Definition: MatrixExpression.hpp:266
SizeType getSize1() const
Definition: MatrixExpression.hpp:272
SizeType getSize2() const
Definition: MatrixExpression.hpp:277
Definition: MatrixExpression.hpp:101
const SelfType ConstClosureType
Definition: MatrixExpression.hpp:112
SizeType getSize2() const
Definition: MatrixExpression.hpp:125
E::DifferenceType DifferenceType
Definition: MatrixExpression.hpp:115
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixExpression.hpp:130
const ValueType ConstReference
Definition: MatrixExpression.hpp:110
SizeType getSize1() const
Definition: MatrixExpression.hpp:120
F::ResultType ValueType
Definition: MatrixExpression.hpp:109
SelfType ClosureType
Definition: MatrixExpression.hpp:113
const ValueType Reference
Definition: MatrixExpression.hpp:111
E::SizeType SizeType
Definition: MatrixExpression.hpp:114
VectorMatrixUnary(const ExpressionType &e)
Definition: MatrixExpression.hpp:117
constexpr unsigned int M
A 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)
Definition: GridExpression.hpp:406
MatrixTranspose< E > trans(MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:941
MatrixTrace< E >::ResultType trace(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:896
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType herm(const GridExpression< E > &e)
Definition: GridExpression.hpp:369
VectorMatrixUnaryTraits< E, CrossProductMatrixFromVector< E > >::ResultType cross(const VectorExpression< E > &e)
Definition: MatrixExpression.hpp:933
GridUnaryTraits< E, ScalarConjugation< typename E::ValueType > >::ResultType conj(const GridExpression< E > &e)
Definition: GridExpression.hpp:360
VectorMatrixUnaryTraits< E, DiagonalMatrixFromVector< E > >::ResultType diag(const VectorExpression< E > &e)
Definition: MatrixExpression.hpp:924
std::enable_if< std::is_arithmetic< T >::value, typename GridToleranceEquality< E1, E2, T >::ResultType >::type equals(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2, const T &eps)
Definition: GridExpression.hpp:353
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarDivision< typename E::ValueType, T > >::ResultType >::type operator/(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:329
GridUnaryTraits< E, ScalarReal< typename E::ValueType > >::ResultType real(const GridExpression< E > &e)
Definition: GridExpression.hpp:378
GridEquality< E1, E2 >::ResultType operator!=(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:346
GridEquality< E1, E2 >::ResultType operator==(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:339
std::enable_if< IsScalar< T >::value, typename Scalar2GridBinaryTraits< E, T, ScalarMultiplication< typename E::ValueType, T > >::ResultType >::type operator*(const GridExpression< E > &e, const T &t)
Definition: GridExpression.hpp:309
GridBinary1Traits< E1, E2, ScalarDivision< typename E1::ValueType, typename E2::ValueType > >::ResultType elemDiv(const GridExpression< E1 > &e1, const GridExpression< E2 > &e2)
Definition: GridExpression.hpp:396
GridUnaryTraits< E, ScalarImaginary< typename E::ValueType > >::ResultType imag(const GridExpression< E > &e)
Definition: GridExpression.hpp:387
MatrixNormInfinity< E >::ResultType normInf(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:917
GridUnaryTraits< E, ScalarNegation< typename E::ValueType > >::ResultType operator-(const GridExpression< E > &e)
Definition: GridExpression.hpp:272
VectorMatrixBinaryTraits< E1, E2, ScalarMultiplication< typename E1::ValueType, typename E2::ValueType > >::ResultType outerProd(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: MatrixExpression.hpp:794
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
MatrixNorm1< E >::ResultType norm1(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:903
const E & operator+(const GridExpression< E > &e)
Definition: GridExpression.hpp:282
Matrix1VectorBinaryTraits< E1, E2, MatrixVectorProduct< E1, E2 > >::ResultType prod(const MatrixExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Definition: MatrixExpression.hpp:833
MatrixNormFrobenius< E >::ResultType normFrob(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:910
The namespace of the Chemical Data Processing Library.
std::common_type< T1, T2 >::type Type
Definition: CommonType.hpp:43
Definition: MatrixExpression.hpp:345
Matrix1VectorBinary< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:347
ExpressionType ResultType
Definition: MatrixExpression.hpp:348
Definition: MatrixExpression.hpp:396
Matrix2VectorBinary< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:398
ExpressionType ResultType
Definition: MatrixExpression.hpp:399
Definition: MatrixExpression.hpp:192
MatrixBinary1< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:194
ExpressionType ResultType
Definition: MatrixExpression.hpp:195
Definition: MatrixExpression.hpp:243
ExpressionType ResultType
Definition: MatrixExpression.hpp:246
MatrixBinary2< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:245
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:639
static ResultType apply(const MatrixExpression< M > &e)
Definition: Functional.hpp:641
MatrixBooleanBinaryFunctor< M1, M2 >::ResultType ResultType
Definition: Functional.hpp:569
static ResultType apply(const MatrixExpression< M1 > &e1, const MatrixExpression< M2 > &e2)
Definition: Functional.hpp:571
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:692
static ResultType apply(const MatrixExpression< M > &e)
Definition: Functional.hpp:694
static ResultType apply(const MatrixExpression< M > &e)
Definition: Functional.hpp:724
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:722
static ResultType apply(const MatrixExpression< M > &e)
Definition: Functional.hpp:752
MatrixScalarRealUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:750
Definition: TypeTraits.hpp:186
static ResultType apply(const MatrixExpression< M1 > &e1, const MatrixExpression< M2 > &e2, Argument3Type epsilon)
Definition: Functional.hpp:607
Scalar3MatrixBooleanTernaryFunctor< M1, M2, T >::ResultType ResultType
Definition: Functional.hpp:604
MatrixScalarUnaryFunctor< M >::ResultType ResultType
Definition: Functional.hpp:661
static ResultType apply(const MatrixExpression< M > &e)
Definition: Functional.hpp:663
Definition: MatrixExpression.hpp:93
MatrixUnary< E, F > ExpressionType
Definition: MatrixExpression.hpp:95
ExpressionType ResultType
Definition: MatrixExpression.hpp:96
Definition: MatrixExpression.hpp:447
ExpressionType ResultType
Definition: MatrixExpression.hpp:450
Scalar1MatrixBinary< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:449
Definition: MatrixExpression.hpp:498
ExpressionType ResultType
Definition: MatrixExpression.hpp:501
Scalar2MatrixBinary< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:500
Definition: Functional.hpp:211
Definition: Functional.hpp:253
Definition: Functional.hpp:239
Definition: Functional.hpp:225
Definition: MatrixExpression.hpp:294
ExpressionType ResultType
Definition: MatrixExpression.hpp:297
VectorMatrixBinary< E1, E2, F > ExpressionType
Definition: MatrixExpression.hpp:296
Definition: MatrixExpression.hpp:141
VectorMatrixUnary< E, F > ExpressionType
Definition: MatrixExpression.hpp:143
ExpressionType ResultType
Definition: MatrixExpression.hpp:144
Definition: TypeTraits.hpp:179