12 #ifndef BOGUS_BLOCK_ACCESS_HPP
13 #define BOGUS_BLOCK_ACCESS_HPP
15 #include "Constants.hpp"
18 #include "../Utils/CppTools.hpp"
23 template <
typename SelfTransposeT >
28 template<
typename BlockType >
29 inline typename EnableIf< !BlockTraits< BlockType >::is_self_transpose,
typename BlockType::ConstTransposeReturnType >::ReturnType
32 return block.transpose() ;
42 template<
typename BlockType,
43 bool IsSelfTranspose = BlockTraits< BlockType >::is_self_transpose,
44 bool DefinesConstTranspose = HasConstTransposeReturnType< BlockType >::Value,
45 bool DefinesTransposeTraits = HasReturnType< BlockTransposeTraits< BlockType > >::Value >
47 enum { is_defined= 0 } ;
51 template<
typename BlockType,
bool DCT,
bool DTT >
53 typedef const BlockType& ReturnType ;
54 enum { is_defined = 1 } ;
57 template<
typename BlockType,
bool DTT >
59 typedef typename BlockType::ConstTransposeReturnType ReturnType ;
60 enum { is_defined = 1 } ;
63 template<
typename BlockType >
66 enum { is_defined = 1 } ;
69 template <
typename BlockType >
79 template <
bool DoTranspose >
81 template <
typename BlockT >
82 inline static const BlockT&
get(
const BlockT& src )
87 template <
typename BlockT >
94 template <
bool RuntimeTest,
bool >
96 enum { runtime_test = 1, runtime_transpose = 0 } ;
98 template <
typename RhsT,
typename ResT,
typename Scalar >
99 inline static void assign(
const RhsT& rhs, ResT &res,
const Scalar scale,
bool doTranspose )
102 else res = scale * rhs ;
107 template <
bool CompileTimeTranspose >
110 enum { runtime_test = 0, runtime_transpose = 1 } ;
112 template <
typename RhsT,
typename ResT,
typename Scalar >
113 inline static void assign(
const RhsT& rhs, ResT &res,
const Scalar scale,
bool )
121 template<
typename BlockT,
bool Transpose_ = false >
127 enum { Rows = Dims::First,
128 Cols = Dims::Second } ;
132 template <
int DimensionAtCompileTime,
typename VectorType,
typename Index >
135 enum { dimension = DimensionAtCompileTime } ;
137 typedef typename VectorType::template NRowsBlockXpr< dimension >::Type
139 typedef typename VectorType::template ConstNRowsBlockXpr< dimension >::Type
142 Segmenter( VectorType &vec,
const Index* ) : m_vec( vec ) {}
144 inline ReturnType operator[](
const Index inner )
146 return m_vec.template middleRows< dimension >( dimension*inner ) ;
149 inline ConstReturnType operator[](
const Index inner )
const
151 return m_vec.template middleRows< dimension >( dimension*inner ) ;
158 template <
typename VectorType,
typename Index >
159 struct Segmenter< internal::DYNAMIC, VectorType, Index >
161 typedef typename VectorType::RowsBlockXpr ReturnType ;
162 typedef typename VectorType::ConstRowsBlockXpr ConstReturnType ;
164 Segmenter( VectorType &vec,
const Index* offsets ) : m_vec( vec ), m_offsets( offsets ) { }
166 inline ReturnType operator[](
const Index inner )
168 return m_vec.middleRows( m_offsets[ inner ], m_offsets[ inner + 1 ] - m_offsets[ inner ] ) ;
171 inline ConstReturnType operator[](
const Index inner )
const
173 return m_vec.middleRows( m_offsets[ inner ], m_offsets[ inner + 1 ] - m_offsets[ inner ] ) ;
179 const Index* m_offsets ;
EnableIf< BlockTraits< SelfTransposeT >::is_self_transpose, const SelfTransposeT & >::ReturnType transpose_block(const SelfTransposeT &block)
Specialization of transpose_block() for self-adjoint types.
Definition: Access.hpp:25
Access to the dimensions of a block.
Definition: Access.hpp:122
Defines the transpose type of a BlockType using self-introspection.
Definition: Access.hpp:46
Utility struct to handle both compile-time and runtime optionally transposed ops. ...
Definition: Access.hpp:95
Definition: Traits.hpp:29
Utility struct for expressing a compile-time conditional transpose of a block.
Definition: Access.hpp:80
Definition: Access.hpp:70
Definition: CppTools.hpp:49
Access to segment of a vector corresponding to a given block-row.
Definition: Access.hpp:133
Defines the return type of an associated transpose_block( const BlockType& ) function.
Definition: Traits.hpp:55
Definition: CppTools.hpp:75