27 #ifndef CDPL_MATH_MATRIXPROXY_HPP
28 #define CDPL_MATH_MATRIXPROXY_HPP
30 #include <type_traits>
59 typedef typename std::conditional<std::is_const<M>::value,
60 typename M::ConstReference,
62 typedef typename std::conditional<std::is_const<M>::value,
63 typename M::ConstClosureType,
73 return data(index, i);
78 return data(index, i);
83 return data(index, i);
88 return data(index, i);
98 return data.getSize2();
103 return (data.getSize2() == 0);
122 template <
typename E>
129 template <
typename E>
136 template <
typename E>
143 template <
typename T>
146 vectorAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
150 template <
typename T>
153 vectorAssignScalar<ScalarDivisionAssignment>(*
this, t);
157 template <
typename E>
160 vectorAssignVector<ScalarAssignment>(*
this, e);
164 template <
typename E>
167 vectorAssignVector<ScalarAdditionAssignment>(*
this, e);
171 template <
typename E>
174 vectorAssignVector<ScalarSubtractionAssignment>(*
this, e);
194 template <
typename M>
206 typedef typename std::conditional<std::is_const<M>::value,
207 typename M::ConstReference,
209 typedef typename std::conditional<std::is_const<M>::value,
210 typename M::ConstClosureType,
220 return data(i, index);
225 return data(i, index);
230 return data(i, index);
235 return data(i, index);
245 return data.getSize1();
250 return (data.getSize1() == 0);
269 template <
typename E>
276 template <
typename E>
283 template <
typename E>
290 template <
typename T>
293 vectorAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
297 template <
typename T>
300 vectorAssignScalar<ScalarDivisionAssignment>(*
this, t);
304 template <
typename E>
307 vectorAssignVector<ScalarAssignment>(*
this, e);
311 template <
typename E>
314 vectorAssignVector<ScalarAdditionAssignment>(*
this, e);
318 template <
typename E>
321 vectorAssignVector<ScalarSubtractionAssignment>(*
this, e);
341 template <
typename M>
353 typedef typename std::conditional<std::is_const<M>::value,
354 typename M::ConstReference,
356 typedef typename std::conditional<std::is_const<M>::value,
357 typename M::ConstClosureType,
364 data(
m), range1(r1), range2(r2) {}
368 return data(range1(i), range2(j));
373 return data(range1(i), range2(j));
417 template <
typename E>
424 template <
typename E>
431 template <
typename E>
438 template <
typename T>
441 matrixAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
445 template <
typename T>
448 matrixAssignScalar<ScalarDivisionAssignment>(*
this, t);
452 template <
typename E>
455 matrixAssignMatrix<ScalarAssignment>(*
this, e);
459 template <
typename E>
462 matrixAssignMatrix<ScalarAdditionAssignment>(*
this, e);
466 template <
typename E>
469 matrixAssignMatrix<ScalarSubtractionAssignment>(*
this, e);
490 template <
typename M>
502 typedef typename std::conditional<std::is_const<M>::value,
503 typename M::ConstReference,
505 typedef typename std::conditional<std::is_const<M>::value,
506 typename M::ConstClosureType,
513 data(
m), slice1(s1), slice2(s2) {}
517 return data(slice1(i), slice2(j));
522 return data(slice1(i), slice2(j));
576 template <
typename E>
583 template <
typename E>
590 template <
typename E>
597 template <
typename T>
600 matrixAssignScalar<ScalarMultiplicationAssignment>(*
this, t);
604 template <
typename T>
607 matrixAssignScalar<ScalarDivisionAssignment>(*
this, t);
611 template <
typename E>
614 matrixAssignMatrix<ScalarAssignment>(*
this, e);
618 template <
typename E>
621 matrixAssignMatrix<ScalarAdditionAssignment>(*
this, e);
625 template <
typename E>
628 matrixAssignMatrix<ScalarSubtractionAssignment>(*
this, e);
649 template <
typename M>
653 template <
typename M>
657 template <
typename M>
661 template <
typename M>
665 template <
typename M>
669 template <
typename M>
673 template <
typename M>
677 template <
typename M>
681 template <
typename M>
685 template <
typename M>
689 template <
typename M>
693 template <
typename M>
697 template <
typename M>
701 template <
typename M>
705 template <
typename M>
709 template <
typename M>
713 template <
typename M>
721 template <
typename M>
728 template <
typename M>
735 template <
typename M>
736 MatrixColumn<const M>
742 template <
typename E>
751 template <
typename E>
760 template <
typename E>
770 return MatrixRange<E>(e(), RangeType(start1, stop1), RangeType(start2, stop2));
773 template <
typename E>
786 template <
typename E>
795 template <
typename E>
804 template <
typename E>
816 return MatrixSlice<E>(e(), SliceType(start1, stride1, size1), SliceType(start2, stride2, size2));
819 template <
typename E>
831 return MatrixSlice<const E>(e(), SliceType(start1, stride1, size1), SliceType(start2, stride2, size2));
Definition of basic expression types.
Definition of various functors.
Implementation of matrix assignment routines.
Definition of a data type for describing index ranges.
Definition of a data type for describing index slices.
Definition of type traits.
Implementation of vector assignment routines.
Definition: MatrixProxy.hpp:196
friend void swap(MatrixColumn &c1, MatrixColumn &c2)
Definition: MatrixProxy.hpp:331
M::ConstReference ConstReference
Definition: MatrixProxy.hpp:205
MatrixColumn & operator+=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:277
MatrixColumn & assign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:305
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Definition: MatrixProxy.hpp:208
ConstReference operator[](SizeType i) const
Definition: MatrixProxy.hpp:233
std::enable_if< IsScalar< T >::value, MatrixColumn >::type & operator*=(const T &t)
Definition: MatrixProxy.hpp:291
SelfType ClosureType
Definition: MatrixProxy.hpp:213
void swap(MatrixColumn &c)
Definition: MatrixProxy.hpp:325
M::SizeType SizeType
Definition: MatrixProxy.hpp:202
MatrixColumn & operator=(const MatrixColumn &c)
Definition: MatrixProxy.hpp:263
MatrixColumn & plusAssign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:312
SizeType getIndex() const
Definition: MatrixProxy.hpp:238
MatrixColumn & operator=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:270
ConstReference operator()(SizeType i) const
Definition: MatrixProxy.hpp:223
MatrixColumn & minusAssign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:319
const SelfType ConstClosureType
Definition: MatrixProxy.hpp:212
MatrixColumn(MatrixType &m, SizeType i)
Definition: MatrixProxy.hpp:215
Reference operator[](SizeType i)
Definition: MatrixProxy.hpp:228
M MatrixType
Definition: MatrixProxy.hpp:201
M::ValueType ValueType
Definition: MatrixProxy.hpp:204
const MatrixClosureType & getData() const
Definition: MatrixProxy.hpp:258
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Definition: MatrixProxy.hpp:211
MatrixClosureType & getData()
Definition: MatrixProxy.hpp:253
bool isEmpty() const
Definition: MatrixProxy.hpp:248
SizeType getSize() const
Definition: MatrixProxy.hpp:243
M::DifferenceType DifferenceType
Definition: MatrixProxy.hpp:203
std::enable_if< IsScalar< T >::value, MatrixColumn >::type & operator/=(const T &t)
Definition: MatrixProxy.hpp:298
Reference operator()(SizeType i)
Definition: MatrixProxy.hpp:218
MatrixColumn & operator-=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:284
Definition: Expression.hpp:76
Definition: MatrixProxy.hpp:343
M::SizeType SizeType
Definition: MatrixProxy.hpp:349
MatrixRange & operator=(const MatrixRange &r)
Definition: MatrixProxy.hpp:411
const MatrixClosureType & getData() const
Definition: MatrixProxy.hpp:406
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Definition: MatrixProxy.hpp:355
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Definition: MatrixProxy.hpp:358
MatrixRange & operator-=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:432
SizeType getStart1() const
Definition: MatrixProxy.hpp:376
SizeType getSize2() const
Definition: MatrixProxy.hpp:391
M MatrixType
Definition: MatrixProxy.hpp:348
MatrixRange & assign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:453
MatrixRange & operator+=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:425
SizeType getStart2() const
Definition: MatrixProxy.hpp:381
Range< SizeType > RangeType
Definition: MatrixProxy.hpp:361
M::ConstReference ConstReference
Definition: MatrixProxy.hpp:352
M::ValueType ValueType
Definition: MatrixProxy.hpp:351
friend void swap(MatrixRange &r1, MatrixRange &r2)
Definition: MatrixProxy.hpp:479
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixProxy.hpp:371
Reference operator()(SizeType i, SizeType j)
Definition: MatrixProxy.hpp:366
M::DifferenceType DifferenceType
Definition: MatrixProxy.hpp:350
SelfType ClosureType
Definition: MatrixProxy.hpp:360
SizeType getSize1() const
Definition: MatrixProxy.hpp:386
void swap(MatrixRange &r)
Definition: MatrixProxy.hpp:473
std::enable_if< IsScalar< T >::value, MatrixRange >::type & operator*=(const T &t)
Definition: MatrixProxy.hpp:439
std::enable_if< IsScalar< T >::value, MatrixRange >::type & operator/=(const T &t)
Definition: MatrixProxy.hpp:446
MatrixRange & plusAssign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:460
bool isEmpty() const
Definition: MatrixProxy.hpp:396
MatrixRange & operator=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:418
const SelfType ConstClosureType
Definition: MatrixProxy.hpp:359
MatrixClosureType & getData()
Definition: MatrixProxy.hpp:401
MatrixRange(MatrixType &m, const RangeType &r1, const RangeType &r2)
Definition: MatrixProxy.hpp:363
MatrixRange & minusAssign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:467
Definition: MatrixProxy.hpp:49
MatrixRow & operator=(const MatrixRow &r)
Definition: MatrixProxy.hpp:116
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Definition: MatrixProxy.hpp:61
MatrixRow & operator+=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:130
M::DifferenceType DifferenceType
Definition: MatrixProxy.hpp:56
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Definition: MatrixProxy.hpp:64
M MatrixType
Definition: MatrixProxy.hpp:54
ConstReference operator[](SizeType i) const
Definition: MatrixProxy.hpp:86
MatrixRow & assign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:158
MatrixRow & operator=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:123
std::enable_if< IsScalar< T >::value, MatrixRow >::type & operator*=(const T &t)
Definition: MatrixProxy.hpp:144
MatrixRow(MatrixType &m, SizeType i)
Definition: MatrixProxy.hpp:68
const MatrixClosureType & getData() const
Definition: MatrixProxy.hpp:111
M::ConstReference ConstReference
Definition: MatrixProxy.hpp:58
SizeType getSize() const
Definition: MatrixProxy.hpp:96
ConstReference operator()(SizeType i) const
Definition: MatrixProxy.hpp:76
MatrixRow & operator-=(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:137
M::SizeType SizeType
Definition: MatrixProxy.hpp:55
Reference operator()(SizeType i)
Definition: MatrixProxy.hpp:71
void swap(MatrixRow &r)
Definition: MatrixProxy.hpp:178
SizeType getIndex() const
Definition: MatrixProxy.hpp:91
const SelfType ConstClosureType
Definition: MatrixProxy.hpp:65
M::ValueType ValueType
Definition: MatrixProxy.hpp:57
MatrixRow & minusAssign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:172
friend void swap(MatrixRow &r1, MatrixRow &r2)
Definition: MatrixProxy.hpp:184
SelfType ClosureType
Definition: MatrixProxy.hpp:66
MatrixClosureType & getData()
Definition: MatrixProxy.hpp:106
bool isEmpty() const
Definition: MatrixProxy.hpp:101
std::enable_if< IsScalar< T >::value, MatrixRow >::type & operator/=(const T &t)
Definition: MatrixProxy.hpp:151
MatrixRow & plusAssign(const VectorExpression< E > &e)
Definition: MatrixProxy.hpp:165
Reference operator[](SizeType i)
Definition: MatrixProxy.hpp:81
Definition: MatrixProxy.hpp:492
const SelfType ConstClosureType
Definition: MatrixProxy.hpp:508
SizeType getSize2() const
Definition: MatrixProxy.hpp:550
MatrixSlice & operator=(const MatrixSlice &s)
Definition: MatrixProxy.hpp:570
MatrixSlice & operator-=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:591
MatrixClosureType & getData()
Definition: MatrixProxy.hpp:560
std::enable_if< IsScalar< T >::value, MatrixSlice >::type & operator*=(const T &t)
Definition: MatrixProxy.hpp:598
MatrixSlice & operator=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:577
MatrixSlice & assign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:612
SizeType getStart2() const
Definition: MatrixProxy.hpp:530
Slice< SizeType, DifferenceType > SliceType
Definition: MatrixProxy.hpp:510
friend void swap(MatrixSlice &s1, MatrixSlice &s2)
Definition: MatrixProxy.hpp:638
M::DifferenceType DifferenceType
Definition: MatrixProxy.hpp:499
const MatrixClosureType & getData() const
Definition: MatrixProxy.hpp:565
M MatrixType
Definition: MatrixProxy.hpp:497
MatrixSlice(MatrixType &m, const SliceType &s1, const SliceType &s2)
Definition: MatrixProxy.hpp:512
Reference operator()(SizeType i, SizeType j)
Definition: MatrixProxy.hpp:515
M::ConstReference ConstReference
Definition: MatrixProxy.hpp:501
MatrixSlice & plusAssign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:619
M::ValueType ValueType
Definition: MatrixProxy.hpp:500
void swap(MatrixSlice &s)
Definition: MatrixProxy.hpp:632
M::SizeType SizeType
Definition: MatrixProxy.hpp:498
bool isEmpty() const
Definition: MatrixProxy.hpp:555
DifferenceType getStride1() const
Definition: MatrixProxy.hpp:535
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Definition: MatrixProxy.hpp:507
SizeType getSize1() const
Definition: MatrixProxy.hpp:545
SizeType getStart1() const
Definition: MatrixProxy.hpp:525
DifferenceType getStride2() const
Definition: MatrixProxy.hpp:540
MatrixSlice & operator+=(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:584
MatrixSlice & minusAssign(const MatrixExpression< E > &e)
Definition: MatrixProxy.hpp:626
ConstReference operator()(SizeType i, SizeType j) const
Definition: MatrixProxy.hpp:520
std::enable_if< IsScalar< T >::value, MatrixSlice >::type & operator/=(const T &t)
Definition: MatrixProxy.hpp:605
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Definition: MatrixProxy.hpp:504
SelfType ClosureType
Definition: MatrixProxy.hpp:509
SizeType getStart() const
Definition: Range.hpp:67
SizeType getSize() const
Definition: Range.hpp:77
SizeType SizeType
Definition: Range.hpp:50
SizeType SizeType
Definition: Slice.hpp:50
SizeType getStart() const
Definition: Slice.hpp:68
SizeType getSize() const
Definition: Slice.hpp:78
DifferenceType getStride() const
Definition: Slice.hpp:73
DifferenceType DifferenceType
Definition: Slice.hpp:51
Definition: Expression.hpp:54
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 r
Specifies that the stereocenter has r configuration.
Definition: CIPDescriptor.hpp:76
constexpr unsigned int s
Specifies that the stereocenter has s configuration.
Definition: CIPDescriptor.hpp:81
constexpr unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
MatrixSlice< E > slice(MatrixExpression< E > &e, const typename MatrixSlice< E >::SliceType &s1, const typename MatrixSlice< E >::SliceType &s2)
Definition: MatrixProxy.hpp:788
MatrixColumn< M > column(MatrixExpression< M > &e, typename MatrixColumn< M >::SizeType j)
Definition: MatrixProxy.hpp:730
MatrixRow< M > row(MatrixExpression< M > &e, typename MatrixRow< M >::SizeType i)
Definition: MatrixProxy.hpp:716
void vectorSwap(V &v, VectorExpression< E > &e)
Definition: VectorAssignment.hpp:72
MatrixRange< E > range(MatrixExpression< E > &e, const typename MatrixRange< E >::RangeType &r1, const typename MatrixRange< E >::RangeType &r2)
Definition: MatrixProxy.hpp:744
void matrixSwap(M &m, MatrixExpression< E > &e)
Definition: MatrixAssignment.hpp:76
The namespace of the Chemical Data Processing Library.
Definition: TypeTraits.hpp:186
M::MatrixTemporaryType Type
Definition: TypeTraits.hpp:188
Definition: TypeTraits.hpp:179