// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Alexey Korepanov // // This Source Code Form is subject to the terms of the Mozilla // 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 #include template void real_qz(const MatrixType& m) { /* this test covers the following files: RealQZ.h */ using std::abs; typedef typename MatrixType::Scalar Scalar; Index dim = m.cols(); MatrixType A = MatrixType::Random(dim,dim), B = MatrixType::Random(dim,dim); // Regression test for bug 985: Randomly set rows or columns to zero Index k=internal::random(0, dim-1); switch(internal::random(0,10)) { case 0: A.row(k).setZero(); break; case 1: A.col(k).setZero(); break; case 2: B.row(k).setZero(); break; case 3: B.col(k).setZero(); break; default: break; } RealQZ 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 bool all_zeros = true; for (Index i=0; i