more fixes

This commit is contained in:
Gael Guennebaud 2009-12-17 10:43:46 +01:00
parent 34c95029ca
commit 30d47860dd
5 changed files with 13 additions and 13 deletions

View File

@ -334,7 +334,7 @@ bool SparseLDLT<MatrixType, Backend>::solveInPlace(MatrixBase<Derived> &b) const
if (m_matrix.nonZeros()>0) // otherwise L==I
m_matrix.template triangularView<UnitLowerTriangular>().solveInPlace(b);
b = b.cwise() / m_diag;
b = b.cwiseQuotient(m_diag);
// FIXME should be .adjoint() but it fails to compile...
if (m_matrix.nonZeros()>0) // otherwise L==I

View File

@ -75,13 +75,13 @@ template<typename Scalar> void sparse_solvers(int rows, int cols)
// lower - transpose
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, &zeroCoords, &nonzeroCoords);
VERIFY_IS_APPROX(refMat2.template marked<LowerTriangular>().transpose().solveTriangular(vec2),
m2.template marked<LowerTriangular>().transpose().solveTriangular(vec3));
VERIFY_IS_APPROX(refMat2.transpose().template triangularView<UpperTriangular>().solve(vec2),
m2.transpose().template triangularView<UpperTriangular>().solve(vec3));
// upper - transpose
initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeUpperTriangular, &zeroCoords, &nonzeroCoords);
VERIFY_IS_APPROX(refMat2.template marked<UpperTriangular>().transpose().solveTriangular(vec2),
m2.template marked<UpperTriangular>().transpose().solveTriangular(vec3));
VERIFY_IS_APPROX(refMat2.transpose().template triangularView<LowerTriangular>().solve(vec2),
m2.transpose().template triangularView<LowerTriangular>().solve(vec3));
SparseMatrix<Scalar> matB(rows, rows);
DenseMatrix refMatB = DenseMatrix::Zero(rows, rows);

View File

@ -109,13 +109,13 @@ template<typename MatrixType> void triangular(const MatrixType& m)
// check M * inv(L) using in place API
m4 = m3;
m3.transpose().template triangularView<Eigen::UpperTriangular>().solveInPlace(trm4);
VERIFY(m4.cwise().abs().isIdentity(test_precision<RealScalar>()));
VERIFY(m4.cwiseAbs().isIdentity(test_precision<RealScalar>()));
// check M * inv(U) using in place API
m3 = m1.template triangularView<Eigen::UpperTriangular>();
m4 = m3;
m3.transpose().template triangularView<Eigen::LowerTriangular>().solveInPlace(trm4);
VERIFY(m4.cwise().abs().isIdentity(test_precision<RealScalar>()));
VERIFY(m4.cwiseAbs().isIdentity(test_precision<RealScalar>()));
// check solve with unit diagonal
m3 = m1.template triangularView<Eigen::UnitUpperTriangular>();

View File

@ -131,7 +131,7 @@ void run_test(int dim, int num_elements)
MatrixX cR_t_umeyama = umeyama(src.block(0,0,dim,num_elements), dst.block(0,0,dim,num_elements));
const Scalar error = ( cR_t_umeyama*src - dst ).cwise().square().sum();
const Scalar error = ( cR_t_umeyama*src - dst ).array().square().sum();
VERIFY(error < Scalar(10)*std::numeric_limits<Scalar>::epsilon());
}
@ -167,7 +167,7 @@ void run_fixed_size_test(int num_elements)
HomMatrix cR_t_umeyama = umeyama(src_block, dst_block);
const Scalar error = ( cR_t_umeyama*src - dst ).cwise().square().sum();
const Scalar error = ( cR_t_umeyama*src - dst ).array().square().sum();
VERIFY(error < Scalar(10)*std::numeric_limits<Scalar>::epsilon());
}

View File

@ -48,7 +48,7 @@ void test_vectorization_logic()
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Vector4f(),Vector4f()+Vector4f(),
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Vector4f(),Vector4f().cwise() * Vector4f(),
VERIFY(test_assign(Vector4f(),Vector4f().cwiseProduct(Vector4f()),
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Vector4f(),Vector4f().cast<float>(),
InnerVectorization,CompleteUnrolling));
@ -58,7 +58,7 @@ void test_vectorization_logic()
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Matrix4f(),Matrix4f()+Matrix4f(),
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Matrix4f(),Matrix4f().cwise() * Matrix4f(),
VERIFY(test_assign(Matrix4f(),Matrix4f().cwiseProduct(Matrix4f()),
InnerVectorization,CompleteUnrolling));
VERIFY(test_assign(Matrix<float,16,16>(),Matrix<float,16,16>()+Matrix<float,16,16>(),
@ -67,7 +67,7 @@ void test_vectorization_logic()
VERIFY(test_assign(Matrix<float,16,16,DontAlign>(),Matrix<float,16,16>()+Matrix<float,16,16>(),
NoVectorization,InnerUnrolling));
VERIFY(test_assign(Matrix<float,6,2>(),Matrix<float,6,2>().cwise() / Matrix<float,6,2>(),
VERIFY(test_assign(Matrix<float,6,2>(),Matrix<float,6,2>().cwiseQuotient(Matrix<float,6,2>()),
LinearVectorization,CompleteUnrolling));
VERIFY(test_assign(Matrix<float,17,17>(),Matrix<float,17,17>()+Matrix<float,17,17>(),