mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* added ei_sqrt for complex
* updated Cholesky to support complex * correct result_type for abs and abs2 functors
This commit is contained in:
@@ -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})
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
test/main.h
22
test/main.h
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user