32 #include <tests/myratest.h> 38 template<
class Precision>
void test(
int I,
int J, Precision tolerance)
40 myra::out() << typestring<Precision>() << std::endl;
41 typedef std::complex<Precision> Number;
49 Options options = Options::create().set_blocksize(8).set_globsize(4).set_nthreads(1);
54 std::vector<int> Ri(20,0);
55 for (
int i = 0; i < Ri.size(); ++i)
56 Ri[i] = random_int(N);
59 std::vector<int> Rj(30,0);
60 for (
int j = 0; j < Rj.size(); ++j)
61 Rj[j] = random_int(N);
70 Precision error_N = frobenius( gemm(Z,
'N',B1) - solver.partialsolve(Ri,Rj,B1,
'L',
'N') );
71 Precision error_T = frobenius( gemm(Z,
'T',B2) - solver.partialsolve(Ri,Rj,B2,
'L',
'T') );
72 Precision error_H = frobenius( gemm(Z,
'H',B2) - solver.partialsolve(Ri,Rj,B2,
'L',
'H') );
73 Precision error_C = frobenius( gemm(Z,
'C',B1) - solver.partialsolve(Ri,Rj,B1,
'L',
'C') );
74 myra::out() <<
" error in Z^N * B = " << error_N << std::endl;
75 myra::out() <<
" error in Z^T * B = " << error_T << std::endl;
76 myra::out() <<
" error in Z^H * B = " << error_H << std::endl;
77 myra::out() <<
" error in Z^C * B = " << error_C << std::endl;
78 REQUIRE(error_N < tolerance);
79 REQUIRE(error_T < tolerance);
80 REQUIRE(error_H < tolerance);
81 REQUIRE(error_C < tolerance);
87 Precision error_N = frobenius( gemm(B1,Z,
'N') - solver.partialsolve(Ri,Rj,B1,
'R',
'N') );
88 Precision error_T = frobenius( gemm(B2,Z,
'T') - solver.partialsolve(Ri,Rj,B2,
'R',
'T') );
89 Precision error_H = frobenius( gemm(B2,Z,
'H') - solver.partialsolve(Ri,Rj,B2,
'R',
'H') );
90 Precision error_C = frobenius( gemm(B1,Z,
'C') - solver.partialsolve(Ri,Rj,B1,
'R',
'C') );
91 myra::out() <<
" error in B * Z^N = " << error_N << std::endl;
92 myra::out() <<
" error in B * Z^T = " << error_T << std::endl;
93 myra::out() <<
" error in B * Z^H = " << error_H << std::endl;
94 myra::out() <<
" error in B * Z^C = " << error_C << std::endl;
95 REQUIRE(error_N < tolerance);
96 REQUIRE(error_T < tolerance);
97 REQUIRE(error_H < tolerance);
98 REQUIRE(error_C < tolerance);
104 ADD_TEST(
"zcholesky2_partialsolve",
"[multifrontal][parallel]")
106 test<float >(20,20,1.0e-4f);
107 test<double>(20,20,1.0e-10);
Interface class for representing subranges of dense Matrix's.
Options pack for routines in /multifrontal.
Definition: Options.h:24
Represents a Permutation matrix, used to reorder rows/columns/etc of various numeric containers...
Definition: Permutation.h:34
Tabulates an IxJ matrix. Allows random access, has column major layout to be compatible with BLAS/LAP...
Definition: bdsqr.h:20
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
Sparse direct solver suitable for hermitian positive definite systems.
Reduces a std::vector to its unique entries, and sorts it.
General purpose compressed-sparse-column (CSC) container.
void sortunique(std::vector< T > &v)
Reduces a std::vector to its unique entries, and sorts it.
Definition: sortunique.h:20
Various utility functions/classes related to scalar Number types.
General purpose dense matrix container, O(i*j) storage.
Aggregates a (perm, iperm, swaps) triple into a vocabulary type.
Sparse direct solver suitable for hermitian positive definite systems.
Definition: SparseZCholeskySolver.h:61
Simplistic random number functions.
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.
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
Applies random phase shifts to a complex square SparseMatrix.
Range/Iterator types associated with SparseMatrix.
Interface class for representing subranges of contiguous int's.
float
error in Z^N * B = 2.13941e-07
error in Z^T * B = 2.28013e-07
error in Z^H * B = 2.37269e-07
error in Z^C * B = 2.18977e-07
error in B * Z^N = 1.98323e-07
error in B * Z^T = 2.2747e-07
error in B * Z^H = 2.2248e-07
error in B * Z^C = 2.30425e-07
double
error in Z^N * B = 4.17196e-16
error in Z^T * B = 3.94986e-16
error in Z^H * B = 3.53956e-16
error in Z^C * B = 3.96072e-16
error in B * Z^N = 4.18703e-16
error in B * Z^T = 4.50374e-16
error in B * Z^H = 4.11423e-16
error in B * Z^C = 4.22322e-16