34 #include <tests/myratest.h> 41 template<
class Precision>
void test1(
int N, Precision tolerance)
43 typedef std::complex<Precision> Number;
44 myra::out() << typestring<Number>() << std::endl;
52 auto result = hetrf_inplace(
'L',
'R',L);
58 Precision error = frobenius( hermitian(P)*L*R*hermitian(Q)*I*Q*hermitian(R)*hermitian(L)*P-A ) / frobenius(A);
59 myra::out() <<
" |P'*L*R'*Q'*I*Q*R*L'*P - A| = " << error << std::endl;
60 REQUIRE(error < tolerance);
66 auto result = hetrf_inplace(
'L',
'L',L);
72 Precision error = frobenius( hermitian(P)*hermitian(L)*hermitian(R)*hermitian(Q)*I*Q*R*L*P-A ) / frobenius(A);
73 myra::out() <<
" |P'*L'*R'*Q'*I*Q*R*L*P - A| = " << error << std::endl;
74 REQUIRE(error < tolerance);
80 auto result = hetrf_inplace(
'U',
'R',U);
86 Precision error = frobenius( hermitian(P)*U*R*hermitian(Q)*I*Q*hermitian(R)*hermitian(U)*P-A ) / frobenius(A);
87 myra::out() <<
" |P'*U*R*Q'*I*Q*R'*U'*P - A| = " << error << std::endl;
88 REQUIRE(error < tolerance);
94 auto result = hetrf_inplace(
'U',
'L',U);
100 Precision error = frobenius( hermitian(P)*hermitian(U)*hermitian(R)*hermitian(Q)*I*Q*R*U*P-A ) / frobenius(A);
101 myra::out() <<
" |P'*U'*R'*Q'*I*Q*R*U*P - A| = " << error << std::endl;
102 REQUIRE(error < tolerance);
108 template<
class Precision>
void test2(
int N, Precision tolerance)
110 typedef std::complex<Precision> Number;
111 myra::out() << typestring<Number>() << std::endl;
114 A = A + hermitian(A);
117 auto result = hetrf_inplace(L);
123 Precision error = frobenius( hermitian(P)*Lf*R*hermitian(Q)*I*Q*hermitian(R)*hermitian(Lf)*P-A ) / frobenius(A);
124 myra::out() <<
" |P'*L*R*Q'*I*Q*R'*L'*P-A| = " << error << std::endl;
125 REQUIRE(error < tolerance);
130 ADD_TEST(
"hetrf_Matrix",
"[dense][lapack]")
132 myra::out() <<
"Checking hetrf(MatrixRange)" << std::endl;
133 test1<float > (169, 1.0e-4f);
134 test1<double> (169, 1.0e-10);
137 ADD_TEST(
"hetrf_LowerMatrix",
"[dense][lapack]")
139 myra::out() <<
"Checking hetrf(LowerMatrix)" << std::endl;
140 test2<float > (192, 1.0e-3f);
141 test2<double> (192, 1.0e-8);
Interface class for representing subranges of DiagonalMatrix's.
Interface class for representing subranges of dense Matrix's.
Tabulates an IxJ matrix. Allows random access, has column major layout to be compatible with BLAS/LAP...
Definition: bdsqr.h:20
Routines for computing Frobenius norms of various algebraic containers.
static Matrix< Number > random(int I, int J)
Generates a random Matrix of specified size.
Definition: Matrix.cpp:353
LDL' decompositions for real hermitian Matrix A (indefinite is fine).
Routines for multiplying by a DiagonalMatrix.
Range construct for a lower triangular matrix stored in rectangular packed format.
Specialized container for a lower triangular matrix, O(N^2/2) storage. Used by symmetry exploiting ma...
Returns the lower triangle of a dense Matrix.
Returns the upper triangle of a dense Matrix.
Various utility functions/classes related to scalar Number types.
Routines related to swap sequences, often used during pivoting.
General purpose dense matrix container, O(i*j) storage.
static DiagonalMatrix< Number > inertia(int N_plus, int N_minus)
Generates an inertia DiagonalMatrix, [+I -I].
Definition: DiagonalMatrix.cpp:221
Returns a hermitian copy of a Matrix. The inplace version only works on a square operand.
Stores a lower triangular matrix in rectangular packed format.
Definition: conjugate.h:22
Container for a diagonal matrix, O(n) storage. Used by SVD, row/column scaling, etc.
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
Interface class for representing subranges of contiguous int's.
Checking hetrf(MatrixRange)
std::complex<float>
|P'*L*R'*Q'*I*Q*R*L'*P - A| = 3.1803e-06
|P'*L'*R'*Q'*I*Q*R*L*P - A| = 3.29095e-06
|P'*U*R*Q'*I*Q*R'*U'*P - A| = 3.80268e-06
|P'*U'*R'*Q'*I*Q*R*U*P - A| = 3.62216e-06
std::complex<double>
|P'*L*R'*Q'*I*Q*R*L'*P - A| = 5.94817e-15
|P'*L'*R'*Q'*I*Q*R*L*P - A| = 6.05741e-15
|P'*U*R*Q'*I*Q*R'*U'*P - A| = 5.69709e-15
|P'*U'*R'*Q'*I*Q*R*U*P - A| = 5.42728e-15