* added ei_sqrt for complex

* updated Cholesky to support complex
* correct result_type for abs and abs2 functors
This commit is contained in:
Gael Guennebaud
2008-04-27 14:05:40 +00:00
parent 4ffffa670e
commit 64bacf1c3f
7 changed files with 98 additions and 64 deletions

View File

@@ -9,17 +9,17 @@ INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
SET(test_SRCS
cholesky.cpp
main.cpp
# basicstuff.cpp
# linearstructure.cpp
# product.cpp
# adjoint.cpp
# submatrices.cpp
# miscmatrices.cpp
# smallvectors.cpp
# map.cpp
# cwiseop.cpp
# determinant.cpp
# triangular.cpp
basicstuff.cpp
linearstructure.cpp
product.cpp
adjoint.cpp
submatrices.cpp
miscmatrices.cpp
smallvectors.cpp
map.cpp
cwiseop.cpp
determinant.cpp
triangular.cpp
)
QT4_AUTOMOC(${test_SRCS})

View File

@@ -42,14 +42,15 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
MatrixType a = MatrixType::random(rows,cols).transpose();
VectorType b = VectorType::random(cols);
SquareMatrixType covMat = a.transpose() * a;
SquareMatrixType covMat = a.adjoint() * a;
CholeskyWithoutSquareRoot<SquareMatrixType> cholnosqrt(covMat);
VERIFY_IS_APPROX(covMat, cholnosqrt.matrixU().transpose() * cholnosqrt.vectorD().asDiagonal() * cholnosqrt.matrixU());
VERIFY_IS_APPROX(covMat, cholnosqrt.matrixL() * cholnosqrt.vectorD().asDiagonal() * cholnosqrt.matrixL().adjoint());
VERIFY_IS_APPROX(covMat * cholnosqrt.solve(b), b);
Cholesky<SquareMatrixType> chol(covMat);
VERIFY_IS_APPROX(covMat, chol.matrixU().transpose() * chol.matrixU());
VERIFY_IS_APPROX(covMat, chol.matrixL() * chol.matrixL().adjoint());
VERIFY_IS_APPROX(covMat * chol.solve(b), b);
}
@@ -58,7 +59,7 @@ void EigenTest::testCholesky()
for(int i = 0; i < 1; i++) {
cholesky(Matrix3f());
cholesky(Matrix4d());
cholesky(MatrixXd(17,17));
cholesky(MatrixXcd(7,7));
}
}

View File

@@ -204,17 +204,17 @@ class EigenTest : public QObject
EigenTest(int repeat) : m_repeat(repeat) {}
private slots:
// void testBasicStuff();
// void testLinearStructure();
// void testProduct();
// void testAdjoint();
// void testSubmatrices();
// void testMiscMatrices();
// void testSmallVectors();
// void testMap();
// void testCwiseops();
// void testDeterminant();
// void testTriangular();
void testBasicStuff();
void testLinearStructure();
void testProduct();
void testAdjoint();
void testSubmatrices();
void testMiscMatrices();
void testSmallVectors();
void testMap();
void testCwiseops();
void testDeterminant();
void testTriangular();
void testCholesky();
protected:
int m_repeat;