21 #include <tests/myratest.h> 29 myra::out() << typestring<Number>() << std::endl;
38 Precision error1 = frobenius(A*B*A - A);
39 Precision error2 = frobenius(B*A*B - B);
40 Precision error3 = frobenius(A*B - hermitian(B)*hermitian(A));
41 Precision error4 = frobenius(B*A - hermitian(A)*hermitian(B));
42 myra::out() <<
" |A*B*A - A| = " << error1 << std::endl;
43 myra::out() <<
" |B*A*B - B| = " << error2 << std::endl;
44 myra::out() <<
" |A*B - B'A'| = " << error3 << std::endl;
45 myra::out() <<
" |B*A - A'B'| = " << error4 << std::endl;
47 REQUIRE(error1 < tolerance);
48 REQUIRE(error2 < tolerance);
49 REQUIRE(error3 < tolerance);
50 REQUIRE(error4 < tolerance);
55 ADD_TEST(
"spinv",
"[dense]")
56 { test<NumberS>(10,12,4,1.0e-4f); }
58 ADD_TEST(
"dpinv",
"[dense]")
59 { test<NumberD>(10,12,4,1.0e-10); }
61 ADD_TEST(
"cpinv",
"[dense]")
62 { test<NumberC>(10,12,4,1.0e-4f); }
64 ADD_TEST(
"zpinv",
"[dense]")
65 { test<NumberZ>(10,12,4,1.0e-10); }
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
Returns Moore-Penrose pseudoinverse of A.
General purpose dense matrix container, O(i*j) storage.
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Returns a hermitian copy of a Matrix. The inplace version only works on a square operand.
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
std::complex<double>
|A*B*A - A| = 6.26435e-15
|B*A*B - B| = 1.90038e-16
|A*B - B'A'| = 1.51397e-15
|B*A - A'B'| = 4.7779e-15