10 #if !defined(EIGEN_PARSED_BY_DOXYGEN) 14 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS 15 #define EIGEN_INDEXED_VIEW_METHOD_CONST const 16 #define EIGEN_INDEXED_VIEW_METHOD_TYPE ConstIndexedViewType 18 #define EIGEN_INDEXED_VIEW_METHOD_CONST 19 #define EIGEN_INDEXED_VIEW_METHOD_TYPE IndexedViewType 22 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS 27 template<
typename Indices>
28 struct IvcRowType :
public internal::IndexedViewCompatibleType<Indices,RowsAtCompileTime> {};
30 template<
typename Indices>
31 struct IvcColType :
public internal::IndexedViewCompatibleType<Indices,ColsAtCompileTime> {};
33 template<
typename Indices>
34 struct IvcType :
public internal::IndexedViewCompatibleType<Indices,SizeAtCompileTime> {};
36 typedef typename internal::IndexedViewCompatibleType<Index,1>::type IvcIndex;
38 template<
typename Indices>
39 typename IvcRowType<Indices>::type
40 ivcRow(
const Indices& indices)
const {
41 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,RowsAtCompileTime>(derived().rows()),Specialized);
44 template<
typename Indices>
45 typename IvcColType<Indices>::type
46 ivcCol(
const Indices& indices)
const {
47 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,ColsAtCompileTime>(derived().cols()),Specialized);
50 template<
typename Indices>
51 typename IvcColType<Indices>::type
52 ivcSize(
const Indices& indices)
const {
53 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,SizeAtCompileTime>(derived().size()),Specialized);
60 template<
typename RowIndices,
typename ColIndices>
61 struct EIGEN_INDEXED_VIEW_METHOD_TYPE {
62 typedef IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,
63 typename IvcRowType<RowIndices>::type,
64 typename IvcColType<ColIndices>::type> type;
69 template<
typename RowIndices,
typename ColIndices>
70 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
71 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsIndexedView,
72 typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type >::type
73 operator()(
const RowIndices& rowIndices,
const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
75 return typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type
76 (derived(), ivcRow(rowIndices), ivcCol(colIndices));
81 template<
typename RowIndices,
typename ColIndices>
82 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
83 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsBlock,
84 typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType>::type
85 operator()(
const RowIndices& rowIndices,
const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
87 typedef typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType BlockType;
88 typename IvcRowType<RowIndices>::type actualRowIndices = ivcRow(rowIndices);
89 typename IvcColType<ColIndices>::type actualColIndices = ivcCol(colIndices);
90 return BlockType(derived(),
91 internal::first(actualRowIndices),
92 internal::first(actualColIndices),
93 internal::size(actualRowIndices),
94 internal::size(actualColIndices));
99 template<
typename RowIndices,
typename ColIndices>
100 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
101 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsScalar,
102 CoeffReturnType >::type
103 operator()(
const RowIndices& rowIndices,
const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
105 return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
108 #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE 112 template<
typename RowIndicesT, std::
size_t RowIndicesN,
typename ColIndices>
113 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],typename IvcColType<ColIndices>::type>
114 operator()(
const RowIndicesT (&rowIndices)[RowIndicesN],
const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
116 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],typename IvcColType<ColIndices>::type>
117 (derived(), rowIndices, ivcCol(colIndices));
120 template<
typename RowIndices,
typename ColIndicesT, std::
size_t ColIndicesN>
121 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcRowType<RowIndices>::type,
const ColIndicesT (&)[ColIndicesN]>
122 operator()(
const RowIndices& rowIndices,
const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
124 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcRowType<RowIndices>::type,
const ColIndicesT (&)[ColIndicesN]>
125 (derived(), ivcRow(rowIndices), colIndices);
128 template<
typename RowIndicesT, std::
size_t RowIndicesN,
typename ColIndicesT, std::
size_t ColIndicesN>
129 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN], const ColIndicesT (&)[ColIndicesN]>
130 operator()(
const RowIndicesT (&rowIndices)[RowIndicesN],
const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
132 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],const ColIndicesT (&)[ColIndicesN]>
133 (derived(), rowIndices, colIndices);
136 #endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE 140 template<
typename Indices>
141 typename internal::enable_if<
142 IsRowMajor && (!(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
143 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type> >::type
144 operator()(
const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
146 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
147 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type>
148 (derived(), IvcIndex(0), ivcCol(indices));
151 template<
typename Indices>
152 typename internal::enable_if<
153 (!IsRowMajor) && (!(internal::get_compile_time_incr<
typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
154 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,
typename IvcType<Indices>::type,IvcIndex> >::type
155 operator()(
const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
157 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
158 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcType<Indices>::type,IvcIndex>
159 (derived(), ivcRow(indices), IvcIndex(0));
162 template<
typename Indices>
163 typename internal::enable_if<
164 (internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1) && (!internal::is_valid_index_type<Indices>::value) && (!symbolic::is_symbolic<Indices>::value),
165 VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value> >::type
166 operator()(
const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
168 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
169 typename IvcType<Indices>::type actualIndices = ivcSize(indices);
170 return VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value>
171 (derived(), internal::first(actualIndices), internal::size(actualIndices));
174 template<
typename IndexType>
175 typename internal::enable_if<symbolic::is_symbolic<IndexType>::value, CoeffReturnType >::type
176 operator()(
const IndexType&
id) EIGEN_INDEXED_VIEW_METHOD_CONST
178 return Base::operator()(internal::eval_expr_given_size(
id,size()));
181 #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE 183 template<
typename IndicesT, std::
size_t IndicesN>
184 typename internal::enable_if<IsRowMajor,
185 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
186 operator()(
const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
188 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
189 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]>
190 (derived(), IvcIndex(0), indices);
193 template<
typename IndicesT, std::
size_t IndicesN>
194 typename internal::enable_if<!IsRowMajor,
195 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex> >::type
196 operator()(
const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
198 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
199 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex>
200 (derived(), indices, IvcIndex(0));
203 #endif // EIGEN_HAS_STATIC_ARRAY_TEMPLATE 205 #undef EIGEN_INDEXED_VIEW_METHOD_CONST 206 #undef EIGEN_INDEXED_VIEW_METHOD_TYPE 208 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS 209 #define EIGEN_INDEXED_VIEW_METHOD_2ND_PASS 210 #include "IndexedViewMethods.h" 211 #undef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS 214 #else // EIGEN_PARSED_BY_DOXYGEN 250 template<
typename RowIndices,
typename ColIndices>
252 operator()(
const RowIndices& rowIndices,
const ColIndices& colIndices);
258 template<
typename Indices>
259 IndexedView_or_VectorBlock
260 operator()(
const Indices& indices);
262 #endif // EIGEN_PARSED_BY_DOXYGEN