File indexing completed on 2024-11-15 09:37:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #if !defined(EIGEN_PARSED_BY_DOXYGEN)
0011
0012
0013
0014 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS
0015 #define EIGEN_INDEXED_VIEW_METHOD_CONST const
0016 #define EIGEN_INDEXED_VIEW_METHOD_TYPE ConstIndexedViewType
0017 #else
0018 #define EIGEN_INDEXED_VIEW_METHOD_CONST
0019 #define EIGEN_INDEXED_VIEW_METHOD_TYPE IndexedViewType
0020 #endif
0021
0022 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS
0023 protected:
0024
0025
0026
0027 template<typename Indices>
0028 struct IvcRowType : public internal::IndexedViewCompatibleType<Indices,RowsAtCompileTime> {};
0029
0030 template<typename Indices>
0031 struct IvcColType : public internal::IndexedViewCompatibleType<Indices,ColsAtCompileTime> {};
0032
0033 template<typename Indices>
0034 struct IvcType : public internal::IndexedViewCompatibleType<Indices,SizeAtCompileTime> {};
0035
0036 typedef typename internal::IndexedViewCompatibleType<Index,1>::type IvcIndex;
0037
0038 template<typename Indices>
0039 typename IvcRowType<Indices>::type
0040 ivcRow(const Indices& indices) const {
0041 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,RowsAtCompileTime>(derived().rows()),Specialized);
0042 }
0043
0044 template<typename Indices>
0045 typename IvcColType<Indices>::type
0046 ivcCol(const Indices& indices) const {
0047 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,ColsAtCompileTime>(derived().cols()),Specialized);
0048 }
0049
0050 template<typename Indices>
0051 typename IvcColType<Indices>::type
0052 ivcSize(const Indices& indices) const {
0053 return internal::makeIndexedViewCompatible(indices, internal::variable_if_dynamic<Index,SizeAtCompileTime>(derived().size()),Specialized);
0054 }
0055
0056 public:
0057
0058 #endif
0059
0060 template<typename RowIndices, typename ColIndices>
0061 struct EIGEN_INDEXED_VIEW_METHOD_TYPE {
0062 typedef IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,
0063 typename IvcRowType<RowIndices>::type,
0064 typename IvcColType<ColIndices>::type> type;
0065 };
0066
0067
0068
0069 template<typename RowIndices, typename ColIndices>
0070 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
0071 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsIndexedView,
0072 typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type >::type
0073 operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
0074 {
0075 return typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type
0076 (derived(), ivcRow(rowIndices), ivcCol(colIndices));
0077 }
0078
0079
0080
0081 template<typename RowIndices, typename ColIndices>
0082 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
0083 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsBlock,
0084 typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType>::type
0085 operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
0086 {
0087 typedef typename internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::BlockType BlockType;
0088 typename IvcRowType<RowIndices>::type actualRowIndices = ivcRow(rowIndices);
0089 typename IvcColType<ColIndices>::type actualColIndices = ivcCol(colIndices);
0090 return BlockType(derived(),
0091 internal::first(actualRowIndices),
0092 internal::first(actualColIndices),
0093 internal::size(actualRowIndices),
0094 internal::size(actualColIndices));
0095 }
0096
0097
0098
0099 template<typename RowIndices, typename ColIndices>
0100 typename internal::enable_if<internal::valid_indexed_view_overload<RowIndices,ColIndices>::value
0101 && internal::traits<typename EIGEN_INDEXED_VIEW_METHOD_TYPE<RowIndices,ColIndices>::type>::ReturnAsScalar,
0102 CoeffReturnType >::type
0103 operator()(const RowIndices& rowIndices, const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
0104 {
0105 return Base::operator()(internal::eval_expr_given_size(rowIndices,rows()),internal::eval_expr_given_size(colIndices,cols()));
0106 }
0107
0108 #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
0109
0110
0111
0112 template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
0113 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],typename IvcColType<ColIndices>::type>
0114 operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndices& colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST
0115 {
0116 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],typename IvcColType<ColIndices>::type>
0117 (derived(), rowIndices, ivcCol(colIndices));
0118 }
0119
0120 template<typename RowIndices, typename ColIndicesT, std::size_t ColIndicesN>
0121 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcRowType<RowIndices>::type, const ColIndicesT (&)[ColIndicesN]>
0122 operator()(const RowIndices& rowIndices, const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
0123 {
0124 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcRowType<RowIndices>::type,const ColIndicesT (&)[ColIndicesN]>
0125 (derived(), ivcRow(rowIndices), colIndices);
0126 }
0127
0128 template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndicesT, std::size_t ColIndicesN>
0129 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN], const ColIndicesT (&)[ColIndicesN]>
0130 operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&colIndices)[ColIndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
0131 {
0132 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const RowIndicesT (&)[RowIndicesN],const ColIndicesT (&)[ColIndicesN]>
0133 (derived(), rowIndices, colIndices);
0134 }
0135
0136 #endif
0137
0138
0139
0140 template<typename Indices>
0141 typename internal::enable_if<
0142 IsRowMajor && (!(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
0143 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type> >::type
0144 operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
0145 {
0146 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
0147 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,typename IvcType<Indices>::type>
0148 (derived(), IvcIndex(0), ivcCol(indices));
0149 }
0150
0151 template<typename Indices>
0152 typename internal::enable_if<
0153 (!IsRowMajor) && (!(internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1 || internal::is_valid_index_type<Indices>::value)),
0154 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcType<Indices>::type,IvcIndex> >::type
0155 operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
0156 {
0157 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
0158 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,typename IvcType<Indices>::type,IvcIndex>
0159 (derived(), ivcRow(indices), IvcIndex(0));
0160 }
0161
0162 template<typename Indices>
0163 typename internal::enable_if<
0164 (internal::get_compile_time_incr<typename IvcType<Indices>::type>::value==1) && (!internal::is_valid_index_type<Indices>::value) && (!symbolic::is_symbolic<Indices>::value),
0165 VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value> >::type
0166 operator()(const Indices& indices) EIGEN_INDEXED_VIEW_METHOD_CONST
0167 {
0168 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
0169 typename IvcType<Indices>::type actualIndices = ivcSize(indices);
0170 return VectorBlock<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,internal::array_size<Indices>::value>
0171 (derived(), internal::first(actualIndices), internal::size(actualIndices));
0172 }
0173
0174 template<typename IndexType>
0175 typename internal::enable_if<symbolic::is_symbolic<IndexType>::value, CoeffReturnType >::type
0176 operator()(const IndexType& id) EIGEN_INDEXED_VIEW_METHOD_CONST
0177 {
0178 return Base::operator()(internal::eval_expr_given_size(id,size()));
0179 }
0180
0181 #if EIGEN_HAS_STATIC_ARRAY_TEMPLATE
0182
0183 template<typename IndicesT, std::size_t IndicesN>
0184 typename internal::enable_if<IsRowMajor,
0185 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]> >::type
0186 operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
0187 {
0188 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
0189 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,IvcIndex,const IndicesT (&)[IndicesN]>
0190 (derived(), IvcIndex(0), indices);
0191 }
0192
0193 template<typename IndicesT, std::size_t IndicesN>
0194 typename internal::enable_if<!IsRowMajor,
0195 IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex> >::type
0196 operator()(const IndicesT (&indices)[IndicesN]) EIGEN_INDEXED_VIEW_METHOD_CONST
0197 {
0198 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
0199 return IndexedView<EIGEN_INDEXED_VIEW_METHOD_CONST Derived,const IndicesT (&)[IndicesN],IvcIndex>
0200 (derived(), indices, IvcIndex(0));
0201 }
0202
0203 #endif
0204
0205 #undef EIGEN_INDEXED_VIEW_METHOD_CONST
0206 #undef EIGEN_INDEXED_VIEW_METHOD_TYPE
0207
0208 #ifndef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS
0209 #define EIGEN_INDEXED_VIEW_METHOD_2ND_PASS
0210 #include "IndexedViewMethods.h"
0211 #undef EIGEN_INDEXED_VIEW_METHOD_2ND_PASS
0212 #endif
0213
0214 #else
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250 template<typename RowIndices, typename ColIndices>
0251 IndexedView_or_Block
0252 operator()(const RowIndices& rowIndices, const ColIndices& colIndices);
0253
0254
0255
0256
0257
0258 template<typename Indices>
0259 IndexedView_or_VectorBlock
0260 operator()(const Indices& indices);
0261
0262 #endif