* update sparse module wrt new diagonal matrix impl

* fix a bug is SparseMatrix
This commit is contained in:
Gael Guennebaud
2009-07-04 11:16:27 +02:00
parent 2de9b7f537
commit 08e419dcb1
8 changed files with 75 additions and 44 deletions

View File

@@ -38,7 +38,8 @@ class DiagonalBase : public MultiplierBase<Derived>
ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime,
MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime,
IsVectorAtCompileTime = 0
IsVectorAtCompileTime = 0,
Flags = 0
};
typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, 0, MaxRowsAtCompileTime, MaxColsAtCompileTime> DenseMatrixType;
@@ -52,6 +53,9 @@ class DiagonalBase : public MultiplierBase<Derived>
inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }
inline DiagonalVectorType& diagonal() { return derived().diagonal(); }
inline int rows() const { return diagonal().size(); }
inline int cols() const { return diagonal().size(); }
template<typename MatrixDerived>
const DiagonalProduct<MatrixDerived, Derived, DiagonalOnTheLeft>

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -185,9 +185,6 @@ const unsigned int HereditaryBits = RowMajorBit
| EvalBeforeNestingBit
| EvalBeforeAssigningBit
| SparseBit;
// diagonal means both upper and lower triangular
const unsigned DiagonalBits = UpperTriangularBit | LowerTriangularBit;
// Possible values for the Mode parameter of part()
const unsigned int UpperTriangular = UpperTriangularBit;
@@ -198,13 +195,6 @@ const unsigned int SelfAdjoint = SelfAdjointBit;
const unsigned int UnitUpperTriangular = UpperTriangularBit | UnitDiagBit;
const unsigned int UnitLowerTriangular = LowerTriangularBit | UnitDiagBit;
template<typename T> struct ei_is_diagonal
{
enum {
ret = ( (unsigned int)(T::Flags) & DiagonalBits ) == DiagonalBits
};
};
enum { DiagonalOnTheLeft, DiagonalOnTheRight };
enum { Aligned, Unaligned };

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2008-2009 Gael Guennebaud <g.gael@free.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// Eigen is free software; you can redistribute it and/or
@@ -186,6 +186,16 @@ struct ei_result_of<ei_scalar_product_op<Scalar>(ArgType0,ArgType1)> {
typedef typename ei_scalar_product_traits<typename ei_cleantype<ArgType0>::type, typename ei_cleantype<ArgType1>::type>::ReturnType type;
};
template<typename T> struct ei_is_diagonal
{ enum { ret = false }; };
template<typename T> struct ei_is_diagonal<DiagonalBase<T> >
{ enum { ret = true }; };
template<typename T> struct ei_is_diagonal<DiagonalWrapper<T> >
{ enum { ret = true }; };
template<typename T, int S> struct ei_is_diagonal<DiagonalMatrix<T,S> >
{ enum { ret = true }; };
#endif // EIGEN_META_H