29 #include <tests/myratest.h> 38 myra::out() << typestring<Number>() << std::endl;
48 potrf_inplace(
'L',
'R',L);
51 Precision error1 = frobenius( (triu(L)-diag(L).make_Matrix()) - (triu(A)-diag(A).make_Matrix()) ) / frobenius(triu(A)-diag(A).make_Matrix());
52 myra::out() <<
" |triu(L)-triu(A)| = " << error1 << std::endl;
53 REQUIRE(error1 < tolerance);
56 Precision error2 = frobenius(gemm(L,L,
'H')-A) / frobenius(A);
57 myra::out() <<
" |L*L'-A| = " << error2 <<
" (" << t <<
" sec)" << std::endl;
58 REQUIRE(error2 < tolerance);
65 potrf_inplace(
'L',
'L',L);
68 Precision error1 = frobenius( (triu(L)-diag(L).make_Matrix()) - (triu(A)-diag(A).make_Matrix()) ) / frobenius(triu(A)-diag(A).make_Matrix());
69 myra::out() <<
" |triu(L)-triu(A)| = " << error1 << std::endl;
70 REQUIRE(error1 < tolerance);
73 Precision error2 = frobenius(gemm(L,
'H',L)-A) / frobenius(A);
74 myra::out() <<
" |L'*L-A| = " << error2 <<
" (" << t <<
" sec)" << std::endl;
75 REQUIRE(error2 < tolerance);
82 potrf_inplace(
'U',
'R',U);
85 Precision error1 = frobenius( (tril(U)-diag(U).make_Matrix()) - (tril(A)-diag(A).make_Matrix()) ) / frobenius(tril(A)-diag(A).make_Matrix());
86 myra::out() <<
" |tril(U)-tril(A)| = " << error1 << std::endl;
87 REQUIRE(error1 < tolerance);
90 Precision error2 = frobenius(gemm(U,U,
'H')-A) / frobenius(A);
91 myra::out() <<
" |U*U'-A| = " << error2 <<
" (" << t <<
" sec)" << std::endl;
92 REQUIRE(error2 < tolerance);
99 potrf_inplace(
'U',
'L',U);
102 Precision error1 = frobenius( (tril(U)-diag(U).make_Matrix()) - (tril(A)-diag(A).make_Matrix()) ) / frobenius(tril(A)-diag(A).make_Matrix());
103 myra::out() <<
" |tril(U)-tril(A)| = " << error1 << std::endl;
104 REQUIRE(error1 < tolerance);
107 Precision error2 = frobenius(gemm(U,
'H',U)-A) / frobenius(A);
108 myra::out() <<
" |U'*U-A| = " << error2 <<
" (" << t <<
" sec)" << std::endl;
109 REQUIRE(error2 < tolerance);
115 ADD_TEST(
"spotrf",
"[dense][lapack]")
116 { test<NumberS>(128,1.0e-4f); }
118 ADD_TEST(
"dpotrf",
"[dense][lapack]")
119 { test<NumberD>(128,1.0e-9); }
121 ADD_TEST(
"cpotrf",
"[dense][lapack]")
122 { test<NumberC>(128,1.0e-4f); }
124 ADD_TEST(
"zpotrf",
"[dense][lapack]")
125 { test<NumberZ>(128,1.0e-9); }
Cholesky factorization routines for positive definite matrices.
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
Simplistic timing class, might dispatch to platform specific timers depending upon environment...
Measures elapsed time.
Definition: Timer.h:19
Returns the lower triangle of a dense Matrix.
Returns the upper triangle of a dense Matrix.
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.
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Returns the diagonal of a dense Matrix or LowerMatrix.
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.
double elapsed_time() const
Returns elapsed time in seconds since last call to reset()
Definition: Timer.cpp:18
std::complex<float>
|triu(L)-triu(A)| = 0
|L*L'-A| = 1.22153e-07 (0 sec)
|triu(L)-triu(A)| = 0
|L'*L-A| = 1.68518e-07 (0 sec)
|tril(U)-tril(A)| = 0
|U*U'-A| = 1.68872e-07 (0.001 sec)
|tril(U)-tril(A)| = 0
|U'*U-A| = 7.54459e-08 (0 sec)