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)
58 myra::out() <<
"inertia = " << solver.inertia() << std::endl;
67 solver.solve(x.column(),
'L',
'N');
68 Precision residual = frobenius(A*x-b) / frobenius(b);
69 myra::out() <<
" |A*x-b| (solve) = " << residual << std::endl;
77 auto history = solver.refine(x.column(),
'L',
'N');
78 Precision residual = frobenius(A*x-b) / frobenius(b);
79 myra::out() <<
" |A*x-b| (refine) = " << residual << std::endl;
80 myra::out() <<
" history = " << history << std::endl;
82 REQUIRE(residual < tolerance);
88 auto history = solver.refine(x.column(),
'L',
'T');
89 Precision residual = frobenius(transpose(A)*x-b) / frobenius(b);
90 myra::out() <<
" |A^T*x-b| (refine) = " << residual << std::endl;
91 myra::out() <<
" history = " << history << std::endl;
92 REQUIRE(residual < tolerance);
98 auto history = solver.refine(x.row(),
'R',
'N');
99 Precision residual = frobenius(x*A-b) / frobenius(b);
100 myra::out() <<
" |x*A-b| (refine) = " << residual << std::endl;
101 REQUIRE(residual < tolerance);
107 auto history = solver.refine(x.row(),
'R',
'T');
108 Precision residual = frobenius(x*transpose(A)-b) / frobenius(b);
109 myra::out() <<
" |x*A^T-b| (refine) = " << residual << std::endl;
110 REQUIRE(residual < tolerance);
114 Solver copy = solver;
117 auto history = solver.refine(x.column(),
'L',
'N');
118 Precision residual = frobenius(A*x-b) / frobenius(b);
119 myra::out() <<
" |inv(A)*b-x| (copy) = " << residual << std::endl;
120 REQUIRE(residual < tolerance);
129 auto history = saved.refine(x.column(),
'L',
'N');
130 Precision residual = frobenius(A*x-b) / frobenius(b);
131 myra::out() <<
" |A*x-b| (saved) = " << residual << std::endl;
132 REQUIRE(residual < tolerance);
138 ADD_TEST(
"zldlh2_solver",
"[multifrontal][parallel]")
145 test<float >(I,J,1.0e-4f);
146 test<double>(I,J,1.0e-8);
Returns a transposed copy of a SparseMatrix.
Interface class for representing subranges of dense Matrix's.
Sparse direct solver suitable for complex hermitian indefinite systems.
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.
Wraps a std::vector<char>, presents it as both an InputStream and OutputStream. Useful for hygienic u...
Definition: VectorStream.h:22
Sparse direct solver suitable for complex hermitian indefinite systems.
Definition: SparseZLDLHSolver.h:60
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.
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
inertia = {1531,2565}
|A*x-b| (solve) = 0.000508248
|A*x-b| (refine) = 8.13978e-06
history = [ 0.000293949 6.34765e-06 ] (2)
|A^T*x-b| (refine) = 7.67395e-06
history = [ 0.000383531 5.95696e-06 ] (2)
|x*A-b| (refine) = 9.24975e-06
|x*A^T-b| (refine) = 6.34025e-06
|inv(A)*b-x| (copy) = 8.43896e-06
|A*x-b| (saved) = 7.02306e-06
double
inertia = {1531,2565}
|A*x-b| (solve) = 1.03828e-12
|A*x-b| (refine) = 1.82741e-14
history = [ 1.12802e-12 1.40342e-14 ] (2)
|A^T*x-b| (refine) = 2.68098e-14
history = [ 1.92368e-12 2.13485e-14 ] (2)
|x*A-b| (refine) = 2.66673e-14
|x*A^T-b| (refine) = 2.94271e-14
|inv(A)*b-x| (copy) = 2.10389e-14
|A*x-b| (saved) = 2.44362e-14