* 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

@@ -158,7 +158,9 @@ template<typename XprType> struct ei_blas_traits
IsComplex = NumTraits<Scalar>::IsComplex,
IsTransposed = false,
NeedToConjugate = false,
ActualAccess = int(ei_traits<XprType>::Flags)&DirectAccessBit ? HasDirectAccess : NoDirectAccess
ActualAccess = ( (int(ei_traits<XprType>::Flags)&DirectAccessBit)
&& (int(ei_inner_stride_at_compile_time<XprType>::ret) == 1)
) ? HasDirectAccess : NoDirectAccess
};
typedef typename ei_meta_if<int(ActualAccess)==HasDirectAccess,
ExtractType,

View File

@@ -97,8 +97,6 @@ const unsigned int EvalBeforeAssigningBit = 0x4;
*/
const unsigned int PacketAccessBit = 0x8;
const unsigned int NestByRefBit = 0x100;
#ifdef EIGEN_VECTORIZE
/** \ingroup flags
*
@@ -151,6 +149,7 @@ const unsigned int DirectAccessBit = 0x20;
* means the first coefficient packet is guaranteed to be aligned */
const unsigned int AlignedBit = 0x40;
const unsigned int NestByRefBit = 0x100;
// list of flags that are inherited by default
const unsigned int HereditaryBits = RowMajorBit
@@ -266,9 +265,15 @@ namespace Architecture
};
}
enum DenseStorageMatrix {};
enum DenseStorageArray {};
enum { CoeffBasedProductMode, LazyCoeffBasedProductMode, OuterProduct, InnerProduct, GemvProduct, GemmProduct };
/** The type used to identify a dense storage. */
struct Dense {};
/** The type used to identify a matrix expression */
struct MatrixXpr {};
/** The type used to identify an array expression */
struct ArrayXpr {};
#endif // EIGEN_CONSTANTS_H

View File

@@ -40,6 +40,9 @@ template<typename _Scalar, int _Rows, int _Cols,
int _MaxCols = _Cols
> class Matrix;
template<typename Derived> class MatrixBase;
template<typename Derived> class ArrayBase;
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
template<typename ExpressionType, template <typename> class StorageBase > class NoAlias;
template<typename ExpressionType> class NestByValue;

View File

@@ -136,14 +136,14 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
* whereas ei_eval is a const reference in the case of a matrix
*/
template<typename T, typename StorageType = typename ei_traits<T>::StorageType> struct ei_plain_matrix_type;
template<typename T, typename StorageKind = typename ei_traits<T>::StorageKind> struct ei_plain_matrix_type;
template<typename T, typename BaseClassType> struct ei_plain_matrix_type_dense;
template<typename T> struct ei_plain_matrix_type<T,Dense>
{
typedef typename ei_plain_matrix_type_dense<T,typename ei_traits<T>::DenseStorageType>::type type;
typedef typename ei_plain_matrix_type_dense<T,typename ei_traits<T>::XprKind>::type type;
};
template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageMatrix>
template<typename T> struct ei_plain_matrix_type_dense<T,MatrixXpr>
{
typedef Matrix<typename ei_traits<T>::Scalar,
ei_traits<T>::RowsAtCompileTime,
@@ -154,7 +154,7 @@ template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageMatrix>
> type;
};
template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageArray>
template<typename T> struct ei_plain_matrix_type_dense<T,ArrayXpr>
{
typedef Array<typename ei_traits<T>::Scalar,
ei_traits<T>::RowsAtCompileTime,
@@ -169,7 +169,7 @@ template<typename T> struct ei_plain_matrix_type_dense<T,DenseStorageArray>
* in order to avoid a useless copy
*/
template<typename T, typename StorageType = typename ei_traits<T>::StorageType> struct ei_eval;
template<typename T, typename StorageKind = typename ei_traits<T>::StorageKind> struct ei_eval;
template<typename T> struct ei_eval<T,Dense>
{
@@ -204,14 +204,16 @@ struct ei_eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense
template<typename T> struct ei_plain_matrix_type_column_major
{
enum { Rows = ei_traits<T>::RowsAtCompileTime,
Cols = ei_traits<T>::ColsAtCompileTime
Cols = ei_traits<T>::ColsAtCompileTime,
MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
MaxCols = ei_traits<T>::MaxColsAtCompileTime
};
typedef Matrix<typename ei_traits<T>::Scalar,
Rows,
Cols,
(Rows==1&&Cols!=1) ? RowMajor : ColMajor,
ei_traits<T>::MaxRowsAtCompileTime,
ei_traits<T>::MaxColsAtCompileTime
(MaxRows==1&&MaxCols!=1) ? RowMajor : ColMajor,
MaxRows,
MaxCols
> type;
};
@@ -220,14 +222,16 @@ template<typename T> struct ei_plain_matrix_type_column_major
template<typename T> struct ei_plain_matrix_type_row_major
{
enum { Rows = ei_traits<T>::RowsAtCompileTime,
Cols = ei_traits<T>::ColsAtCompileTime
Cols = ei_traits<T>::ColsAtCompileTime,
MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
MaxCols = ei_traits<T>::MaxColsAtCompileTime
};
typedef Matrix<typename ei_traits<T>::Scalar,
Rows,
Cols,
(Cols==1&&Rows!=1) ? ColMajor : RowMajor,
ei_traits<T>::MaxRowsAtCompileTime,
ei_traits<T>::MaxColsAtCompileTime
(MaxCols==1&&MaxRows!=1) ? RowMajor : ColMajor,
MaxRows,
MaxCols
> type;
};