* Refactoring of the class hierarchy: introduction of DenseDirectAccessBase, removal of extra _Base/_Options template parameters.

* Introduction of strides-at-compile-time so for example the optimized code really knows when it needs to evaluate to a temporary
* StorageKind / XprKind
* Quaternion::setFromTwoVectors: use JacobiSVD instead of SVD
* ComplexSchur: support the 1x1 case
This commit is contained in:
Benoit Jacob
2010-04-16 10:13:32 -04:00
parent 1803db6e84
commit ff6a46105d
43 changed files with 269 additions and 229 deletions

View File

@@ -28,16 +28,17 @@
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct ei_traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : ei_traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
typedef DenseStorageArray DenseStorageType;
typedef ArrayXpr XprKind;
typedef ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > XprBase;
};
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
class Array
: public DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, ArrayBase, _Options>
: public DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
{
public:
typedef DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Eigen::ArrayBase, _Options> Base;
typedef DenseStorageBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > Base;
EIGEN_DENSE_PUBLIC_INTERFACE(Array)
enum { Options = _Options };

View File

@@ -38,7 +38,7 @@ template<typename ExpressionType>
struct ei_traits<ArrayWrapper<ExpressionType> >
: public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
{
typedef DenseStorageArray DenseStorageType;
typedef ArrayXpr XprKind;
};
template<typename ExpressionType>
@@ -123,7 +123,7 @@ template<typename ExpressionType>
struct ei_traits<MatrixWrapper<ExpressionType> >
: public ei_traits<typename ei_cleantype<typename ExpressionType::Nested>::type >
{
typedef DenseStorageMatrix DenseStorageType;
typedef MatrixXpr XprKind;
};
template<typename ExpressionType>

View File

@@ -136,9 +136,9 @@ inline Derived& DenseBase<Derived>::setRandom()
*
* \sa MatrixBase::setRandom(), setRandom(int,int), class CwiseNullaryOp, MatrixBase::Random()
*/
template<typename Derived, template<typename> class _Base, int _Options>
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
DenseStorageBase<Derived,_Base,_Options>::setRandom(int size)
DenseStorageBase<Derived>::setRandom(int size)
{
resize(size);
return setRandom();
@@ -154,9 +154,9 @@ DenseStorageBase<Derived,_Base,_Options>::setRandom(int size)
*
* \sa MatrixBase::setRandom(), setRandom(int), class CwiseNullaryOp, MatrixBase::Random()
*/
template<typename Derived, template<typename> class _Base, int _Options>
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
DenseStorageBase<Derived,_Base,_Options>::setRandom(int rows, int cols)
DenseStorageBase<Derived>::setRandom(int rows, int cols)
{
resize(rows, cols);
return setRandom();

View File

@@ -43,7 +43,7 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
: ei_traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {
@@ -53,10 +53,11 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic
? Dynamic
: ColFactor * MatrixType::ColsAtCompileTime,
//FIXME we don't propagate the max sizes !!!
MaxRowsAtCompileTime = RowsAtCompileTime,
MaxColsAtCompileTime = ColsAtCompileTime,
IsRowMajor = RowsAtCompileTime==1 && ColsAtCompileTime!=1 ? 1
: ColsAtCompileTime==1 && RowsAtCompileTime!=1 ? 0
IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1
: MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0
: (MatrixType::Flags & RowMajorBit) ? 1 : 0,
Flags = (_MatrixTypeNested::Flags & HereditaryBits & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0),
CoeffReadCost = _MatrixTypeNested::CoeffReadCost

View File

@@ -46,7 +46,7 @@ struct ei_traits<Reverse<MatrixType, Direction> >
: ei_traits<MatrixType>
{
typedef typename MatrixType::Scalar Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
enum {

View File

@@ -46,7 +46,7 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
: ei_traits<ThenMatrixType>
{
typedef typename ei_traits<ThenMatrixType>::Scalar Scalar;
typedef Dense StorageType;
typedef Dense StorageKind;
typedef typename ConditionMatrixType::Nested ConditionMatrixNested;
typedef typename ThenMatrixType::Nested ThenMatrixNested;
typedef typename ElseMatrixType::Nested ElseMatrixNested;

View File

@@ -51,7 +51,7 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
: ei_traits<MatrixType>
{
typedef typename MemberOp::result_type Scalar;
typedef typename ei_traits<MatrixType>::StorageType StorageType;
typedef typename ei_traits<MatrixType>::StorageKind StorageKind;
typedef typename MatrixType::Scalar InputScalar;
typedef typename ei_nested<MatrixType>::type MatrixTypeNested;
typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;