33 #include <tests/myratest.h>    40 template<
class Precision> 
void test(
int I, 
int J, Precision tolerance)
    42   myra::out() << typestring<Precision>() << std::endl;
    45   auto A = G + transpose(G);
    50   myra::out() << 
"inertia = " << solver.inertia() << std::endl;
    55     solver.solve(B,
'L',
'N');
    56     Precision error = frobenius(B-X)/frobenius(X);
    57     myra::out() << 
"  |inv(A)*B-X| = " << error << std::endl;  
    58     REQUIRE(error < tolerance);
    64     solver.solve(B,
'R',
'N');
    65     Precision error = frobenius(B-X)/frobenius(X);
    66     myra::out() << 
"  |B*inv(A)-X| = " << error << std::endl;
    67     REQUIRE(error < tolerance);
    79     int n_plus  = solver.inertia().first;
    80     int n_minus = solver.inertia().second;
    82     solver.solveL(B,
'L',
'N');
    83     syrk_inplace(S2, B.
top(n_plus), 
'T', one, one);
    84     syrk_inplace(S2, B.
bottom(n_minus), 
'T',-one, one);
    86     Precision error = frobenius(S1-S2) / frobenius(S1);
    87     myra::out() << 
"  |B'*inv(A)*B - (L\\B)'*I*(L\\B)| = " << error << std::endl;
    88     REQUIRE(error < tolerance);
   101     int n_plus  = solver.inertia().first;
   102     int n_minus = solver.inertia().second;
   104     solver.solveL(B,
'L',
'N');
   105     solver.solveL(C,
'L',
'N');
   106     gemm_inplace(S2, C.
top(n_plus) , 
'T', B.top(n_plus) , 
'N',  one, one);
   107     gemm_inplace(S2, C.
bottom(n_minus), 
'T', B.bottom(n_minus), 
'N', -one, one);
   109     Precision error = frobenius(S1-S2) / frobenius(S1);
   110     myra::out() << 
"  |C'*inv(A)*B - (L\\C)'*I*(L\\B)| = " << error << std::endl;
   111     REQUIRE(error < tolerance);
   120     saved.solve(B,
'L',
'N');
   121     Precision error = frobenius(B-X)/frobenius(X);
   122     myra::out() << 
"  |inv(A)*B-X| (saved) = " << error << std::endl;  
   123     REQUIRE(error < tolerance);
   127 template<
class Precision> 
void test3(Precision tolerance)
   129   myra::out() << typestring<Precision>() << std::endl;
   132   Precision a10 = random<Precision>();
   143   solver.solve(B,
'L',
'N');
   144   Precision error = frobenius(B-X)/frobenius(X);
   145   myra::out() << 
"  |inv(A)*B-X| = " << error << std::endl;
   146   REQUIRE(error < tolerance);
   151 ADD_TEST(
"sLDLTSolver",
"[dense][solver]")
   152   { test<float>(43,14,1.0e-3f); }
   154 ADD_TEST(
"dLDLTSolver",
"[dense][solver]")
   155   { test<double>(82,45,1.0e-10); }
   157 ADD_TEST(
"sLDLTSolver3",
"[dense][solver]")
   158   { test3<float>(1.0e-3f); }
   160 ADD_TEST(
"dLDLTSolver3",
"[dense][solver]")
   161   { test3<double>(1.0e-10); }
 
static Matrix< Number > zeros(int I, int J)
Generates a zeros Matrix of specified size. 
Definition: Matrix.cpp:357
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
CMatrixRange< Number > bottom(int i) const
Returns a MatrixRange over the i bottommost rows, this(I-i:I,:) 
Definition: Matrix.cpp:225
Wraps a std::vector<char>, presents it as both an InputStream and OutputStream. Useful for hygienic u...
Definition: VectorStream.h:22
Range construct for a lower triangular matrix stored in rectangular packed format. 
Definition: stlprint.h:32
Specialized container for a lower triangular matrix, O(N^2/2) storage. Used by symmetry exploiting ma...
Returns a transposed copy of a Matrix. The inplace version only works on a square operand...
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. 
A stream that serialize/deserializes to std::vector<char> buffer. 
General purpose dense matrix container, O(i*j) storage. 
Overwrites a LowerMatrix, DiagonalMatrix, or square Matrix with its own inverse. Or, returns it as a copy. 
Simplistic random number functions. 
Factors A = L*D*L', where D is a "sign matrix" of the form [I 0; 0 -I]. Presents solve methods...
Definition: RLDLTSolver.h:30
A solver suitable for a real symmetric Matrix (indefinite is fine). Encapsulates sytrf() ...
Routines for symmetric rank-k updates, a specialized form of Matrix*Matrix multiplication. 
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS. 
CMatrixRange< Number > top(int i) const
Returns a MatrixRange over the i topmost rows, this(0:i,:) 
Definition: Matrix.cpp:207