diff options
author | 2010-03-19 02:12:23 -0400 | |
---|---|---|
committer | 2010-03-19 02:12:23 -0400 | |
commit | 547269da3560518807efe902bce07d22db03e039 (patch) | |
tree | 0977e39381ecb056ddbbd3e34efc76f774df009f /Eigen/src/Core/util | |
parent | 9dba86df0b5c1d28a18666003a10f53e59154904 (diff) |
fix the flags and matrix options, to always have the right RowMajor bit in the vector case
Diffstat (limited to 'Eigen/src/Core/util')
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 5 | ||||
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 38 |
2 files changed, 36 insertions, 7 deletions
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index eb7e93b91..3218f1e49 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -137,7 +137,10 @@ struct IOFormat; // Array module template<typename _Scalar, int _Rows, int _Cols, - int _Options = EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION | AutoAlign, + int _Options = AutoAlign | + ( (_Rows==1 && _Cols!=1) ? RowMajor + : (_Cols==1 && _Rows!=1) ? ColMajor + : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ), int _MaxRows = _Rows, int _MaxCols = _Cols> class Array; template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType> class Select; template<typename MatrixType, typename BinaryOp, int Direction> class PartialReduxExpr; diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 4259ebb92..83104551f 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -185,16 +185,16 @@ template<typename T> struct ei_eval<T,Dense> }; // 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>, Dense> +template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> +struct ei_eval<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense> { - typedef const Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>& type; + typedef const Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type; }; -template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols> -struct ei_eval<Array<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>, Dense> +template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> +struct ei_eval<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>, Dense> { - typedef const Array<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>& type; + typedef const Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>& type; }; @@ -355,4 +355,30 @@ template <typename A> struct ei_promote_storage_type<A,A> typedef A ret; }; +/** \internal gives the plain matrix type to store a row/column/diagonal of a matrix type. + * \param Scalar optional parameter allowing to pass a different scalar type than the one of the MatrixType. + */ +template<typename MatrixType, typename Scalar = typename MatrixType::Scalar> +struct ei_plain_row_type +{ + typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime, + MatrixType::PlainObject::Options | RowMajor, 1, MatrixType::MaxColsAtCompileTime> type; +}; + +template<typename MatrixType, typename Scalar = typename MatrixType::Scalar> +struct ei_plain_col_type +{ + typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1, + MatrixType::PlainObject::Options & ~RowMajor, MatrixType::MaxRowsAtCompileTime, 1> type; +}; + +template<typename MatrixType, typename Scalar = typename MatrixType::Scalar> +struct ei_plain_diag_type +{ + enum { diag_size = EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime), + max_diag_size = EIGEN_SIZE_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) + }; + typedef Matrix<Scalar, diag_size, 1, MatrixType::PlainObject::Options & ~RowMajor, max_diag_size, 1> type; +}; + #endif // EIGEN_XPRHELPER_H |