25 #include <tests/myratest.h> 32 template<
class Precision>
void test1(
int I,
int J, Precision tolerance)
34 typedef Precision Number;
35 myra::out() << typestring<Number>() << std::endl;
37 auto A = laplacian2<Number>(I,J);
42 solver.solve(eyeL,
'L');
44 solver.solve(eyeR,
'R');
45 Precision error = frobenius(eyeL-eyeR);
46 myra::out() <<
"|L'\\L\\I - I/L/L'| = " << error << std::endl;
47 REQUIRE(error < tolerance);
51 template<
class Precision>
void test2(
int I,
int J, Precision tolerance)
53 typedef std::complex<Precision> Number;
54 myra::out() << typestring<Number>() << std::endl;
56 auto A = laplacian2<Number>(I,J);
62 solver.solve(eyeL,
'L');
64 solver.solve(eyeR,
'R');
65 Precision error = frobenius(eyeL-eyeR);
66 myra::out() <<
"|L'\\L\\I - I/L/L'| = " << error << std::endl;
67 REQUIRE(error < tolerance);
72 ADD_TEST(
"ICholeskySolver",
"[iterative]")
75 test1<float> (20,20,1.0e-4f);
76 test1<double>(20,20,1.0e-8);
78 test2<float> (20,20,1.0e-4f);
79 test2<double>(20,20,1.0e-8);
Interface class for representing subranges of dense Matrix's.
Routines for computing Frobenius norms of various algebraic containers.
General purpose compressed-sparse-column (CSC) container.
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.
Incompletely factors A ~= L*L', presents approximate solve() method.
Definition: ICholeskySolver.h:28
Helper routines for reordering/filling 2D structured grids. Used by many unit tests.
Applies random phase shifts to a complex square SparseMatrix.
Incomplete Cholesky preconditioner. Presents a solve() function, but it's only approximate.
Range/Iterator types associated with SparseMatrix.
float
|L'\L\I - I/L/L'| = 1.88734e-07
double
|L'\L\I - I/L/L'| = 4.0476e-16
std::complex<float>
|L'\L\I - I/L/L'| = 1.99883e-07
std::complex<double>
|L'\L\I - I/L/L'| = 4.25093e-16