hessenberg.cpp File Reference
#include "main.h"
#include <Eigen/Eigenvalues>

Functions

template<typename Scalar , int Size>
void hessenberg (int size=Size)
 
 EIGEN_DECLARE_TEST (hessenberg)
 

Function Documentation

◆ EIGEN_DECLARE_TEST()

EIGEN_DECLARE_TEST ( hessenberg  )
52  {
53  CALL_SUBTEST_1((hessenberg<std::complex<double>, 1>()));
54  CALL_SUBTEST_2((hessenberg<std::complex<double>, 2>()));
55  CALL_SUBTEST_3((hessenberg<std::complex<float>, 4>()));
56  CALL_SUBTEST_4((hessenberg<float, Dynamic>(internal::random<int>(1, EIGEN_TEST_MAX_SIZE))));
57  CALL_SUBTEST_5((hessenberg<std::complex<double>, Dynamic>(internal::random<int>(1, EIGEN_TEST_MAX_SIZE))));
58 
59  // Test problem size constructors
61 }
#define EIGEN_TEST_MAX_SIZE
Definition: boostmultiprec.cpp:16
Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.
Definition: HessenbergDecomposition.h:61
void hessenberg(int size=Size)
Definition: hessenberg.cpp:15
const int Dynamic
Definition: Constants.h:25
#define CALL_SUBTEST_6(FUNC)
Definition: split_test_helper.h:34
#define CALL_SUBTEST_3(FUNC)
Definition: split_test_helper.h:16
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4
#define CALL_SUBTEST_5(FUNC)
Definition: split_test_helper.h:28
#define CALL_SUBTEST_2(FUNC)
Definition: split_test_helper.h:10
#define CALL_SUBTEST_4(FUNC)
Definition: split_test_helper.h:22

References CALL_SUBTEST_1, CALL_SUBTEST_2, CALL_SUBTEST_3, CALL_SUBTEST_4, CALL_SUBTEST_5, CALL_SUBTEST_6, Eigen::Dynamic, EIGEN_TEST_MAX_SIZE, and hessenberg().

◆ hessenberg()

template<typename Scalar , int Size>
void hessenberg ( int  size = Size)
15  {
17 
18  // Test basic functionality: A = U H U* and H is Hessenberg
19  for (int counter = 0; counter < g_repeat; ++counter) {
20  MatrixType m = MatrixType::Random(size, size);
22  MatrixType Q = hess.matrixQ();
23  MatrixType H = hess.matrixH();
24  VERIFY_IS_APPROX(m, Q * H * Q.adjoint());
25  for (int row = 2; row < size; ++row) {
26  for (int col = 0; col < row - 1; ++col) {
27  VERIFY(H(row, col) == (typename MatrixType::Scalar)0);
28  }
29  }
30  }
31 
32  // Test whether compute() and constructor returns same result
33  MatrixType A = MatrixType::Random(size, size);
35  cs1.compute(A);
37  VERIFY_IS_EQUAL(cs1.matrixH().eval(), cs2.matrixH().eval());
38  MatrixType cs1Q = cs1.matrixQ();
39  MatrixType cs2Q = cs2.matrixQ();
40  VERIFY_IS_EQUAL(cs1Q, cs2Q);
41 
42  // Test assertions for when used uninitialized
43  HessenbergDecomposition<MatrixType> hessUninitialized;
44  VERIFY_RAISES_ASSERT(hessUninitialized.matrixH());
45  VERIFY_RAISES_ASSERT(hessUninitialized.matrixQ());
46  VERIFY_RAISES_ASSERT(hessUninitialized.householderCoefficients());
47  VERIFY_RAISES_ASSERT(hessUninitialized.packedMatrix());
48 
49  // TODO: Add tests for packedMatrix() and householderCoefficients()
50 }
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
MatrixXf Q
Definition: HouseholderQR_householderQ.cpp:1
m col(1)
m row(1)
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
const CoeffVectorType & householderCoefficients() const
Returns the Householder coefficients.
Definition: HessenbergDecomposition.h:172
HessenbergDecomposition & compute(const EigenBase< InputType > &matrix)
Computes Hessenberg decomposition of given matrix.
Definition: HessenbergDecomposition.h:147
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
Definition: HessenbergDecomposition.h:250
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
Definition: HessenbergDecomposition.h:225
const MatrixType & packedMatrix() const
Returns the internal representation of the decomposition.
Definition: HessenbergDecomposition.h:206
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
#define VERIFY_IS_APPROX(a, b)
Definition: integer_types.cpp:13
int * m
Definition: level2_cplx_impl.h:294
#define VERIFY(a)
Definition: main.h:362
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
#define VERIFY_RAISES_ASSERT(a)
Definition: main.h:329
static int g_repeat
Definition: main.h:191

References col(), Eigen::HessenbergDecomposition< MatrixType_ >::compute(), Eigen::g_repeat, H, Eigen::HessenbergDecomposition< MatrixType_ >::householderCoefficients(), m, Eigen::HessenbergDecomposition< MatrixType_ >::matrixH(), Eigen::HessenbergDecomposition< MatrixType_ >::matrixQ(), Eigen::HessenbergDecomposition< MatrixType_ >::packedMatrix(), Q, row(), size, VERIFY, VERIFY_IS_APPROX, VERIFY_IS_EQUAL, and VERIFY_RAISES_ASSERT.

Referenced by oomph::ComplexGMRES< MATRIX >::complex_solve_helper(), EIGEN_DECLARE_TEST(), oomph::HelmholtzGMRESMG< MATRIX >::solve_helper(), oomph::HelmholtzFGMRESMG< MATRIX >::solve_helper(), oomph::ComplexGMRES< MATRIX >::update(), oomph::HelmholtzGMRESMG< MATRIX >::update(), and oomph::HelmholtzFGMRESMG< MATRIX >::update().