diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-07-22 09:32:40 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-07-22 09:32:40 +0200 |
commit | 2a251ffab0f3abd1fcfe340a4bee61e352d83424 (patch) | |
tree | c8b0c8a99abab6aafb82e0cb8620e8a65f4b96d0 /Eigen/src/Core | |
parent | 9b729f93a10a43a498f4c10f8d80c31a94ae7a0c (diff) |
Implement evaluator for sparse-selfadjoint products
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/GeneralProduct.h | 16 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 24 | ||||
-rw-r--r-- | Eigen/src/Core/SelfAdjointView.h | 1 |
3 files changed, 22 insertions, 19 deletions
diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 4c1922741..76271a87d 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -62,14 +62,14 @@ template<typename Lhs, typename Rhs> struct product_type typedef typename remove_all<Lhs>::type _Lhs; typedef typename remove_all<Rhs>::type _Rhs; enum { - MaxRows = _Lhs::MaxRowsAtCompileTime, - Rows = _Lhs::RowsAtCompileTime, - MaxCols = _Rhs::MaxColsAtCompileTime, - Cols = _Rhs::ColsAtCompileTime, - MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime, - _Rhs::MaxRowsAtCompileTime), - Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime, - _Rhs::RowsAtCompileTime) + MaxRows = traits<_Lhs>::MaxRowsAtCompileTime, + Rows = traits<_Lhs>::RowsAtCompileTime, + MaxCols = traits<_Rhs>::MaxColsAtCompileTime, + Cols = traits<_Rhs>::ColsAtCompileTime, + MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::MaxColsAtCompileTime, + traits<_Rhs>::MaxRowsAtCompileTime), + Depth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::ColsAtCompileTime, + traits<_Rhs>::RowsAtCompileTime) }; // the splitting into different lines of code here, introducing the _select enums and the typedef below, diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index cb4d4c924..9e5e47d13 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -58,24 +58,26 @@ struct traits<Product<Lhs, Rhs, Option> > { typedef typename remove_all<Lhs>::type LhsCleaned; typedef typename remove_all<Rhs>::type RhsCleaned; + typedef traits<LhsCleaned> LhsTraits; + typedef traits<RhsCleaned> RhsTraits; typedef MatrixXpr XprKind; typedef typename product_result_scalar<LhsCleaned,RhsCleaned>::Scalar Scalar; - typedef typename product_promote_storage_type<typename traits<LhsCleaned>::StorageKind, - typename traits<RhsCleaned>::StorageKind, + typedef typename product_promote_storage_type<typename LhsTraits::StorageKind, + typename RhsTraits::StorageKind, internal::product_type<Lhs,Rhs>::ret>::ret StorageKind; - typedef typename promote_index_type<typename traits<LhsCleaned>::Index, - typename traits<RhsCleaned>::Index>::type Index; + typedef typename promote_index_type<typename LhsTraits::Index, + typename RhsTraits::Index>::type Index; enum { - RowsAtCompileTime = LhsCleaned::RowsAtCompileTime, - ColsAtCompileTime = RhsCleaned::ColsAtCompileTime, - MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime, - MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime, + RowsAtCompileTime = LhsTraits::RowsAtCompileTime, + ColsAtCompileTime = RhsTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, // FIXME: only needed by GeneralMatrixMatrixTriangular - InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsCleaned::ColsAtCompileTime, RhsCleaned::RowsAtCompileTime), + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), #ifndef EIGEN_TEST_EVALUATORS // dummy, for evaluators unit test only @@ -84,8 +86,8 @@ struct traits<Product<Lhs, Rhs, Option> > // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. Flags = ( MaxRowsAtCompileTime==1 - || ((LhsCleaned::Flags&NoPreferredStorageOrderBit) && (RhsCleaned::Flags&RowMajorBit)) - || ((RhsCleaned::Flags&NoPreferredStorageOrderBit) && (LhsCleaned::Flags&RowMajorBit)) ) + || ((LhsTraits::Flags&NoPreferredStorageOrderBit) && (RhsTraits::Flags&RowMajorBit)) + || ((RhsTraits::Flags&NoPreferredStorageOrderBit) && (LhsTraits::Flags&RowMajorBit)) ) ? RowMajorBit : (MaxColsAtCompileTime==1 ? 0 : NoPreferredStorageOrderBit) }; }; diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index 9319ad87c..c8bdec5d4 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -328,6 +328,7 @@ struct triangular_assignment_selector<Derived1, Derived2, SelfAdjoint|Lower, Dyn #endif // EIGEN_TEST_EVALUATORS #ifdef EIGEN_ENABLE_EVALUATORS + // TODO currently a selfadjoint expression has the form SelfAdjointView<.,.> // in the future selfadjoint-ness should be defined by the expression traits // such that Transpose<SelfAdjointView<.,.> > is valid. (currently TriangularBase::transpose() is overloaded to make it work) |