aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/DenseBase.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2017-01-10 21:45:55 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2017-01-10 21:45:55 +0100
commit17eac60446650dc31bde7156a4febe504ab347b7 (patch)
tree26bc8e9c39e09dc2b40b13d0c3927bb722ccc7a8 /Eigen/src/Core/DenseBase.h
parentd072fc4b1432b193d24e44d70885b636d4132405 (diff)
Factorize const and non-const version of the generic operator() method.
Diffstat (limited to 'Eigen/src/Core/DenseBase.h')
-rw-r--r--Eigen/src/Core/DenseBase.h105
1 files changed, 1 insertions, 104 deletions
diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h
index 909fa0f12..a8229cf03 100644
--- a/Eigen/src/Core/DenseBase.h
+++ b/Eigen/src/Core/DenseBase.h
@@ -557,116 +557,13 @@ template<typename Derived> class DenseBase
}
EIGEN_DEVICE_FUNC void reverseInPlace();
- template<typename RowIndices, typename ColIndices>
- struct ConstIndexedViewType {
- typedef IndexedView<const Derived,typename internal::MakeIndexing<RowIndices>::type,typename internal::MakeIndexing<ColIndices>::type> type;
- };
-
- template<typename RowIndices, typename ColIndices>
- typename internal::enable_if<
- ! (internal::traits<typename ConstIndexedViewType<RowIndices,ColIndices>::type>::IsBlockAlike
- || (internal::is_integral<RowIndices>::value && internal::is_integral<ColIndices>::value)),
- typename ConstIndexedViewType<RowIndices,ColIndices>::type >::type
- operator()(const RowIndices& rowIndices, const ColIndices& colIndices) const {
- return typename ConstIndexedViewType<RowIndices,ColIndices>::type(
- derived(), internal::make_indexing(rowIndices,derived().rows()), internal::make_indexing(colIndices,derived().cols()));
- }
-
- template<typename RowIndices, typename ColIndices>
- typename internal::enable_if<
- internal::traits<typename ConstIndexedViewType<RowIndices,ColIndices>::type>::IsBlockAlike
- && !(internal::is_integral<RowIndices>::value && internal::is_integral<ColIndices>::value),
- typename internal::traits<typename ConstIndexedViewType<RowIndices,ColIndices>::type>::BlockType>::type
- operator()(const RowIndices& rowIndices, const ColIndices& colIndices) const {
- typedef typename internal::traits<typename ConstIndexedViewType<RowIndices,ColIndices>::type>::BlockType BlockType;
- typename internal::MakeIndexing<RowIndices>::type actualRowIndices = internal::make_indexing(rowIndices,derived().rows());
- typename internal::MakeIndexing<ColIndices>::type actualColIndices = internal::make_indexing(colIndices,derived().cols());
- return BlockType(derived(),
- internal::first(actualRowIndices),
- internal::first(actualColIndices),
- internal::size(actualRowIndices),
- internal::size(actualColIndices));
- }
-
- template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
- IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>
- operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndices& colIndices) const {
- return IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>(
- derived(), rowIndices, internal::make_indexing(colIndices,derived().cols()));
- }
-
- template<typename RowIndices, typename ColIndicesT, std::size_t ColIndicesN>
- IndexedView<const Derived,typename internal::MakeIndexing<RowIndices>::type, const ColIndicesT (&)[ColIndicesN]>
- operator()(const RowIndices& rowIndices, const ColIndicesT (&colIndices)[ColIndicesN]) const {
- return IndexedView<const Derived,typename internal::MakeIndexing<RowIndices>::type,const ColIndicesT (&)[ColIndicesN]>(
- derived(), internal::make_indexing(rowIndices,derived().rows()), colIndices);
- }
-
- template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndicesT, std::size_t ColIndicesN>
- IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN], const ColIndicesT (&)[ColIndicesN]>
- operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&colIndices)[ColIndicesN]) const {
- return IndexedView<const Derived,const RowIndicesT (&)[RowIndicesN],const ColIndicesT (&)[ColIndicesN]>(
- derived(), rowIndices, colIndices);
- }
-
- template<typename RowIndices, typename ColIndices>
- struct IndexedViewType {
- typedef IndexedView<Derived,typename internal::MakeIndexing<RowIndices>::type,typename internal::MakeIndexing<ColIndices>::type> type;
- };
-
- template<typename RowIndices, typename ColIndices>
- typename internal::enable_if<
- ! (internal::traits<typename IndexedViewType<RowIndices,ColIndices>::type>::IsBlockAlike
- || (internal::is_integral<RowIndices>::value && internal::is_integral<ColIndices>::value)),
- typename IndexedViewType<RowIndices,ColIndices>::type >::type
- operator()(const RowIndices& rowIndices, const ColIndices& colIndices) {
- return typename IndexedViewType<RowIndices,ColIndices>::type(
- derived(), internal::make_indexing(rowIndices,derived().rows()), internal::make_indexing(colIndices,derived().cols()));
- }
-
- template<typename RowIndices, typename ColIndices>
- typename internal::enable_if<
- internal::traits<typename IndexedViewType<RowIndices,ColIndices>::type>::IsBlockAlike
- && !(internal::is_integral<RowIndices>::value && internal::is_integral<ColIndices>::value),
- typename internal::traits<typename IndexedViewType<RowIndices,ColIndices>::type>::BlockType>::type
- operator()(const RowIndices& rowIndices, const ColIndices& colIndices) {
- typedef typename internal::traits<typename IndexedViewType<RowIndices,ColIndices>::type>::BlockType BlockType;
- typename internal::MakeIndexing<RowIndices>::type actualRowIndices = internal::make_indexing(rowIndices,derived().rows());
- typename internal::MakeIndexing<ColIndices>::type actualColIndices = internal::make_indexing(colIndices,derived().cols());
- return BlockType(derived(),
- internal::first(actualRowIndices),
- internal::first(actualColIndices),
- internal::size(actualRowIndices),
- internal::size(actualColIndices));
- }
-
- template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndices>
- IndexedView<Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>
- operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndices& colIndices) {
- return IndexedView<Derived,const RowIndicesT (&)[RowIndicesN],typename internal::MakeIndexing<ColIndices>::type>(
- derived(), rowIndices, internal::make_indexing(colIndices,derived().cols()));
- }
-
- template<typename RowIndices, typename ColIndicesT, std::size_t ColIndicesN>
- IndexedView<Derived,typename internal::MakeIndexing<RowIndices>::type, const ColIndicesT (&)[ColIndicesN]>
- operator()(const RowIndices& rowIndices, const ColIndicesT (&colIndices)[ColIndicesN]) {
- return IndexedView<Derived,typename internal::MakeIndexing<RowIndices>::type,const ColIndicesT (&)[ColIndicesN]>(
- derived(), internal::make_indexing(rowIndices,derived().rows()), colIndices);
- }
-
- template<typename RowIndicesT, std::size_t RowIndicesN, typename ColIndicesT, std::size_t ColIndicesN>
- IndexedView<Derived,const RowIndicesT (&)[RowIndicesN], const ColIndicesT (&)[ColIndicesN]>
- operator()(const RowIndicesT (&rowIndices)[RowIndicesN], const ColIndicesT (&colIndices)[ColIndicesN]) {
- return IndexedView<Derived,const RowIndicesT (&)[RowIndicesN],const ColIndicesT (&)[ColIndicesN]>(
- derived(), rowIndices, colIndices);
- }
-
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase
#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL
#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)
#define EIGEN_DOC_UNARY_ADDONS(X,Y)
# include "../plugins/CommonCwiseUnaryOps.h"
# include "../plugins/BlockMethods.h"
+# include "../plugins/IndexedViewMethods.h"
# ifdef EIGEN_DENSEBASE_PLUGIN
# include EIGEN_DENSEBASE_PLUGIN
# endif