29 #include <tests/myratest.h> 38 myra::out() << typestring<Number>() << std::endl;
48 Precision decomposition_error = frobenius(L*Q-A);
49 myra::out() <<
" |L*Q-A| = " << decomposition_error << std::endl;
50 REQUIRE(decomposition_error < tolerance);
53 myra::out() <<
" |Q*Q'-I| = " << unitary_error << std::endl;
54 REQUIRE(unitary_error < tolerance);
62 Precision error = frobenius(gemm(Q,B_copy) - QB);
63 myra::out() <<
" |Q*B (gemm) - Q*B (gemlq) | = " << error << std::endl;
64 REQUIRE(error < tolerance);
73 Precision error = frobenius(gemm(Q,
'T',B_copy) - QtB);
74 myra::out() <<
" |Q^T*B (gemm) - Q^T*B (gemlq) | = " << error << std::endl;
75 REQUIRE(error < tolerance);
84 Precision error = frobenius(gemm(Q,
'H',B_copy) - QhB);
85 myra::out() <<
" |Q^H*B (gemm) - Q^H*B (gemlq) | = " << error << std::endl;
86 REQUIRE(error < tolerance);
94 Precision error = frobenius(gemm(Q,
'C',B_copy) - QcB);
95 myra::out() <<
" |Q^C*B (gemm) - Q^C*B (gemlq) | = " << error << std::endl;
96 REQUIRE(error < tolerance);
105 Precision error = frobenius(gemm(B_copy,Q) - BQ);
106 myra::out() <<
" |B*Q (gemm) - B*Q (gemlq) | = " << error << std::endl;
107 REQUIRE(error < tolerance);
115 Precision error = frobenius(gemm(B_copy,Q,
'T') - BQt);
116 myra::out() <<
" |B*Q^T (gemm) - B*Q^T (gemlq) | = " << error << std::endl;
117 REQUIRE(error < tolerance);
125 Precision error = frobenius(gemm(B_copy,Q,
'H') - BQh);
126 myra::out() <<
" |B*Q^H (gemm) - B*Q^H (gemlq) | = " << error << std::endl;
127 REQUIRE(error < tolerance);
136 Precision error = frobenius(gemm(B_copy,Q,
'C') - BQc);
137 myra::out() <<
" |B*Q^C (gemm) - B*Q^C (gemlq) | = " << error << std::endl;
138 REQUIRE(error < tolerance);
144 ADD_TEST(
"gelqf_tallskinny",
"[dense][lapack]")
148 myra::out() <<
"Testing lq decomposition (tall/skinny).." << std::endl;
149 test<NumberS>(N1,N2,1.0e-5f);
150 test<NumberD>(N1,N2,1.0e-10);
151 test<NumberC>(N1,N2,1.0e-5f);
152 test<NumberZ>(N1,N2,1.0e-10);
153 myra::out() << std::endl;
156 ADD_TEST(
"gelqf_shortfat",
"[dense][lapack]")
160 myra::out() <<
"Testing lq decomposition (short/fat).." << std::endl;
161 test<NumberS>(N2,N1,1.0e-5f);
162 test<NumberD>(N2,N1,1.0e-10);
163 test<NumberC>(N2,N1,1.0e-5f);
164 test<NumberZ>(N2,N1,1.0e-10);
165 myra::out() << std::endl;
168 ADD_TEST(
"gelqf_square",
"[dense][lapack]")
171 myra::out() <<
"Testing lq decomposition (square).." << std::endl;
172 test<NumberS>(N,N,1.0e-5f);
173 test<NumberD>(N,N,1.0e-10);
174 test<NumberC>(N,N,1.0e-5f);
175 test<NumberZ>(N,N,1.0e-10);
176 myra::out() << std::endl;
Interface class for representing subranges of dense Matrix's.
Routines to apply a Householder Q, as previously factored via gelqf_inplace()
Interface class for representing subranges of dense Vector's.
Tabulates an IxJ matrix. Allows random access, has column major layout to be compatible with BLAS/LAP...
Definition: bdsqr.h:20
Routines to concatenate Matrix's in left/right fashion.
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 to reconstruct a Householder Q, as previously factored via gelqf_inplace() ...
Represents a const MatrixRange.
Definition: bothcat.h:22
Returns the lower triangle of a dense Matrix.
Various utility functions/classes related to scalar Number types.
int J
---------— Data members, all public ----------------—
Definition: MatrixRange.h:241
int I
---------— Data members, all public ----------------—
Definition: MatrixRange.h:240
General purpose dense matrix container, O(i*j) storage.
Tabulates a vector of length N, allows random access.
Definition: conjugate.h:21
Container for either a column vector or row vector (depends upon the usage context) ...
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
Routines to concatenate Matrix's in top/bottom fashion.
Routines to compute a Householder LQ decomposition.
Testing lq decomposition (short/fat)..
float
|L*Q-A| = 4.10419e-07
|Q*Q'-I| = 3.41151e-07
|Q*B (gemm) - Q*B (gemlq) | = 4.77932e-07
|Q^T*B (gemm) - Q^T*B (gemlq) | = 4.04807e-07
|Q^H*B (gemm) - Q^H*B (gemlq) | = 2.3984e-07
|Q^C*B (gemm) - Q^C*B (gemlq) | = 3.50435e-07
|B*Q (gemm) - B*Q (gemlq) | = 6.0747e-07
|B*Q^T (gemm) - B*Q^T (gemlq) | = 5.89665e-07
|B*Q^H (gemm) - B*Q^H (gemlq) | = 4.85947e-07
|B*Q^C (gemm) - B*Q^C (gemlq) | = 5.20848e-07
double
|L*Q-A| = 9.80179e-16
|Q*Q'-I| = 6.7519e-16
|Q*B (gemm) - Q*B (gemlq) | = 6.08957e-16
|Q^T*B (gemm) - Q^T*B (gemlq) | = 7.99179e-16
|Q^H*B (gemm) - Q^H*B (gemlq) | = 4.76718e-16
|Q^C*B (gemm) - Q^C*B (gemlq) | = 8.23214e-16
|B*Q (gemm) - B*Q (gemlq) | = 1.21915e-15
|B*Q^T (gemm) - B*Q^T (gemlq) | = 1.04052e-15
|B*Q^H (gemm) - B*Q^H (gemlq) | = 1.113e-15
|B*Q^C (gemm) - B*Q^C (gemlq) | = 1.27335e-15
std::complex<float>
|L*Q-A| = 8.84425e-07
|Q*Q'-I| = 5.00078e-07
|Q*B (gemm) - Q*B (gemlq) | = 8.57707e-07
|Q^T*B (gemm) - Q^T*B (gemlq) | = 6.83345e-07
|Q^H*B (gemm) - Q^H*B (gemlq) | = 6.37406e-07
|Q^C*B (gemm) - Q^C*B (gemlq) | = 6.49879e-07
|B*Q (gemm) - B*Q (gemlq) | = 1.12888e-06
|B*Q^T (gemm) - B*Q^T (gemlq) | = 1.25061e-06
|B*Q^H (gemm) - B*Q^H (gemlq) | = 1.1706e-06
|B*Q^C (gemm) - B*Q^C (gemlq) | = 1.03262e-06
std::complex<double>
|L*Q-A| = 1.70527e-15
|Q*Q'-I| = 1.0065e-15
|Q*B (gemm) - Q*B (gemlq) | = 1.05087e-15
|Q^T*B (gemm) - Q^T*B (gemlq) | = 8.14966e-16
|Q^H*B (gemm) - Q^H*B (gemlq) | = 1.1583e-15
|Q^C*B (gemm) - Q^C*B (gemlq) | = 1.35699e-15
|B*Q (gemm) - B*Q (gemlq) | = 1.69414e-15
|B*Q^T (gemm) - B*Q^T (gemlq) | = 1.65205e-15
|B*Q^H (gemm) - B*Q^H (gemlq) | = 1.45195e-15
|B*Q^C (gemm) - B*Q^C (gemlq) | = 1.56972e-15