Added ArrayBit to get the ability to manipulate a Matrix like a simple scalar.

In particular this flag changes the behavior of operator* to a coeff wise product.
This commit is contained in:
Gael Guennebaud
2008-05-29 22:33:07 +00:00
parent b501e08d81
commit e2ac5d244e
7 changed files with 78 additions and 20 deletions

View File

@@ -42,15 +42,17 @@ const unsigned int Like1DArrayBit = 0x20; ///< means the expression can be see
const unsigned int ZeroDiagBit = 0x40; ///< means all diagonal coefficients are equal to 0
const unsigned int UnitDiagBit = 0x80; ///< means all diagonal coefficients are equal to 1
const unsigned int SelfAdjointBit = 0x100; ///< means the matrix is selfadjoint (M=M*).
const unsigned int UpperTriangularBit = 0x200; ///< means the strictly triangular lower part is 0
const unsigned int LowerTriangularBit = 0x400; ///< means the strictly triangular upper part is 0
const unsigned int DirectAccessBit = 0x800; ///< means the underlying matrix data can be direclty accessed
const unsigned int UpperTriangularBit = 0x200; ///< means the strictly triangular lower part is 0
const unsigned int LowerTriangularBit = 0x400; ///< means the strictly triangular upper part is 0
const unsigned int DirectAccessBit = 0x800; ///< means the underlying matrix data can be direclty accessed
const unsigned int ArrayBit = 0x1000; ///< means the underlying matrix data can be direclty accessed
// list of flags that are inherited by default
const unsigned int HereditaryBits = RowMajorBit
| EvalBeforeNestingBit
| EvalBeforeAssigningBit
| LargeBit;
| LargeBit
| ArrayBit;
// Possible values for the Mode parameter of part() and of extract()
const unsigned int Upper = UpperTriangularBit;

View File

@@ -50,6 +50,7 @@ template<typename MatrixType> class Map;
template<int Direction, typename UnaryOp, typename MatrixType> class PartialRedux;
template<typename MatrixType, unsigned int Mode> class Part;
template<typename MatrixType, unsigned int Mode> class Extract;
template<typename Derived, bool HasArrayFlag = int(ei_traits<Derived>::Flags) & ArrayBit> class ArrayBase;
template<typename Scalar> struct ei_scalar_sum_op;

View File

@@ -202,8 +202,8 @@ template<typename T, int n=1> struct ei_nested
ei_must_nest_by_value<T>::ret,
T,
typename ei_meta_if<
int(ei_traits<T>::Flags) & EvalBeforeNestingBit
|| (n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost) < (n-1) * int(T::CoeffReadCost),
(int(ei_traits<T>::Flags) & EvalBeforeNestingBit)
|| ((n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost) < (n-1) * int(T::CoeffReadCost)),
typename ei_eval<T>::type,
const T&
>::ret