mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #626: add compiletime check of the Options template parameter of SparseMatrix and SparseVector. Fix eval and plain_object for sparse objects.
This commit is contained in:
@@ -98,16 +98,16 @@ template<typename T> struct eval<T,Sparse>
|
||||
|
||||
template<typename T,int Cols> struct sparse_eval<T,1,Cols> {
|
||||
typedef typename traits<T>::Scalar _Scalar;
|
||||
enum { _Flags = traits<T>::Flags| RowMajorBit };
|
||||
typedef typename traits<T>::Index _Index;
|
||||
public:
|
||||
typedef SparseVector<_Scalar, _Flags> type;
|
||||
typedef SparseVector<_Scalar, RowMajor, _Index> type;
|
||||
};
|
||||
|
||||
template<typename T,int Rows> struct sparse_eval<T,Rows,1> {
|
||||
typedef typename traits<T>::Scalar _Scalar;
|
||||
enum { _Flags = traits<T>::Flags & (~RowMajorBit) };
|
||||
typedef typename traits<T>::Index _Index;
|
||||
public:
|
||||
typedef SparseVector<_Scalar, _Flags> type;
|
||||
typedef SparseVector<_Scalar, ColMajor, _Index> type;
|
||||
};
|
||||
|
||||
template<typename T,int Rows,int Cols> struct sparse_eval {
|
||||
@@ -127,12 +127,10 @@ template<typename T> struct sparse_eval<T,1,1> {
|
||||
template<typename T> struct plain_matrix_type<T,Sparse>
|
||||
{
|
||||
typedef typename traits<T>::Scalar _Scalar;
|
||||
enum {
|
||||
_Flags = traits<T>::Flags
|
||||
};
|
||||
|
||||
typedef typename traits<T>::Index _Index;
|
||||
enum { _Options = ((traits<T>::Flags&RowMajorBit)==RowMajorBit) ? RowMajor : ColMajor };
|
||||
public:
|
||||
typedef SparseMatrix<_Scalar, _Flags> type;
|
||||
typedef SparseMatrix<_Scalar, _Options, _Index> type;
|
||||
};
|
||||
|
||||
} // end namespace internal
|
||||
|
||||
Reference in New Issue
Block a user