extend the DenseStorageMatrix mechanism to all expressions

This commit is contained in:
Gael Guennebaud
2009-12-22 17:37:11 +01:00
parent af4d8c5cec
commit e182e9c616
16 changed files with 20 additions and 22 deletions

View File

@@ -546,7 +546,7 @@ struct ei_conservative_resize_like_impl
EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived)
typename DenseBase<Derived>::PlainMatrixType tmp(other);
typename Derived::PlainMatrixType tmp(other);
const int common_rows = std::min(tmp.rows(), _this.rows());
const int common_cols = std::min(tmp.cols(), _this.cols());
tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
@@ -562,7 +562,7 @@ struct ei_conservative_resize_like_impl<Derived,OtherDerived,true>
if (_this.rows() == other.rows() && _this.cols() == other.cols()) return;
// segment(...) will check whether Derived/OtherDerived are vectors!
typename DenseBase<Derived>::PlainMatrixType tmp(other);
typename Derived::PlainMatrixType tmp(other);
const int common_size = std::min<int>(_this.size(),tmp.size());
tmp.segment(0,common_size) = _this.segment(0,common_size);
_this.derived().swap(tmp);

View File

@@ -44,9 +44,8 @@
*/
template<typename MatrixType, int Index>
struct ei_traits<Diagonal<MatrixType,Index> >
: ei_traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {

View File

@@ -28,9 +28,9 @@
template<typename MatrixType, typename DiagonalType, int ProductOrder>
struct ei_traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
: ei_traits<MatrixType>
{
typedef typename ei_scalar_product_traits<typename MatrixType::Scalar, typename DiagonalType::Scalar>::ReturnType Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
enum {
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
ColsAtCompileTime = MatrixType::ColsAtCompileTime,

View File

@@ -40,9 +40,8 @@
*/
template<typename MatrixType>
struct ei_traits<Minor<MatrixType> >
: ei_traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {

View File

@@ -29,7 +29,7 @@
*
*/
template<typename Derived, typename _Lhs, typename _Rhs>
struct ei_traits<ProductBase<Derived,_Lhs,_Rhs> >
struct ei_traits<ProductBase<Derived,_Lhs,_Rhs> > : ei_traits<typename ei_cleantype<_Lhs>::type>
{
typedef typename ei_cleantype<_Lhs>::type Lhs;
typedef typename ei_cleantype<_Rhs>::type Rhs;

View File

@@ -38,7 +38,7 @@
* \sa MatrixBase::transpose(), MatrixBase::adjoint()
*/
template<typename MatrixType>
struct ei_traits<Transpose<MatrixType> >
struct ei_traits<Transpose<MatrixType> > : ei_traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;

View File

@@ -45,6 +45,7 @@ struct ei_product_packet_impl;
template<typename LhsNested, typename RhsNested>
struct ei_traits<GeneralProduct<LhsNested,RhsNested,UnrolledProduct> >
{
typedef DenseStorageMatrix DenseStorageType;
typedef typename ei_cleantype<LhsNested>::type _LhsNested;
typedef typename ei_cleantype<RhsNested>::type _RhsNested;
typedef typename ei_scalar_product_traits<typename _LhsNested::Scalar, typename _RhsNested::Scalar>::ReturnType Scalar;