mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-25 18:50:40 +08:00
Utilize Index in all unit tests.
This commit is contained in:
parent
e402d34407
commit
f1679c7185
@ -31,13 +31,14 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
Transpose.h Conjugate.h Dot.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
RealScalar largerEps = test_precision<RealScalar>();
|
||||
if (ei_is_same_type<RealScalar,float>::ret)
|
||||
@ -79,8 +80,8 @@ template<typename MatrixType> void adjoint(const MatrixType& m)
|
||||
VERIFY(ei_isApprox(v1.dot(square * v2), (square.adjoint() * v1).dot(v2), largerEps));
|
||||
|
||||
// like in testBasicStuff, test operator() to check const-qualification
|
||||
int r = ei_random<int>(0, rows-1),
|
||||
c = ei_random<int>(0, cols-1);
|
||||
Index r = ei_random<Index>(0, rows-1),
|
||||
c = ei_random<Index>(0, cols-1);
|
||||
VERIFY_IS_APPROX(m1.conjugate()(r,c), ei_conj(m1(r,c)));
|
||||
VERIFY_IS_APPROX(m1.adjoint()(c,r), ei_conj(m1(r,c)));
|
||||
|
||||
|
@ -26,13 +26,14 @@
|
||||
|
||||
template<typename ArrayType> void array(const ArrayType& m)
|
||||
{
|
||||
typedef typename ArrayType::Index Index;
|
||||
typedef typename ArrayType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType;
|
||||
typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> RowVectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
ArrayType m1 = ArrayType::Random(rows, cols),
|
||||
m2 = ArrayType::Random(rows, cols),
|
||||
@ -78,12 +79,13 @@ template<typename ArrayType> void array(const ArrayType& m)
|
||||
|
||||
template<typename ArrayType> void comparisons(const ArrayType& m)
|
||||
{
|
||||
typedef typename ArrayType::Index Index;
|
||||
typedef typename ArrayType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
int r = ei_random<int>(0, rows-1),
|
||||
c = ei_random<int>(0, cols-1);
|
||||
@ -137,11 +139,12 @@ template<typename ArrayType> void comparisons(const ArrayType& m)
|
||||
|
||||
template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
{
|
||||
typedef typename ArrayType::Index Index;
|
||||
typedef typename ArrayType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
ArrayType m1 = ArrayType::Random(rows, cols),
|
||||
m2 = ArrayType::Random(rows, cols),
|
||||
|
@ -26,13 +26,14 @@
|
||||
|
||||
template<typename MatrixType> void array_for_matrix(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType;
|
||||
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
@ -75,15 +76,16 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m)
|
||||
|
||||
template<typename MatrixType> void comparisons(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
int r = ei_random<int>(0, rows-1),
|
||||
c = ei_random<int>(0, cols-1);
|
||||
Index r = ei_random<Index>(0, rows-1),
|
||||
c = ei_random<Index>(0, cols-1);
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -29,15 +29,15 @@ template<typename MatrixType> void replicate(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
Replicate.cpp
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
typedef Matrix<Scalar, Dynamic, Dynamic> MatrixX;
|
||||
typedef Matrix<Scalar, Dynamic, 1> VectorX;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols);
|
||||
|
@ -30,11 +30,12 @@ using namespace std;
|
||||
|
||||
template<typename MatrixType> void reverse(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
// this test relies a lot on Random.h, and there's not much more that we can do
|
||||
// to test it, hence I consider that we will have tested Random.h
|
||||
|
@ -26,14 +26,15 @@
|
||||
|
||||
template<typename MatrixType> void bandmatrix(const MatrixType& _m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrixType;
|
||||
|
||||
int rows = _m.rows();
|
||||
int cols = _m.cols();
|
||||
int supers = _m.supers();
|
||||
int subs = _m.subs();
|
||||
Index rows = _m.rows();
|
||||
Index cols = _m.cols();
|
||||
Index supers = _m.supers();
|
||||
Index subs = _m.subs();
|
||||
|
||||
MatrixType m(rows,cols,supers,subs);
|
||||
|
||||
@ -60,9 +61,9 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m)
|
||||
m.col(i).setConstant(static_cast<RealScalar>(i+1));
|
||||
dm1.col(i).setConstant(static_cast<RealScalar>(i+1));
|
||||
}
|
||||
int d = std::min(rows,cols);
|
||||
int a = std::max(0,cols-d-supers);
|
||||
int b = std::max(0,rows-d-subs);
|
||||
Index d = std::min(rows,cols);
|
||||
Index a = std::max(0,cols-d-supers);
|
||||
Index b = std::max(0,rows-d-subs);
|
||||
if(a>0) dm1.block(0,d+supers,rows,a).setZero();
|
||||
dm1.block(0,supers+1,cols-supers-1-a,cols-supers-1-a).template triangularView<Upper>().setZero();
|
||||
dm1.block(subs+1,0,rows-subs-1-b,rows-subs-1-b).template triangularView<Lower>().setZero();
|
||||
@ -74,11 +75,13 @@ template<typename MatrixType> void bandmatrix(const MatrixType& _m)
|
||||
|
||||
void test_bandmatrix()
|
||||
{
|
||||
typedef BandMatrix<float>::Index Index;
|
||||
|
||||
for(int i = 0; i < 10*g_repeat ; i++) {
|
||||
int rows = ei_random<int>(1,10);
|
||||
int cols = ei_random<int>(1,10);
|
||||
int sups = ei_random<int>(0,cols-1);
|
||||
int subs = ei_random<int>(0,rows-1);
|
||||
Index rows = ei_random<int(1,10);
|
||||
Index cols = ei_random<int>(1,10);
|
||||
Index sups = ei_random<int>(0,cols-1);
|
||||
Index subs = ei_random<int>(0,rows-1);
|
||||
CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );
|
||||
}
|
||||
}
|
||||
|
@ -28,11 +28,12 @@
|
||||
|
||||
template<typename MatrixType> void basicStuff(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
// this test relies a lot on Random.h, and there's not much more that we can do
|
||||
// to test it, hence I consider that we will have tested Random.h
|
||||
@ -124,12 +125,13 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
|
||||
|
||||
template<typename MatrixType> void basicStuffComplex(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
Scalar s1 = ei_random<Scalar>(),
|
||||
s2 = ei_random<Scalar>();
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
template<typename MatrixType> void block(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
@ -34,8 +35,8 @@ template<typename MatrixType> void block(const MatrixType& m)
|
||||
typedef Matrix<Scalar, Dynamic, Dynamic> DynamicMatrixType;
|
||||
typedef Matrix<Scalar, Dynamic, 1> DynamicVectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
@ -158,13 +159,14 @@ template<typename MatrixType> void block(const MatrixType& m)
|
||||
template<typename MatrixType>
|
||||
void compare_using_data_and_stride(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
int size = m.size();
|
||||
int innerStride = m.innerStride();
|
||||
int outerStride = m.outerStride();
|
||||
int rowStride = m.rowStride();
|
||||
int colStride = m.colStride();
|
||||
typedef MatrixType::Index Index;
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
Index size = m.size();
|
||||
Index innerStride = m.innerStride();
|
||||
Index outerStride = m.outerStride();
|
||||
Index rowStride = m.rowStride();
|
||||
Index colStride = m.colStride();
|
||||
const typename MatrixType::Scalar* data = m.data();
|
||||
|
||||
for(int j=0;j<cols;++j)
|
||||
@ -191,13 +193,14 @@ void compare_using_data_and_stride(const MatrixType& m)
|
||||
template<typename MatrixType>
|
||||
void data_and_stride(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
int r1 = ei_random<int>(0,rows-1);
|
||||
int r2 = ei_random<int>(r1,rows-1);
|
||||
int c1 = ei_random<int>(0,cols-1);
|
||||
int c2 = ei_random<int>(c1,cols-1);
|
||||
Index r1 = ei_random<Index>(0,rows-1);
|
||||
Index r2 = ei_random<Index>(r1,rows-1);
|
||||
Index c1 = ei_random<Index>(0,cols-1);
|
||||
Index c2 = ei_random<Index>(c1,cols-1);
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols);
|
||||
compare_using_data_and_stride(m1.block(r1, c1, r2-r1+1, c2-c1+1));
|
||||
|
@ -47,11 +47,12 @@ static int nb_temporaries;
|
||||
|
||||
template<typename MatrixType> void cholesky(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
/* this test covers the following files:
|
||||
LLT.h LDLT.h
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -32,6 +32,7 @@ template <typename Scalar, int Storage>
|
||||
void run_matrix_tests()
|
||||
{
|
||||
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Storage> MatrixType;
|
||||
typedef MatrixType::Index Index;
|
||||
|
||||
MatrixType m, n;
|
||||
|
||||
@ -51,8 +52,8 @@ void run_matrix_tests()
|
||||
// random shrinking ...
|
||||
for (int i=0; i<25; ++i)
|
||||
{
|
||||
const int rows = ei_random<int>(1,50);
|
||||
const int cols = ei_random<int>(1,50);
|
||||
const Index rows = ei_random<Index>(1,50);
|
||||
const Index cols = ei_random<Index>(1,50);
|
||||
m = n = MatrixType::Random(50,50);
|
||||
m.conservativeResize(rows,cols);
|
||||
VERIFY_IS_APPROX(m, n.block(0,0,rows,cols));
|
||||
@ -61,8 +62,8 @@ void run_matrix_tests()
|
||||
// random growing with zeroing ...
|
||||
for (int i=0; i<25; ++i)
|
||||
{
|
||||
const int rows = ei_random<int>(50,75);
|
||||
const int cols = ei_random<int>(50,75);
|
||||
const Index rows = ei_random<Index>(50,75);
|
||||
const Index cols = ei_random<Index>(50,75);
|
||||
m = n = MatrixType::Random(50,50);
|
||||
m.conservativeResizeLike(MatrixType::Zero(rows,cols));
|
||||
VERIFY_IS_APPROX(m.block(0,0,n.rows(),n.cols()), n);
|
||||
|
@ -30,11 +30,12 @@
|
||||
|
||||
template<typename MatrixType> void corners(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
int r = ei_random<int>(1,rows);
|
||||
int c = ei_random<int>(1,cols);
|
||||
Index r = ei_random<Index>(1,rows);
|
||||
Index c = ei_random<Index>(1,cols);
|
||||
|
||||
MatrixType matrix = MatrixType::Random(rows,cols);
|
||||
const MatrixType const_matrix = MatrixType::Random(rows,cols);
|
||||
|
@ -37,12 +37,13 @@ template<typename Scalar> struct AddIfNull {
|
||||
|
||||
template<typename MatrixType> void cwiseops(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -26,12 +26,14 @@
|
||||
|
||||
template<typename MatrixType> void diagonal(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols);
|
||||
|
@ -26,6 +26,7 @@
|
||||
using namespace std;
|
||||
template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
||||
@ -35,8 +36,8 @@ template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
|
||||
typedef DiagonalMatrix<Scalar, Rows> LeftDiagonalMatrix;
|
||||
typedef DiagonalMatrix<Scalar, Cols> RightDiagonalMatrix;
|
||||
typedef Matrix<Scalar, Rows==Dynamic?Dynamic:2*Rows, Cols==Dynamic?Dynamic:2*Cols> BigMatrix;
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols);
|
||||
|
@ -28,10 +28,11 @@
|
||||
|
||||
template<typename MatrixType> void eigen2support(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -47,11 +47,12 @@ void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType&
|
||||
|
||||
template<typename MatrixType> void eigensolver(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
/* this test covers the following files:
|
||||
ComplexEigenSolver.h, and indirectly ComplexSchur.h
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -33,11 +33,12 @@
|
||||
|
||||
template<typename MatrixType> void eigensolver(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
/* this test covers the following files:
|
||||
EigenSolver.h
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -33,11 +33,12 @@
|
||||
|
||||
template<typename MatrixType> void selfadjointeigensolver(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
/* this test covers the following files:
|
||||
EigenSolver.h, SelfAdjointEigenSolver.h (and indirectly: Tridiagonalization.h)
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -27,13 +27,14 @@
|
||||
|
||||
template<typename MatrixType> void householder(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
static bool even = true;
|
||||
even = !even;
|
||||
/* this test covers the following files:
|
||||
Householder.h
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -33,13 +33,14 @@
|
||||
|
||||
template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 };
|
||||
VERIFY(is_signed == 1);
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
@ -63,6 +64,7 @@ template<typename MatrixType> void signed_integer_type_tests(const MatrixType& m
|
||||
|
||||
template<typename MatrixType> void integer_type_tests(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
VERIFY(NumTraits<Scalar>::IsInteger);
|
||||
@ -71,8 +73,8 @@ template<typename MatrixType> void integer_type_tests(const MatrixType& m)
|
||||
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
// this test relies a lot on Random.h, and there's not much more that we can do
|
||||
// to test it, hence I consider that we will have tested Random.h
|
||||
|
@ -28,11 +28,12 @@
|
||||
|
||||
template<typename MatrixType> void inverse(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
/* this test covers the following files:
|
||||
Inverse.h
|
||||
*/
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
@ -29,8 +29,9 @@
|
||||
|
||||
template<typename MatrixType, unsigned int Options> void svd(const MatrixType& m = MatrixType(), bool pickrandom = true)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
enum {
|
||||
RowsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||
|
@ -29,11 +29,11 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
Sum.h Difference.h Opposite.h ScalarMultiple.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
// this test relies a lot on Random.h, and there's not much more that we can do
|
||||
// to test it, hence I consider that we will have tested Random.h
|
||||
|
14
test/lu.cpp
14
test/lu.cpp
@ -28,15 +28,16 @@ using namespace std;
|
||||
|
||||
template<typename MatrixType> void lu_non_invertible()
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
/* this test covers the following files:
|
||||
LU.h
|
||||
*/
|
||||
int rows, cols, cols2;
|
||||
Index rows, cols, cols2;
|
||||
if(MatrixType::RowsAtCompileTime==Dynamic)
|
||||
{
|
||||
rows = ei_random<int>(2,200);
|
||||
rows = ei_random<Index>(2,200);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -44,7 +45,7 @@ template<typename MatrixType> void lu_non_invertible()
|
||||
}
|
||||
if(MatrixType::ColsAtCompileTime==Dynamic)
|
||||
{
|
||||
cols = ei_random<int>(2,200);
|
||||
cols = ei_random<Index>(2,200);
|
||||
cols2 = ei_random<int>(2,200);
|
||||
}
|
||||
else
|
||||
@ -63,7 +64,7 @@ template<typename MatrixType> void lu_non_invertible()
|
||||
typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime>
|
||||
RMatrixType;
|
||||
|
||||
int rank = ei_random<int>(1, std::min(rows, cols)-1);
|
||||
Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
|
||||
|
||||
// The image of the zero matrix should consist of a single (zero) column vector
|
||||
VERIFY((MatrixType::Zero(rows,cols).fullPivLu().image(MatrixType::Zero(rows,cols)).cols() == 1));
|
||||
@ -145,10 +146,11 @@ template<typename MatrixType> void lu_partial_piv()
|
||||
/* this test covers the following files:
|
||||
PartialPivLU.h
|
||||
*/
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
|
||||
int rows = ei_random<int>(1,4);
|
||||
int cols = rows;
|
||||
Index rows = ei_random<Index>(1,4);
|
||||
Index cols = rows;
|
||||
|
||||
MatrixType m1(cols, rows);
|
||||
m1.setRandom();
|
||||
|
@ -385,7 +385,7 @@ bool test_is_equal(const T& actual, const U& expected)
|
||||
* This is very useful to test rank-revealing algorithms.
|
||||
*/
|
||||
template<typename MatrixType>
|
||||
void createRandomPIMatrixOfRank(int desired_rank, int rows, int cols, MatrixType& m)
|
||||
void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typename MatrixType::Index rows, int cols, MatrixType& m)
|
||||
{
|
||||
typedef typename ei_traits<MatrixType>::Scalar Scalar;
|
||||
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
||||
|
@ -53,9 +53,10 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
|
||||
|
||||
template<typename MatrixType> void map_class_matrix(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
int rows = m.rows(), cols = m.cols(), size = rows*cols;
|
||||
Index rows = m.rows(), cols = m.cols(), size = rows*cols;
|
||||
|
||||
// test Map.h
|
||||
Scalar* array1 = ei_aligned_new<Scalar>(size);
|
||||
|
@ -61,9 +61,10 @@ template<typename VectorType> void map_class_vector(const VectorType& m)
|
||||
|
||||
template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
|
||||
int rows = _m.rows(), cols = _m.cols();
|
||||
Index rows = _m.rows(), cols = _m.cols();
|
||||
|
||||
MatrixType m = MatrixType::Random(rows,cols);
|
||||
|
||||
|
@ -29,14 +29,14 @@ template<typename MatrixType> void miscMatrices(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
DiagonalMatrix.h Ones.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
int r = ei_random<int>(0, rows-1), r2 = ei_random<int>(0, rows-1), c = ei_random<int>(0, cols-1);
|
||||
Index r = ei_random<Index>(0, rows-1), r2 = ei_random<Index>(0, rows-1), c = ei_random<Index>(0, cols-1);
|
||||
VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast<Scalar>(1));
|
||||
MatrixType m1 = MatrixType::Ones(rows,cols);
|
||||
VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1));
|
||||
|
@ -43,12 +43,12 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
|
||||
{
|
||||
/* this test check no dynamic memory allocation are issued with fixed-size matrices
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
@ -64,8 +64,8 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
|
||||
|
||||
Scalar s1 = ei_random<Scalar>();
|
||||
|
||||
int r = ei_random<int>(0, rows-1),
|
||||
c = ei_random<int>(0, cols-1);
|
||||
Index r = ei_random<Index>(0, rows-1),
|
||||
c = ei_random<Index>(0, cols-1);
|
||||
|
||||
VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2);
|
||||
VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c)));
|
||||
|
@ -97,8 +97,9 @@ void testVectorType(const VectorType& base)
|
||||
template<typename MatrixType>
|
||||
void testMatrixType(const MatrixType& m)
|
||||
{
|
||||
const int rows = m.rows();
|
||||
const int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
const Index rows = m.rows();
|
||||
const Index cols = m.cols();
|
||||
|
||||
MatrixType A;
|
||||
A.setIdentity(rows, cols);
|
||||
|
@ -43,6 +43,7 @@ void randomPermutationVector(PermutationVectorType& v, int size)
|
||||
using namespace std;
|
||||
template<typename MatrixType> void permutationmatrices(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime,
|
||||
@ -52,8 +53,8 @@ template<typename MatrixType> void permutationmatrices(const MatrixType& m)
|
||||
typedef PermutationMatrix<Cols> RightPermutationType;
|
||||
typedef Matrix<int, Cols, 1> RightPermutationVectorType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m_original = MatrixType::Random(rows,cols);
|
||||
LeftPermutationVectorType lv;
|
||||
|
@ -37,7 +37,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
Identity.h Product.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::NonInteger NonInteger;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> RowVectorType;
|
||||
@ -47,8 +47,8 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
||||
MatrixType::Flags&RowMajorBit> OtherMajorMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
// this test relies a lot on Random.h, and there's not much more that we can do
|
||||
// to test it, hence I consider that we will have tested Random.h
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
template<typename MatrixType> void product_extra(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::NonInteger NonInteger;
|
||||
typedef Matrix<Scalar, 1, Dynamic> RowVectorType;
|
||||
@ -33,8 +34,8 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
||||
typedef Matrix<Scalar, Dynamic, Dynamic,
|
||||
MatrixType::Flags&RowMajorBit> OtherMajorMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -39,15 +39,15 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
|
||||
{
|
||||
/* This test checks the number of temporaries created
|
||||
* during the evaluation of a complex expression */
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
typedef Matrix<Scalar, 1, Dynamic> RowVectorType;
|
||||
typedef Matrix<Scalar, Dynamic, 1> ColVectorType;
|
||||
typedef Matrix<Scalar, Dynamic, Dynamic, RowMajor> RowMajorMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
@ -33,8 +34,8 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
|
||||
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic, RowMajor> RhsMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols),
|
||||
|
@ -50,9 +50,10 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in
|
||||
typedef Matrix<Scalar, OtherSize, Size> Rhs2;
|
||||
enum { order = OtherSize==1 ? 0 : RowMajor };
|
||||
typedef Matrix<Scalar, Size, OtherSize,order> Rhs3;
|
||||
typedef MatrixType::Index Index;
|
||||
|
||||
int rows = size;
|
||||
int cols = size;
|
||||
Index rows = size;
|
||||
Index cols = size;
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols), m3;
|
||||
|
@ -26,14 +26,15 @@
|
||||
|
||||
template<typename MatrixType> void syrk(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> Rhs1;
|
||||
typedef Matrix<Scalar, Dynamic, MatrixType::RowsAtCompileTime> Rhs2;
|
||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic,RowMajor> Rhs3;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m2 = MatrixType::Random(rows, cols);
|
||||
|
@ -31,8 +31,8 @@ template<typename Scalar> void trmm(int size,int /*othersize*/)
|
||||
typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> MatrixColMaj;
|
||||
typedef Matrix<Scalar,Dynamic,Dynamic,RowMajor> MatrixRowMaj;
|
||||
|
||||
int rows = size;
|
||||
int cols = ei_random<int>(1,size);
|
||||
DenseIndex rows = size;
|
||||
DenseIndex cols = ei_random<DenseIndex>(1,size);
|
||||
|
||||
MatrixColMaj triV(rows,cols), triH(cols,rows), upTri(cols,rows), loTri(rows,cols),
|
||||
unitUpTri(cols,rows), unitLoTri(rows,cols);
|
||||
|
@ -26,14 +26,15 @@
|
||||
|
||||
template<typename MatrixType> void trmv(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;
|
||||
|
||||
RealScalar largerEps = 10*test_precision<RealScalar>();
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m3(rows, cols);
|
||||
|
@ -27,8 +27,10 @@
|
||||
|
||||
template<typename MatrixType> void qr(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
||||
|
@ -28,8 +28,10 @@
|
||||
|
||||
template<typename MatrixType> void qr()
|
||||
{
|
||||
int rows = ei_random<int>(2,200), cols = ei_random<int>(2,200), cols2 = ei_random<int>(2,200);
|
||||
int rank = ei_random<int>(1, std::min(rows, cols)-1);
|
||||
typedef typename MatrixType::Index Index;
|
||||
|
||||
Index rows = ei_random<Index>(2,200), cols = ei_random<Index>(2,200), cols2 = ei_random<Index>(2,200);
|
||||
Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
|
@ -28,8 +28,10 @@
|
||||
|
||||
template<typename MatrixType> void qr()
|
||||
{
|
||||
int rows = ei_random<int>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200);
|
||||
int rank = ei_random<int>(1, std::min(rows, cols)-1);
|
||||
typedef typename MatrixType::Index Index;
|
||||
|
||||
Index rows = ei_random<int>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200);
|
||||
Index rank = ei_random<int>(1, std::min(rows, cols)-1);
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
||||
|
@ -33,8 +33,10 @@
|
||||
template<typename MatrixType>
|
||||
void check_qtvector_matrix(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
|
||||
QVector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);
|
||||
for(int i = 0; i < 20; i++)
|
||||
|
@ -26,11 +26,12 @@
|
||||
|
||||
template<typename MatrixType> void matrixRedux(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename MatrixType::RealScalar RealScalar;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols);
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
template<int rows, int cols>
|
||||
template<DenseIndex rows, DenseIndex cols>
|
||||
void resizeLikeTest()
|
||||
{
|
||||
MatrixXf A(rows, cols);
|
||||
|
@ -29,11 +29,12 @@
|
||||
|
||||
template<typename MatrixType> void selfadjoint(const MatrixType& m)
|
||||
{
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
MatrixType m1 = MatrixType::Random(rows, cols),
|
||||
m3(rows, cols);
|
||||
|
@ -26,8 +26,10 @@
|
||||
|
||||
template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& ref)
|
||||
{
|
||||
const int rows = ref.rows();
|
||||
const int cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Index Index;
|
||||
|
||||
const Index rows = ref.rows();
|
||||
const Index cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Scalar Scalar;
|
||||
enum { Flags = SparseMatrixType::Flags };
|
||||
|
||||
|
@ -26,8 +26,9 @@
|
||||
|
||||
template<typename SparseMatrixType> void sparse_product(const SparseMatrixType& ref)
|
||||
{
|
||||
const int rows = ref.rows();
|
||||
const int cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Index Index;
|
||||
const Index rows = ref.rows();
|
||||
const Index cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Scalar Scalar;
|
||||
enum { Flags = SparseMatrixType::Flags };
|
||||
|
||||
|
@ -34,7 +34,7 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
|
||||
/* this test covers the following files:
|
||||
StableNorm.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Index Index;
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
@ -52,8 +52,8 @@ template<typename MatrixType> void stable_norm(const MatrixType& m)
|
||||
}
|
||||
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
|
||||
Scalar big = ei_random<Scalar>() * (std::numeric_limits<RealScalar>::max() * RealScalar(1e-4));
|
||||
Scalar small = static_cast<RealScalar>(1)/big;
|
||||
|
@ -30,8 +30,10 @@
|
||||
template<typename MatrixType>
|
||||
void check_stdlist_matrix(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
|
||||
Index rows = m.rows();
|
||||
Index cols = m.cols();
|
||||
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
|
||||
std::list<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);
|
||||
v.front() = x;
|
||||
|
@ -29,8 +29,8 @@
|
||||
template<typename MatrixType>
|
||||
void check_stdvector_matrix(const MatrixType& m)
|
||||
{
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
typename MatrixType::Index rows = m.rows();
|
||||
typename MatrixType::Index cols = m.cols();
|
||||
MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);
|
||||
std::vector<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);
|
||||
v[5] = x;
|
||||
|
@ -68,19 +68,19 @@ template<typename _Scalar> class AlignedVector3
|
||||
EIGEN_DENSE_PUBLIC_INTERFACE(AlignedVector3)
|
||||
using Base::operator*;
|
||||
|
||||
inline int rows() const { return 3; }
|
||||
inline int cols() const { return 1; }
|
||||
inline Index rows() const { return 3; }
|
||||
inline Index cols() const { return 1; }
|
||||
|
||||
inline const Scalar& coeff(int row, int col) const
|
||||
inline const Scalar& coeff(Index row, Index col) const
|
||||
{ return m_coeffs.coeff(row, col); }
|
||||
|
||||
inline Scalar& coeffRef(int row, int col)
|
||||
inline Scalar& coeffRef(Index row, Index col)
|
||||
{ return m_coeffs.coeffRef(row, col); }
|
||||
|
||||
inline const Scalar& coeff(int index) const
|
||||
inline const Scalar& coeff(Index index) const
|
||||
{ return m_coeffs.coeff(index); }
|
||||
|
||||
inline Scalar& coeffRef(int index)
|
||||
inline Scalar& coeffRef(Index index)
|
||||
{ return m_coeffs.coeffRef(index);}
|
||||
|
||||
|
||||
|
@ -200,8 +200,9 @@ class SparseLU<MatrixType,UmfPack> : public SparseLU<MatrixType>
|
||||
template<typename MatrixType>
|
||||
void SparseLU<MatrixType,UmfPack>::compute(const MatrixType& a)
|
||||
{
|
||||
const int rows = a.rows();
|
||||
const int cols = a.cols();
|
||||
typedef typename MatrixType::Index Index;
|
||||
const Index rows = a.rows();
|
||||
const Index cols = a.cols();
|
||||
ei_assert((MatrixType::Flags&RowMajorBit)==0 && "Row major matrices are not supported yet");
|
||||
|
||||
m_matrixRef = &a;
|
||||
|
@ -61,8 +61,9 @@ bool test_random_setter(DynamicSparseMatrix<T>& sm, const DenseType& ref, const
|
||||
|
||||
template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& ref)
|
||||
{
|
||||
const int rows = ref.rows();
|
||||
const int cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Index Index;
|
||||
const Index rows = ref.rows();
|
||||
const Index cols = ref.cols();
|
||||
typedef typename SparseMatrixType::Scalar Scalar;
|
||||
enum { Flags = SparseMatrixType::Flags };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user