Chemical Data Processing Library C++ API - Version 1.3.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  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator*=(const T& t)
604  {
605  data.operator*=(t);
606  return *this;
607  }
608 
609  template <typename T>
610  typename std::enable_if<IsScalar<T>::value, MatrixTranspose>::type& operator/=(const T& t)
611  {
612  data.operator/=(t);
613  return *this;
614  }
615 
616  template <typename E>
618  {
619  data.assign((MatrixTranspose<const E>(e())));
620  return *this;
621  }
622 
623  template <typename E>
625  {
626  data.plusAssign((MatrixTranspose<const E>(e())));
627  return *this;
628  }
629 
630  template <typename E>
632  {
633  data.minusAssign((MatrixTranspose<const E>(e())));
634  return *this;
635  }
636 
638  {
639  data.swap(mt.data);
640  }
641 
642  friend void swap(MatrixTranspose& mt1, MatrixTranspose& mt2)
643  {
644  mt1.swap(mt2);
645  }
646 
647  private:
648  MatrixClosureType data;
649  };
650 
651  template <typename M>
653  {};
654 
655  template <typename M>
657  {};
658 
659  template <typename M>
661  {};
662 
663  template <typename M>
665  {};
666 
667  template <typename E>
670  {
671  typedef typename MatrixUnaryTraits<E, ScalarNegation<typename E::ValueType> >::ExpressionType ExpressionType;
672 
673  return ExpressionType(e());
674  }
675 
676  template <typename E>
677  const E&
679  {
680  return e();
681  }
682 
683  template <typename E1, typename E2>
684  typename MatrixBinary1Traits<E1, E2, ScalarAddition<typename E1::ValueType, typename E2::ValueType> >::ResultType
686  {
687  typedef typename MatrixBinary1Traits<E1, E2,
689 
690  return ExpressionType(e1(), e2());
691  }
692 
693  template <typename E1, typename E2>
694  typename MatrixBinary1Traits<E1, E2, ScalarSubtraction<typename E1::ValueType, typename E2::ValueType> >::ResultType
696  {
697  typedef typename MatrixBinary1Traits<E1, E2,
699 
700  return ExpressionType(e1(), e2());
701  }
702 
703  template <typename E, typename T>
704  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarMultiplication<typename E::ValueType, T> >::ResultType>::type
705  operator*(const MatrixExpression<E>& e, const T& t)
706  {
707  typedef typename Scalar2MatrixBinaryTraits<E, T,
708  ScalarMultiplication<typename E::ValueType, T> >::ExpressionType ExpressionType;
709 
710  return ExpressionType(e(), t);
711  }
712 
713  template <typename T, typename E>
714  typename std::enable_if<IsScalar<T>::value, typename Scalar1MatrixBinaryTraits<T, E, ScalarMultiplication<T, typename E::ValueType> >::ResultType>::type
715  operator*(const T& t, const MatrixExpression<E>& e)
716  {
717  typedef typename Scalar1MatrixBinaryTraits<T, E,
718  ScalarMultiplication<T, typename E::ValueType> >::ExpressionType ExpressionType;
719 
720  return ExpressionType(t, e());
721  }
722 
723  template <typename E, typename T>
724  typename std::enable_if<IsScalar<T>::value, typename Scalar2MatrixBinaryTraits<E, T, ScalarDivision<typename E::ValueType, T> >::ResultType>::type
725  operator/(const MatrixExpression<E>& e, const T& t)
726  {
727  typedef typename Scalar2MatrixBinaryTraits<E, T,
728  ScalarDivision<typename E::ValueType, T> >::ExpressionType ExpressionType;
729 
730  return ExpressionType(e(), t);
731  }
732 
733  template <typename E1, typename E2>
736  {
737  return MatrixEquality<E1, E2>::apply(e1, e2);
738  }
739 
740  template <typename E1, typename E2>
743  {
744  return !MatrixEquality<E1, E2>::apply(e1, e2);
745  }
746 
747  template <typename E1, typename E2, typename T>
748  typename std::enable_if<std::is_arithmetic<T>::value, typename MatrixToleranceEquality<E1, E2, T>::ResultType>::type
749  equals(const MatrixExpression<E1>& e1, const MatrixExpression<E2>& e2, const T& eps)
750  {
751  return MatrixToleranceEquality<E1, E2, T>::apply(e1, e2, eps);
752  }
753 
754  template <typename E>
755  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
757  {
758  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
759 
760  return ExpressionType(e());
761  }
762 
763  template <typename E>
764  typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ResultType
766  {
767  typedef typename MatrixUnaryTraits<E, ScalarConjugation<typename E::ValueType> >::ExpressionType ExpressionType;
768 
769  return ExpressionType(e());
770  }
771 
772  template <typename E>
773  typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ResultType
775  {
776  typedef typename MatrixUnaryTraits<E, ScalarReal<typename E::ValueType> >::ExpressionType ExpressionType;
777 
778  return ExpressionType(e());
779  }
780 
781  template <typename E>
782  typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ResultType
784  {
785  typedef typename MatrixUnaryTraits<E, ScalarImaginary<typename E::ValueType> >::ExpressionType ExpressionType;
786 
787  return ExpressionType(e());
788  }
789 
790  template <typename E1, typename E2>
791  typename VectorMatrixBinaryTraits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
793  {
794  typedef typename VectorMatrixBinaryTraits<E1, E2,
796 
797  return ExpressionType(e1(), e2());
798  }
799 
800  template <typename E1, typename E2>
801  typename MatrixBinary1Traits<E1, E2, ScalarDivision<typename E1::ValueType, typename E2::ValueType> >::ResultType
803  {
804  typedef typename MatrixBinary1Traits<E1, E2,
806 
807  return ExpressionType(e1(), e2());
808  }
809 
810  template <typename E1, typename E2>
811  typename MatrixBinary1Traits<E1, E2, ScalarMultiplication<typename E1::ValueType, typename E2::ValueType> >::ResultType
813  {
814  typedef typename MatrixBinary1Traits<E1, E2,
816 
817  return ExpressionType(e1(), e2());
818  }
819 
820  template <typename E1, typename E2>
821  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
823  {
824  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
825 
826  return ExpressionType(e1(), e2());
827  }
828 
829  template <typename E1, typename E2>
830  typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ResultType
832  {
833  typedef typename Matrix1VectorBinaryTraits<E1, E2, MatrixVectorProduct<E1, E2> >::ExpressionType ExpressionType;
834 
835  return ExpressionType(e1(), e2());
836  }
837 
838  template <typename C, typename E1, typename E2>
840  {
841  return c().assign(prod(e1, e2));
842  }
843 
844  template <typename E1, typename E2>
845  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
847  {
848  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
849 
850  return ExpressionType(e1(), e2());
851  }
852 
853  template <typename E1, typename E2>
854  typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ResultType
856  {
857  typedef typename Matrix2VectorBinaryTraits<E1, E2, VectorMatrixProduct<E1, E2> >::ExpressionType ExpressionType;
858 
859  return ExpressionType(e1(), e2());
860  }
861 
862  template <typename C, typename E1, typename E2>
864  {
865  return c().assign(prod(e1, e2));
866  }
867 
868  template <typename E1, typename E2>
869  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
871  {
872  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
873 
874  return ExpressionType(e1(), e2());
875  }
876 
877  template <typename E1, typename E2>
878  typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ResultType
880  {
881  typedef typename MatrixBinary2Traits<E1, E2, MatrixProduct<E1, E2> >::ExpressionType ExpressionType;
882 
883  return ExpressionType(e1(), e2());
884  }
885 
886  template <typename C, typename E1, typename E2>
888  {
889  return c().assign(prod(e1, e2));
890  }
891 
892  template <typename E>
895  {
896  return MatrixTrace<E>::apply(e);
897  }
898 
899  template <typename E>
902  {
903  return MatrixNorm1<E>::apply(e);
904  }
905 
906  template <typename E>
909  {
911  }
912 
913  template <typename E>
916  {
918  }
919 
920  template <typename E>
921  typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ResultType
923  {
924  typedef typename VectorMatrixUnaryTraits<E, DiagonalMatrixFromVector<E> >::ExpressionType ExpressionType;
925 
926  return ExpressionType(e());
927  }
928 
929  template <typename E>
930  typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ResultType
932  {
933  typedef typename VectorMatrixUnaryTraits<E, CrossProductMatrixFromVector<E> >::ExpressionType ExpressionType;
934 
935  return ExpressionType(e());
936  }
937 
938  template <typename E>
940  {
941  return MatrixTranspose<E>(e());
942  }
943 
944  template <typename E>
946  {
947  return MatrixTranspose<const E>(e());
948  }
949 
950  template <typename E>
953  {
954  return MatrixElementSum<E>::apply(e);
955  }
956  } // namespace Math
957 } // namespace CDPL
958 
959 #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:637
SelfType ClosureType
Definition: MatrixExpression.hpp:523
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator/=(const T &t)
Definition: MatrixExpression.hpp:610
std::enable_if< IsScalar< T >::value, MatrixTranspose >::type & operator*=(const T &t)
Definition: MatrixExpression.hpp:603
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:631
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:624
friend void swap(MatrixTranspose &mt1, MatrixTranspose &mt2)
Definition: MatrixExpression.hpp:642
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:617
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:939
MatrixTrace< E >::ResultType trace(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:894
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:931
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:922
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:915
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:792
GridElementSum< E >::ResultType sum(const GridExpression< E > &e)
Definition: GridExpression.hpp:416
MatrixNorm1< E >::ResultType norm1(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:901
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:831
MatrixNormFrobenius< E >::ResultType normFrob(const MatrixExpression< E > &e)
Definition: MatrixExpression.hpp:908
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