- Added problem size constructor to decompositions that did not have one. It preallocates member data structures.

- Updated unit tests to check above constructor.
- In the compute() method of decompositions: Made temporary matrices/vectors class members to avoid heap allocations during compute() (when dynamic matrices are used, of course).

These  changes can speed up decomposition computation time when a solver instance is used to solve multiple same-sized problems. An added benefit is that the compute() method can now be invoked in contexts were heap allocations are forbidden, such as in real-time control loops.

CAVEAT: Not all of the decompositions in the Eigenvalues module have a heap-allocation-free compute() method. A future patch may address this issue, but some required API changes need to be incorporated first.
This commit is contained in:
Adolfo Rodriguez Tsouroukdissian
2010-04-21 17:15:57 +02:00
parent faf8f7732d
commit 28dde19e40
29 changed files with 396 additions and 121 deletions

View File

@@ -163,4 +163,8 @@ void test_cholesky()
CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() );
CALL_SUBTEST_8( cholesky_verify_assert<MatrixXf>() );
CALL_SUBTEST_2( cholesky_verify_assert<MatrixXd>() );
// Test problem size constructors
CALL_SUBTEST_9( LLT<MatrixXf>(10) );
CALL_SUBTEST_9( LDLT<MatrixXf>(10) );
}

View File

@@ -63,4 +63,7 @@ void test_eigensolver_complex()
CALL_SUBTEST_3( eigensolver(Matrix<std::complex<float>, 1, 1>()) );
CALL_SUBTEST_4( eigensolver(Matrix3f()) );
}
// Test problem size constructors
CALL_SUBTEST_5(ComplexEigenSolver<MatrixXf>(10));
}

View File

@@ -89,4 +89,7 @@ void test_eigensolver_generic()
CALL_SUBTEST_2( eigensolver_verify_assert<MatrixXd>() );
CALL_SUBTEST_4( eigensolver_verify_assert<Matrix2d>() );
CALL_SUBTEST_5( eigensolver_verify_assert<MatrixXf>() );
// Test problem size constructors
CALL_SUBTEST_6(EigenSolver<MatrixXf>(10));
}

View File

@@ -129,5 +129,9 @@ void test_eigensolver_selfadjoint()
CALL_SUBTEST_6( selfadjointeigensolver(Matrix<double,1,1>()) );
CALL_SUBTEST_7( selfadjointeigensolver(Matrix<double,2,2>()) );
}
// Test problem size constructors
CALL_SUBTEST_8(SelfAdjointEigenSolver<MatrixXf>(10));
CALL_SUBTEST_8(Tridiagonalization<MatrixXf>(10));
}

View File

@@ -61,4 +61,7 @@ void test_hessenberg()
CALL_SUBTEST_3(( hessenberg<std::complex<float>,4>() ));
CALL_SUBTEST_4(( hessenberg<float,Dynamic>(ei_random<int>(1,320)) ));
CALL_SUBTEST_5(( hessenberg<std::complex<double>,Dynamic>(ei_random<int>(1,320)) ));
// Test problem size constructors
CALL_SUBTEST_6(HessenbergDecomposition<MatrixXf>(10));
}

View File

@@ -106,4 +106,7 @@ void test_jacobisvd()
CALL_SUBTEST_3(( svd_verify_assert<Matrix3d>() ));
CALL_SUBTEST_9(( svd_verify_assert<MatrixXf>() ));
CALL_SUBTEST_11(( svd_verify_assert<MatrixXd>() ));
// Test problem size constructors
CALL_SUBTEST_12( JacobiSVD<MatrixXf>(10, 20) );
}

View File

@@ -212,5 +212,9 @@ void test_lu()
CALL_SUBTEST_6( lu_verify_assert<MatrixXcd>() );
CALL_SUBTEST_7(( lu_non_invertible<Matrix<float,Dynamic,16> >() ));
// Test problem size constructors
CALL_SUBTEST_9( PartialPivLU<MatrixXf>(10) );
CALL_SUBTEST_9( FullPivLU<MatrixXf>(10, 20); );
}
}

View File

@@ -133,4 +133,7 @@ void test_qr()
CALL_SUBTEST_6(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_7(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_8(qr_verify_assert<MatrixXcd>());
// Test problem size constructors
CALL_SUBTEST_12(HouseholderQR<MatrixXf>(10, 20));
}

View File

@@ -157,4 +157,7 @@ void test_qr_colpivoting()
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_6(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
// Test problem size constructors
CALL_SUBTEST_9(ColPivHouseholderQR<MatrixXf>(10, 20));
}

View File

@@ -139,4 +139,7 @@ void test_qr_fullpivoting()
CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());
CALL_SUBTEST_4(qr_verify_assert<MatrixXcf>());
CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());
// Test problem size constructors
CALL_SUBTEST_7(FullPivHouseholderQR<MatrixXf>(10, 20));
}

View File

@@ -64,4 +64,7 @@ void test_schur_complex()
CALL_SUBTEST_2(( schur<MatrixXcf>(ei_random<int>(1,50)) ));
CALL_SUBTEST_3(( schur<Matrix<std::complex<float>, 1, 1> >() ));
CALL_SUBTEST_4(( schur<Matrix<float, 3, 3, Eigen::RowMajor> >() ));
// Test problem size constructors
CALL_SUBTEST_5(ComplexSchur<MatrixXf>(10));
}

View File

@@ -82,4 +82,7 @@ void test_schur_real()
CALL_SUBTEST_2(( schur<MatrixXd>(ei_random<int>(1,50)) ));
CALL_SUBTEST_3(( schur<Matrix<float, 1, 1> >() ));
CALL_SUBTEST_4(( schur<Matrix<double, 3, 3, Eigen::RowMajor> >() ));
// Test problem size constructors
CALL_SUBTEST_5(RealSchur<MatrixXf>(10));
}

View File

@@ -113,4 +113,7 @@ void test_svd()
CALL_SUBTEST_2( svd_verify_assert<Matrix4d>() );
CALL_SUBTEST_3( svd_verify_assert<MatrixXf>() );
CALL_SUBTEST_4( svd_verify_assert<MatrixXd>() );
// Test problem size constructors
CALL_SUBTEST_9( SVD<MatrixXf>(10, 20) );
}