various work on the Sparse module:

* added some glue to Eigen/Core (SparseBit, ei_eval, Matrix)
* add two new sparse matrix types:
   HashMatrix: based on std::map (for random writes)
   LinkedVectorMatrix: array of linked vectors
   (for outer coherent writes, e.g. to transpose a matrix)
* add a SparseSetter class to easily set/update any kind of matrices, e.g.:
   { SparseSetter<MatrixType,RandomAccessPattern> wrapper(mymatrix);
     for (...) wrapper->coeffRef(rand(),rand()) = rand(); }
* automatic shallow copy for RValue
* and a lot of mess !
plus:
* remove the remaining ArrayBit related stuff
* don't use alloca in product for very large memory allocation
This commit is contained in:
Gael Guennebaud
2008-06-26 23:22:26 +00:00
parent c5bd1703cb
commit e5d301dc96
17 changed files with 1226 additions and 169 deletions

View File

@@ -138,10 +138,8 @@ const unsigned int LowerTriangularBit = 0x400;
/** \ingroup flags
*
* means the object is just an array of scalars, and operations on it are regarded as operations
* on every of these scalars taken separately.
*/
const unsigned int ArrayBit = 0x800;
* means the expression includes sparse matrices and the sparse path has to be taken. */
const unsigned int SparseBit = 0x800;
/** \ingroup flags
*
@@ -155,7 +153,7 @@ const unsigned int HereditaryBits = RowMajorBit
| EvalBeforeNestingBit
| EvalBeforeAssigningBit
| LargeBit
| ArrayBit;
| SparseBit;
// Possible values for the Mode parameter of part() and of extract()
const unsigned int Upper = UpperTriangularBit;
@@ -173,7 +171,7 @@ enum { Aligned=0, UnAligned=1 };
enum { ConditionalJumpCost = 5 };
enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight };
enum DirectionType { Vertical, Horizontal };
enum ProductEvaluationMode { NormalProduct, CacheFriendlyProduct, DiagonalProduct };
enum ProductEvaluationMode { NormalProduct, CacheFriendlyProduct, DiagonalProduct, SparseProduct };
enum {
InnerVectorization,
@@ -188,5 +186,14 @@ enum {
NoUnrolling
};
enum {
Dense = 0,
Sparse = SparseBit
};
const int FullyCoherentAccessPattern = 0x1;
const int InnerCoherentAccessPattern = 0x2 | FullyCoherentAccessPattern;
const int OuterCoherentAccessPattern = 0x4 | InnerCoherentAccessPattern;
const int RandomAccessPattern = 0x8 | OuterCoherentAccessPattern;
#endif // EIGEN_CONSTANTS_H

View File

@@ -175,7 +175,9 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
enum { ret = (_Rows==Dynamic || _Cols==Dynamic) ? Dynamic : _Rows * _Cols };
};
template<typename T> class ei_eval
template<typename T, int Sparseness = ei_traits<T>::Flags&SparseBit> class ei_eval;
template<typename T> class ei_eval<T,Dense>
{
typedef typename ei_traits<T>::Scalar _Scalar;
enum {_Rows = ei_traits<T>::RowsAtCompileTime,