29 #include <tests/myratest.h> 46 auto P_tau = geqpf_inplace(QR);
48 auto tau = P_tau.second;
54 swap_columns(perm2swaps(P),B);
55 Precision error = frobenius(A-B) / frobenius(A);
56 myra::out() <<
"|A-P'*Q*R| = " << error << std::endl;
57 REQUIRE(error < tolerance);
60 int K = std::min(I,J);
61 for (
int k = 1; k < K; ++k)
62 if ( scalar_norm1(R(k,k)) > scalar_norm1(R(k-1,k-1)) )
76 auto P_tau = geqpf_inplace(QR);
78 auto tau = P_tau.second;
84 swap_columns(perm2swaps(P),B);
85 Precision error = frobenius(A-B) / frobenius(A);
86 myra::out() <<
"|A-P'*Q*R| = " << error << std::endl;
87 REQUIRE(error < tolerance);
90 int K = std::min(I,J);
91 for (
int k = 1; k < K; ++k)
92 if ( scalar_norm1(R(k,k)) > scalar_norm1(R(k-1,k-1)) )
108 auto P_tau = geqpf_inplace(Q);
109 auto P = P_tau.first;
110 auto tau = P_tau.second;
113 orgqr_inplace(Q,tau);
116 swap_columns(perm2swaps(P),B);
117 Precision error = frobenius(A-B) / frobenius(A);
118 myra::out() <<
"|A-P'*Q*R| = " << error << std::endl;
119 REQUIRE(error < tolerance);
121 Number r00 = R(J-1,J-1);
123 myra::out() <<
"|r00| = " << std::abs(r00) << std::endl;
124 myra::out() <<
"|r11| = " << std::abs(r11) << std::endl;
125 REQUIRE( std::abs(r00)*tolerance > std::abs(r11) );
127 auto R00 = triu( R.top(J).left(J) );
128 auto R11 = triu( R.bottom(J).right(J) );
129 myra::out() <<
"|R00| = " << frobenius(R00) << std::endl;
130 myra::out() <<
"|R11| = " << frobenius(R11) << std::endl;
131 REQUIRE( frobenius(R00)*tolerance > frobenius(R11) );
136 ADD_TEST(
"geqpf_ts_order",
"[dense][lapack]")
138 test1<NumberS>(1.0e-4f);
139 test1<NumberD>(1.0e-8);
140 test1<NumberC>(1.0e-4f);
141 test1<NumberZ>(1.0e-8);
144 ADD_TEST(
"geqpf_sf_order",
"[dense][lapack]")
146 test2<NumberS>(1.0e-4f);
147 test2<NumberD>(1.0e-8);
148 test2<NumberC>(1.0e-4f);
149 test2<NumberZ>(1.0e-8);
152 ADD_TEST(
"geqpf_rank",
"[dense][lapack]")
154 test3<NumberS>(1.0e-4f);
155 test3<NumberD>(1.0e-8);
156 test3<NumberC>(1.0e-4f);
157 test3<NumberZ>(1.0e-8);
Routines to reconstruct a Householder Q, as previously factored via geqrf_inplace() ...
Interface class for representing subranges of dense Matrix's.
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 compute a column-pivoted Householder QR decomposition.
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
Definition: stlprint.h:32
Returns the upper triangle of a dense Matrix.
Routines for printing the contents of various std::container's to a std::ostream using operator <<...
Various utility functions/classes related to scalar Number types.
Routines related to swap sequences, often used during pivoting.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
General purpose dense matrix container, O(i*j) storage.
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.
Interface class for representing subranges of contiguous int's.