Add some pre-allocation unit tests (not working yet)

This commit is contained in:
Gael Guennebaud 2016-08-29 11:08:44 +02:00
parent 6cd7b9ea6b
commit a93e354d92
2 changed files with 12 additions and 2 deletions

View File

@ -7,6 +7,7 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define EIGEN_RUNTIME_NO_MALLOC
#include "main.h"
#include <limits>
#include <Eigen/Eigenvalues>
@ -51,7 +52,11 @@ template<typename MatrixType> void generalized_eigensolver_real(const MatrixType
// non symmetric case:
{
GeneralizedEigenSolver<MatrixType> eig(a,b);
GeneralizedEigenSolver<MatrixType> eig(rows);
// TODO enable full-prealocation of required memory, this probably requires an in-place mode for HessenbergDecomposition
//Eigen::internal::set_is_malloc_allowed(false);
eig.compute(a,b);
//Eigen::internal::set_is_malloc_allowed(true);
for(Index k=0; k<cols; ++k)
{
Matrix<ComplexScalar,Dynamic,Dynamic> tmp = (eig.betas()(k)*a).template cast<ComplexScalar>() - eig.alphas()(k)*b;

View File

@ -7,6 +7,7 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define EIGEN_RUNTIME_NO_MALLOC
#include "main.h"
#include <limits>
#include <Eigen/Eigenvalues>
@ -41,7 +42,11 @@ template<typename MatrixType> void real_qz(const MatrixType& m)
break;
}
RealQZ<MatrixType> qz(A,B);
RealQZ<MatrixType> qz(dim);
// TODO enable full-prealocation of required memory, this probably requires an in-place mode for HessenbergDecomposition
//Eigen::internal::set_is_malloc_allowed(false);
qz.compute(A,B);
//Eigen::internal::set_is_malloc_allowed(true);
VERIFY_IS_EQUAL(qz.info(), Success);
// check for zeros