37 #include <tests/myratest.h> 44 template<
class Precision>
void test(
int I,
int J, Precision tolerance)
46 myra::out() << typestring<Precision>() << std::endl;
47 typedef std::complex<Precision> Number;
52 for (
int n = 0; n < N; ++n)
66 solver.solve(x.column(),
'L',
'N');
67 Precision residual = frobenius(A*x-b) / frobenius(b);
68 myra::out() <<
" |A*x-b| (solve) = " << residual << std::endl;
76 auto history = solver.refine(x.column(),
'L',
'N');
77 Precision residual = frobenius(A*x-b) / frobenius(b);
78 myra::out() <<
" |A*x-b| (refine) = " << residual << std::endl;
79 myra::out() <<
" history = " << history << std::endl;
81 REQUIRE(residual < tolerance);
87 auto history = solver.refine(x.column(),
'L',
'H');
88 Precision residual = frobenius(hermitian(A)*x-b) / frobenius(b);
89 myra::out() <<
" |A^H*x-b| (refine) = " << residual << std::endl;
90 myra::out() <<
" history = " << history << std::endl;
91 REQUIRE(residual < tolerance);
97 auto history = solver.refine(x.row(),
'R',
'N');
98 Precision residual = frobenius(x*A-b) / frobenius(b);
99 myra::out() <<
" |x*A-b| (refine) = " << residual << std::endl;
100 REQUIRE(residual < tolerance);
106 auto history = solver.refine(x.row(),
'R',
'H');
107 Precision residual = frobenius(x*hermitian(A)-b) / frobenius(b);
108 myra::out() <<
" |x*A^H-b| (refine) = " << residual << std::endl;
109 REQUIRE(residual < tolerance);
113 Solver copy = solver;
116 auto history = solver.refine(x.column(),
'L',
'N');
117 Precision residual = frobenius(A*x-b) / frobenius(b);
118 myra::out() <<
" |inv(A)*b-x| (copy) = " << residual << std::endl;
119 REQUIRE(residual < tolerance);
128 auto history = saved.refine(x.column(),
'L',
'N');
129 Precision residual = frobenius(A*x-b) / frobenius(b);
130 myra::out() <<
" |A*x-b| (saved) = " << residual << std::endl;
131 REQUIRE(residual < tolerance);
137 ADD_TEST(
"zldlt2_solver",
"[multifrontal][parallel]")
144 test<float >(I,J,1.0e-4f);
145 test<double>(I,J,1.0e-8);
Sparse direct solver suitable for complex symmetric systems.
Definition: SparseZLDLTSolver.h:61
Interface class for representing subranges of dense Matrix's.
Interface class for representing subranges of dense Vector's.
Variety of routines for mixed dense*sparse or dense*sparse matrix multiplies. The dense*dense case is...
Routines for computing Frobenius norms of various algebraic containers.
Sparse direct solver suitable for complex symmetric systems.
Wraps a std::vector<char>, presents it as both an InputStream and OutputStream. Useful for hygienic u...
Definition: VectorStream.h:22
General purpose compressed-sparse-column (CSC) container.
static Vector< Number > random(int N)
Generates a random Vector of specified size.
Definition: Vector.cpp:276
Definition: stlprint.h:32
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.
Signatures for sparse matrix * dense vector multiplies. All delegate to gemm() under the hood...
A stream that serialize/deserializes to std::vector<char> buffer.
General purpose dense matrix container, O(i*j) storage.
Container for either a column vector or row vector (depends upon the usage context) ...
Aggregates a (perm, iperm, swaps) triple into a vocabulary type.
Returns a hermitian copy of a SparseMatrix.
Stores an IxJ matrix A in compressed sparse column format.
Definition: bothcat.h:23
Helper routines for reordering/filling 2D structured grids. Used by many unit tests.
Applies random phase shifts to a complex square SparseMatrix.
Range/Iterator types associated with SparseMatrix.
float
|A*x-b| (solve) = 0.000470822
|A*x-b| (refine) = 1.12287e-05
history = [ 0.000818973 1.12633e-05 ] (2)
|A^H*x-b| (refine) = 8.28294e-06
history = [ 0.000873155 8.3314e-06 ] (2)
|x*A-b| (refine) = 8.83332e-06
|x*A^H-b| (refine) = 4.43869e-06
|inv(A)*b-x| (copy) = 1.25217e-05
|A*x-b| (saved) = 9.45063e-06
double
|A*x-b| (solve) = 1.59198e-12
|A*x-b| (refine) = 1.40318e-14
history = [ 3.83509e-12 1.40993e-14 ] (2)
|A^H*x-b| (refine) = 1.74107e-14
history = [ 2.37101e-12 1.75394e-14 ] (2)
|x*A-b| (refine) = 8.6354e-15
|x*A^H-b| (refine) = 1.92932e-14
|inv(A)*b-x| (copy) = 1.91602e-14
|A*x-b| (saved) = 1.33625e-14