26 #include <tests/myratest.h> 32 template<
class Precision>
void test(
int N, Precision tolerance)
35 myra::out() << typestring<Number>() << std::endl;
41 const auto& X = XD.first;
42 const auto& D = XD.second;
45 Precision R_error = frobenius(A-X*D*hermitian(X))/frobenius(D);
46 myra::out() <<
" |A-X*D*X'| = " << R_error << std::endl;
48 Precision X_error = frobenius(gemm(X,
'H',X)-I)/N;
49 myra::out() <<
" |X'*X -I| = " << X_error << std::endl;
54 Precision Xk_error = frobenius(gemm(Xk,
'H',Xk)-Ik)/N;
55 myra::out() <<
" |Xk'Xk-Ik| = " << Xk_error << std::endl;
58 for (
int n = 0; n < N-1; ++n)
59 sorted &= D(n) <= D(n+1);
60 myra::out() << std::boolalpha;
61 myra::out() <<
" sorted D(n) <= D(n+1) = " << sorted << std::endl;
63 REQUIRE(R_error < tolerance);
64 REQUIRE(X_error < tolerance);
65 REQUIRE(Xk_error < tolerance);
72 ADD_TEST(
"cheev",
"[dense][lapack]")
73 { test<float>(50,2.0e-5f); }
76 ADD_TEST(
"cheev_stress",
"[dense][lapack][.]")
80 for (
int n = 1; n < N; ++n)
81 for (
int t = 0; t < T; ++t)
82 test<float>(n,2.0e-5f);
86 ADD_TEST(
"zheev",
"[dense][lapack]")
87 { test<double>(50,1.0e-12); }
90 ADD_TEST(
"zheev_stress",
"[dense][lapack][.]")
94 for (
int n = 1; n < N; ++n)
95 for (
int t = 0; t < T; ++t)
96 test<double>(n,1.0e-12);
Interface class for representing subranges of DiagonalMatrix's.
Interface class for representing subranges of dense Matrix's.
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
Routines for multiplying by a DiagonalMatrix.
Reflects a Precision type into a complex type.
Definition: Number.h:46
Various utility functions/classes related to scalar Number types.
static Matrix< Number > identity(int IJ)
Generates an identity Matrix of specified size.
Definition: Matrix.cpp:349
General purpose dense matrix container, O(i*j) storage.
Computes all eigenpairs of complex hermitian Matrix.
Returns a hermitian copy of a Matrix. The inplace version only works on a square operand.
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.