mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Re-enable a couple of unit tests with evaluators.
This commit is contained in:
parent
6daa6a0d16
commit
4aac87251f
@ -35,7 +35,7 @@ struct traits<SelfAdjointView<MatrixType, UpLo> > : traits<MatrixType>
|
|||||||
typedef typename nested<MatrixType>::type MatrixTypeNested;
|
typedef typename nested<MatrixType>::type MatrixTypeNested;
|
||||||
typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
|
typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
|
||||||
typedef MatrixType ExpressionType;
|
typedef MatrixType ExpressionType;
|
||||||
typedef typename MatrixType::PlainObject DenseMatrixType;
|
typedef typename MatrixType::PlainObject FullMatrixType;
|
||||||
enum {
|
enum {
|
||||||
Mode = UpLo | SelfAdjoint,
|
Mode = UpLo | SelfAdjoint,
|
||||||
Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits)
|
Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits)
|
||||||
|
@ -52,7 +52,9 @@ struct traits<SparseMatrix<_Scalar, _Options, _Index> >
|
|||||||
MaxRowsAtCompileTime = Dynamic,
|
MaxRowsAtCompileTime = Dynamic,
|
||||||
MaxColsAtCompileTime = Dynamic,
|
MaxColsAtCompileTime = Dynamic,
|
||||||
Flags = _Options | NestByRefBit | LvalueBit,
|
Flags = _Options | NestByRefBit | LvalueBit,
|
||||||
|
#ifndef EIGEN_TEST_EVALUATORS
|
||||||
CoeffReadCost = NumTraits<Scalar>::ReadCost,
|
CoeffReadCost = NumTraits<Scalar>::ReadCost,
|
||||||
|
#endif
|
||||||
SupportedAccessPatterns = InnerRandomAccessPattern
|
SupportedAccessPatterns = InnerRandomAccessPattern
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -74,8 +76,10 @@ struct traits<Diagonal<const SparseMatrix<_Scalar, _Options, _Index>, DiagIndex>
|
|||||||
ColsAtCompileTime = 1,
|
ColsAtCompileTime = 1,
|
||||||
MaxRowsAtCompileTime = Dynamic,
|
MaxRowsAtCompileTime = Dynamic,
|
||||||
MaxColsAtCompileTime = 1,
|
MaxColsAtCompileTime = 1,
|
||||||
Flags = 0,
|
Flags = 0
|
||||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost*10
|
#ifndef EIGEN_TEST_EVALUATORS
|
||||||
|
, CoeffReadCost = _MatrixTypeNested::CoeffReadCost*10
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1343,6 +1347,8 @@ template<typename _Scalar, int _Options, typename _Index>
|
|||||||
struct evaluator<SparseMatrix<_Scalar,_Options,_Index> >
|
struct evaluator<SparseMatrix<_Scalar,_Options,_Index> >
|
||||||
: evaluator_base<SparseMatrix<_Scalar,_Options,_Index> >
|
: evaluator_base<SparseMatrix<_Scalar,_Options,_Index> >
|
||||||
{
|
{
|
||||||
|
typedef _Scalar Scalar;
|
||||||
|
typedef _Index Index;
|
||||||
typedef SparseMatrix<_Scalar,_Options,_Index> SparseMatrixType;
|
typedef SparseMatrix<_Scalar,_Options,_Index> SparseMatrixType;
|
||||||
typedef typename SparseMatrixType::InnerIterator InnerIterator;
|
typedef typename SparseMatrixType::InnerIterator InnerIterator;
|
||||||
typedef typename SparseMatrixType::ReverseInnerIterator ReverseInnerIterator;
|
typedef typename SparseMatrixType::ReverseInnerIterator ReverseInnerIterator;
|
||||||
@ -1358,6 +1364,8 @@ struct evaluator<SparseMatrix<_Scalar,_Options,_Index> >
|
|||||||
operator SparseMatrixType&() { return m_matrix->const_cast_derived(); }
|
operator SparseMatrixType&() { return m_matrix->const_cast_derived(); }
|
||||||
operator const SparseMatrixType&() const { return *m_matrix; }
|
operator const SparseMatrixType&() const { return *m_matrix; }
|
||||||
|
|
||||||
|
Scalar coeff(Index row, Index col) const { return m_matrix->coeff(row,col); }
|
||||||
|
|
||||||
const SparseMatrixType *m_matrix;
|
const SparseMatrixType *m_matrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -229,10 +229,12 @@ if(NOT EIGEN_TEST_EVALUATORS)
|
|||||||
ei_add_test(stdvector_overload)
|
ei_add_test(stdvector_overload)
|
||||||
ei_add_test(stdlist)
|
ei_add_test(stdlist)
|
||||||
ei_add_test(stddeque)
|
ei_add_test(stddeque)
|
||||||
ei_add_test(sparse_vector)
|
endif(NOT EIGEN_TEST_EVALUATORS)
|
||||||
ei_add_test(sparse_basic)
|
ei_add_test(sparse_basic)
|
||||||
|
ei_add_test(sparse_vector)
|
||||||
ei_add_test(sparse_product)
|
ei_add_test(sparse_product)
|
||||||
ei_add_test(sparse_solvers)
|
ei_add_test(sparse_solvers)
|
||||||
|
if(NOT EIGEN_TEST_EVALUATORS)
|
||||||
ei_add_test(sparse_permutations)
|
ei_add_test(sparse_permutations)
|
||||||
ei_add_test(simplicial_cholesky)
|
ei_add_test(simplicial_cholesky)
|
||||||
ei_add_test(conjugate_gradient)
|
ei_add_test(conjugate_gradient)
|
||||||
|
@ -72,6 +72,7 @@ namespace Eigen
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define TRACK std::cerr << __FILE__ << " " << __LINE__ << std::endl
|
#define TRACK std::cerr << __FILE__ << " " << __LINE__ << std::endl
|
||||||
|
// #define TRACK while()
|
||||||
|
|
||||||
#define EI_PP_MAKE_STRING2(S) #S
|
#define EI_PP_MAKE_STRING2(S) #S
|
||||||
#define EI_PP_MAKE_STRING(S) EI_PP_MAKE_STRING2(S)
|
#define EI_PP_MAKE_STRING(S) EI_PP_MAKE_STRING2(S)
|
||||||
|
@ -201,9 +201,9 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
|||||||
|
|
||||||
VERIFY(m3.innerVector(j0).nonZeros() == m3.transpose().innerVector(j0).nonZeros());
|
VERIFY(m3.innerVector(j0).nonZeros() == m3.transpose().innerVector(j0).nonZeros());
|
||||||
|
|
||||||
//m2.innerVector(j0) = 2*m2.innerVector(j1);
|
// m2.innerVector(j0) = 2*m2.innerVector(j1);
|
||||||
//refMat2.col(j0) = 2*refMat2.col(j1);
|
// refMat2.col(j0) = 2*refMat2.col(j1);
|
||||||
//VERIFY_IS_APPROX(m2, refMat2);
|
// VERIFY_IS_APPROX(m2, refMat2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test innerVectors()
|
// test innerVectors()
|
||||||
@ -255,6 +255,7 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
|||||||
initSparse<Scalar>(density, refM3, m3);
|
initSparse<Scalar>(density, refM3, m3);
|
||||||
initSparse<Scalar>(density, refM4, m4);
|
initSparse<Scalar>(density, refM4, m4);
|
||||||
|
|
||||||
|
VERIFY_IS_APPROX(m1*s1, refM1*s1);
|
||||||
VERIFY_IS_APPROX(m1+m2, refM1+refM2);
|
VERIFY_IS_APPROX(m1+m2, refM1+refM2);
|
||||||
VERIFY_IS_APPROX(m1+m2+m3, refM1+refM2+refM3);
|
VERIFY_IS_APPROX(m1+m2+m3, refM1+refM2+refM3);
|
||||||
VERIFY_IS_APPROX(m3.cwiseProduct(m1+m2), refM3.cwiseProduct(refM1+refM2));
|
VERIFY_IS_APPROX(m3.cwiseProduct(m1+m2), refM3.cwiseProduct(refM1+refM2));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user