54 namespace SDMUtilsUnitTest {
70 SDM B(m,m),
C(n,n), S(m,n), T(m,n);
92 qr_func(k, A, w, Q, R);
106 SDM eye(k,k), QTQ(k,k);
125 qr_func(A, Q, R, piv);
134 SDM AP(m,n), QR(m,n);
137 AP(i,
j) = A(i,piv[
j]);
142 SDM eye(k,k), QTQ(k,k);
174 SDM AP(m,k), QR(m,k);
177 AP(i,
j) = A(i,piv[
j]);
182 SDM eye(k,k), Qt(m,k), QTQ(k,k);
186 Qt(i,j) = w[i]*Q(i,j);
ordinal_type CPQR_MGS_threshold(const scalar_type &rank_threshold, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R, Teuchos::Array< ordinal_type > &piv)
Compute column-pivoted QR using modified Gram-Schmidt.
ordinal_type CPQR_Householder_threshold(const scalar_type &rank_threshold, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R, Teuchos::Array< ordinal_type > &piv)
Compute column-pivoted QR using Householder reflections.
void QR_CGS(ordinal_type k, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R)
Compute thin QR using classical Gram-Schmidt.
void QR_MGS(ordinal_type k, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R)
Compute thin QR using modified Gram-Schmidt.
int multiply(ETransp transa, ETransp transb, ScalarType alpha, const SerialDenseMatrix< OrdinalType, ScalarType > &A, const SerialDenseMatrix< OrdinalType, ScalarType > &B, ScalarType beta)
ordinal_type(* wcpqr_func_type)(const scalar_type &, const SDM &, const Teuchos::Array< scalar_type > &, SDM &, SDM &, Teuchos::Array< ordinal_type > &)
void generateRandomMatrix(SDM &A, ordinal_type rank)
bool test_weighted_CPQR(wcpqr_func_type qr_func, ordinal_type m, ordinal_type n, ordinal_type k, scalar_type rtol, scalar_type atol, Teuchos::FancyOStream &out)
void CPQR_Householder3(const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R, Teuchos::Array< ordinal_type > &piv)
Compute column-pivoted QR using Householder reflections.
bool test_CPQR(cpqr_func_type qr_func, ordinal_type m, ordinal_type n, scalar_type rtol, scalar_type atol, Teuchos::FancyOStream &out)
KOKKOS_INLINE_FUNCTION PCE< Storage > min(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
static int runUnitTestsFromMain(int argc, char *argv[])
bool compareSDM(const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &a1, const std::string &a1_name, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &a2, const std::string &a2_name, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
void(* qr_func_type)(ordinal_type, const SDM &, const Teuchos::Array< scalar_type > &, SDM &, SDM &)
bool test_QR(qr_func_type qr_func, ordinal_type m, ordinal_type n, scalar_type rtol, scalar_type atol, Teuchos::FancyOStream &out)
void(* cpqr_func_type)(const SDM &, SDM &, SDM &, Teuchos::Array< ordinal_type > &)
OrdinalType numCols() const
int main(int argc, char **argv)
#define TEUCHOS_TEST_EQUALITY(v1, v2, out, success)
void QR_MGS2(ordinal_type k, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R)
Compute thin QR using modified Gram-Schmidt with reorthogonalization.
Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > SDM
TEUCHOS_UNIT_TEST(Stokhos_SDMUtils, QR_CGS_TallSkinny)
void QR_Householder(ordinal_type k, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R)
Compute thin QR using Householder reflections.
ordinal_type CPQR_MGS_reorthog_threshold(const scalar_type &rank_threshold, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &A, const Teuchos::Array< scalar_type > &w, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &Q, Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &R, Teuchos::Array< ordinal_type > &piv)
Compute column-pivoted QR using modified Gram-Schmidt and reorthogonalization.
OrdinalType numRows() const