27 #ifndef CDPL_MATH_MATRIXADAPTER_HPP
28 #define CDPL_MATH_MATRIXADAPTER_HPP
30 #include <type_traits>
60 static typename M::ConstReference
get(
const M&
m,
typename M::SizeType i,
typename M::SizeType j)
63 return m.getData()(i, j);
84 static typename M::ConstReference
get(
const M&
m,
typename M::SizeType i,
typename M::SizeType j)
90 return m.getData()(i, j);
110 template <
typename M>
111 static typename M::ConstReference
get(
const M&
m,
typename M::SizeType i,
typename M::SizeType j)
114 return m.getData()(i, j);
134 template <
typename M>
135 static typename M::ConstReference
get(
const M&
m,
typename M::SizeType i,
typename M::SizeType j)
141 return m.getData()(i, j);
152 template <
typename M,
typename Tri>
197 typedef typename std::conditional<std::is_const<M>::value,
198 typename M::ConstReference,
204 typedef typename std::conditional<std::is_const<M>::value,
205 typename M::ConstClosureType,
239 return TriangularType::template get<SelfType>(*
this, i, j);
248 return data.getSize1();
257 return data.getSize2();
284 return (data.getSize1() == 0 || data.getSize2() == 0);
293 template <
typename M,
typename Tri>
296 template <
typename M,
typename Tri>
304 template <
typename M,
typename Tri>
313 template <
typename M,
typename Tri>
322 template <
typename M,
typename Tri>
331 template <
typename M,
typename Tri>
342 template <
typename Tri,
typename E>
356 template <
typename Tri,
typename E>
357 TriangularAdapter<const E, Tri>
Definition of basic expression types.
Definition of type traits.
CRTP base class of all matrix expression types.
Definition: Expression.hpp:108
Matrix expression that exposes only the triangular part of an underlying matrix M selected by the pol...
Definition: MatrixAdapter.hpp:154
Range< SizeType > RangeType
The Math::Range type used to address sub-ranges.
Definition: MatrixAdapter.hpp:221
const SelfType ConstClosureType
Constant closure type used when this adapter appears inside another expression.
Definition: MatrixAdapter.hpp:211
M MatrixType
The wrapped matrix type.
Definition: MatrixAdapter.hpp:167
M::DifferenceType DifferenceType
The signed difference type used by the underlying matrix.
Definition: MatrixAdapter.hpp:182
M::ValueType ValueType
The element value type of the underlying matrix.
Definition: MatrixAdapter.hpp:187
SizeType getSize2() const
Returns the number of columns of the wrapped matrix.
Definition: MatrixAdapter.hpp:255
MatrixClosureType & getData()
Returns a reference to the wrapped matrix (via its stored closure).
Definition: MatrixAdapter.hpp:264
M::SizeType SizeType
The size type used by the underlying matrix.
Definition: MatrixAdapter.hpp:177
bool isEmpty() const
Tells whether the wrapped matrix is empty (zero rows or zero columns).
Definition: MatrixAdapter.hpp:282
M::ConstReference ConstReference
Constant element reference type of the underlying matrix.
Definition: MatrixAdapter.hpp:192
SelfType ClosureType
Closure type used when this adapter appears inside another expression.
Definition: MatrixAdapter.hpp:216
TriangularAdapter(MatrixType &m)
Constructs the adapter wrapping m.
Definition: MatrixAdapter.hpp:227
ConstReference operator()(SizeType i, SizeType j) const
Returns the value of element (i, j) as seen through the triangular policy (off-policy entries return ...
Definition: MatrixAdapter.hpp:237
Tri TriangularType
The triangular-view selection policy.
Definition: MatrixAdapter.hpp:172
const MatrixClosureType & getData() const
Returns a const reference to the wrapped matrix (via its stored closure).
Definition: MatrixAdapter.hpp:273
std::conditional< std::is_const< M >::value, typename M::ConstReference, typename M::Reference >::type Reference
Mutable element reference type (degrades to ConstReference when the wrapped matrix is const).
Definition: MatrixAdapter.hpp:199
std::conditional< std::is_const< M >::value, typename M::ConstClosureType, typename M::ClosureType >::type MatrixClosureType
Closure type used to store the wrapped matrix internally (mutable or const flavor).
Definition: MatrixAdapter.hpp:206
SizeType getSize1() const
Returns the number of rows of the wrapped matrix.
Definition: MatrixAdapter.hpp:246
constexpr unsigned int M
Generic type that covers any element that is a metal.
Definition: AtomType.hpp:657
constexpr unsigned int m
Specifies that the stereocenter has m configuration.
Definition: CIPDescriptor.hpp:116
TriangularAdapter< E, Tri > triang(MatrixExpression< E > &e)
Creates a Math::TriangularAdapter view of the matrix expression e using the triangular policy Tri.
Definition: MatrixAdapter.hpp:344
The namespace of the Chemical Data Processing Library.
Tag selecting the lower-triangular view (entries strictly above the diagonal read as zero) for Math::...
Definition: MatrixAdapter.hpp:49
static M::ConstReference get(const M &m, typename M::SizeType i, typename M::SizeType j)
Returns element (i, j) of m under the lower-triangular policy (zero above the diagonal).
Definition: MatrixAdapter.hpp:60
Selects a concrete temporary matrix type compatible with the matrix expression M.
Definition: TypeTraits.hpp:337
Tag selecting the unit-lower-triangular view (zero above the diagonal, one on the diagonal) for Math:...
Definition: MatrixAdapter.hpp:73
static M::ConstReference get(const M &m, typename M::SizeType i, typename M::SizeType j)
Returns element (i, j) of m under the unit-lower-triangular policy (one on the diagonal,...
Definition: MatrixAdapter.hpp:84
Tag selecting the unit-upper-triangular view (zero below the diagonal, one on the diagonal) for Math:...
Definition: MatrixAdapter.hpp:124
static M::ConstReference get(const M &m, typename M::SizeType i, typename M::SizeType j)
Returns element (i, j) of m under the unit-upper-triangular policy (one on the diagonal,...
Definition: MatrixAdapter.hpp:135
Tag selecting the upper-triangular view (entries strictly below the diagonal read as zero) for Math::...
Definition: MatrixAdapter.hpp:100
static M::ConstReference get(const M &m, typename M::SizeType i, typename M::SizeType j)
Returns element (i, j) of m under the upper-triangular policy (zero below the diagonal).
Definition: MatrixAdapter.hpp:111
Selects a concrete temporary vector type compatible with the vector expression V.
Definition: TypeTraits.hpp:323