25 #include <tests/myratest.h> 37 Precision errorN = frobenius(dimm(
'L',
'N',D,X).make_Matrix()-dimm(
'L',
'N',D,X.make_Matrix()));
38 Precision errorT = frobenius(dimm(
'L',
'T',D,X).make_Matrix()-dimm(
'L',
'T',D,X.make_Matrix()));
39 Precision errorH = frobenius(dimm(
'L',
'H',D,X).make_Matrix()-dimm(
'L',
'H',D,X.make_Matrix()));
40 Precision errorC = frobenius(dimm(
'L',
'C',D,X).make_Matrix()-dimm(
'L',
'C',D,X.make_Matrix()));
41 myra::out() <<
"error |D^N * X| = " << errorN << std::endl;
42 myra::out() <<
"error |D^T * X| = " << errorT << std::endl;
43 myra::out() <<
"error |D^H * X| = " << errorH << std::endl;
44 myra::out() <<
"error |D^C * X| = " << errorC << std::endl;
45 REQUIRE(errorN < tolerance);
46 REQUIRE(errorT < tolerance);
47 REQUIRE(errorH < tolerance);
48 REQUIRE(errorC < tolerance);
57 Precision errorN = frobenius(dimm(
'R',
'N',D,X).make_Matrix()-dimm(
'R',
'N',D,X.make_Matrix()));
58 Precision errorT = frobenius(dimm(
'R',
'T',D,X).make_Matrix()-dimm(
'R',
'T',D,X.make_Matrix()));
59 Precision errorH = frobenius(dimm(
'R',
'H',D,X).make_Matrix()-dimm(
'R',
'H',D,X.make_Matrix()));
60 Precision errorC = frobenius(dimm(
'R',
'C',D,X).make_Matrix()-dimm(
'R',
'C',D,X.make_Matrix()));
61 myra::out() <<
"error |X * D^N| = " << errorN << std::endl;
62 myra::out() <<
"error |X * D^T| = " << errorT << std::endl;
63 myra::out() <<
"error |X * D^H| = " << errorH << std::endl;
64 myra::out() <<
"error |X * D^C| = " << errorC << std::endl;
65 REQUIRE(errorN < tolerance);
66 REQUIRE(errorT < tolerance);
67 REQUIRE(errorH < tolerance);
68 REQUIRE(errorC < tolerance);
73 ADD_TEST(
"sparse_dimm",
"[sparse]")
75 test1<NumberS>(100,50,500,1.0e-4f);
76 test1<NumberD>(100,50,500,1.0e-10);
77 test1<NumberC>(100,50,500,1.0e-4f);
78 test1<NumberZ>(100,50,500,1.0e-10);
79 test2<NumberS>(100,50,500,1.0e-4f);
80 test2<NumberD>(100,50,500,1.0e-10);
81 test2<NumberC>(100,50,500,1.0e-4f);
82 test2<NumberZ>(100,50,500,1.0e-10);
Interface class for representing subranges of DiagonalMatrix's.
Interface class for representing subranges of dense Matrix's.
Routines for computing Frobenius norms of various algebraic containers.
Routines for multiplying by a DiagonalMatrix.
static SparseMatrix< Number > random(int I, int J, int N)
Generates a random SparseMatrix with size IxJ and (approximately) N nonzeros.
Definition: SparseMatrix.cpp:493
General purpose compressed-sparse-column (CSC) container.
Routines for multiplying by a DiagonalMatrix.
static DiagonalMatrix< Number > random(int N)
Generates a random DiagonalMatrix of specified size.
Definition: DiagonalMatrix.cpp:217
General purpose dense matrix container, O(i*j) storage.
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Container for a diagonal matrix, O(n) storage. Used by SVD, row/column scaling, etc.
Range/Iterator types associated with SparseMatrix.