more ET refactoring:

* extend Cwise for multiple storage base class
* a lot of cleaning in the Sparse module
This commit is contained in:
Gael Guennebaud
2009-11-17 16:04:19 +01:00
parent 63bcc1c0fb
commit 1e62e0b0d8
27 changed files with 180 additions and 552 deletions

View File

@@ -174,16 +174,10 @@ const unsigned int UpperTriangularBit = 0x400;
* means the strictly upper triangular part is 0 */
const unsigned int LowerTriangularBit = 0x800;
/** \ingroup flags
*
* means the expression includes sparse matrices and the sparse path has to be taken. */
const unsigned int SparseBit = 0x1000;
// list of flags that are inherited by default
const unsigned int HereditaryBits = RowMajorBit
| EvalBeforeNestingBit
| EvalBeforeAssigningBit
| SparseBit;
| EvalBeforeAssigningBit;
// Possible values for the Mode parameter of part()
const unsigned int UpperTriangular = UpperTriangularBit;
@@ -262,7 +256,7 @@ namespace {
enum {
IsDense = 0,
IsSparse = SparseBit,
IsSparse,
NoDirectAccess = 0,
HasDirectAccess = DirectAccessBit
};

View File

@@ -35,13 +35,12 @@ template<typename _Scalar, int _Rows, int _Cols,
int _MaxRows = _Rows, int _MaxCols = _Cols> class Matrix;
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
template<typename ExpressionType> class NoAlias;
template<typename ExpressionType, template <typename> class StorageBase > class NoAlias;
template<typename ExpressionType> class NestByValue;
template<typename ExpressionType> class SwapWrapper;
template<typename MatrixType> class Minor;
template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic, int PacketAccess=AsRequested,
int _DirectAccessStatus = ei_traits<MatrixType>::Flags&DirectAccessBit ? DirectAccessBit
: ei_traits<MatrixType>::Flags&SparseBit> class Block;
int _DirectAccessStatus = (ei_traits<MatrixType>::Flags&DirectAccessBit) ? HasDirectAccess : NoDirectAccess> class Block;
template<typename MatrixType, int Size=Dynamic, int PacketAccess=AsRequested> class VectorBlock;
template<typename MatrixType> class Transpose;
template<typename MatrixType> class Conjugate;
@@ -61,7 +60,7 @@ template<typename MatrixType, int PacketAccess = AsRequested> class Map;
template<typename Derived> class TriangularBase;
template<typename MatrixType, unsigned int Mode> class TriangularView;
template<typename MatrixType, unsigned int Mode> class SelfAdjointView;
template<typename ExpressionType> class Cwise;
template<typename ExpressionType, template <typename> class StorageBase> class Cwise;
template<typename ExpressionType> class WithFormat;
template<typename MatrixType> struct CommaInitializer;
template<typename Derived> class ReturnByValue;

View File

@@ -108,9 +108,9 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
* in order to avoid a useless copy
*/
template<typename T, int Sparseness = ei_traits<T>::Flags&SparseBit> class ei_eval;
template<typename T, typename StorageType = typename ei_traits<T>::StorageType> class ei_eval;
template<typename T> struct ei_eval<T,IsDense>
template<typename T> struct ei_eval<T,Dense>
{
typedef Matrix<typename ei_traits<T>::Scalar,
ei_traits<T>::RowsAtCompileTime,
@@ -123,7 +123,7 @@ template<typename T> struct ei_eval<T,IsDense>
// for matrices, no need to evaluate, just use a const reference to avoid a useless copy
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>, IsDense>
struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>, Dense>
{
typedef const Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>& type;
};