24 #include <tests/myratest.h> 30 void test(
int I,
int J,
int N)
34 double tolerance = 1.0e-12;
36 int l = random_int(J);
37 double l_error = frobenius(A.left(l).make_Matrix()-A.make_Matrix().left(l));
38 myra::out() <<
" |A.left().make_Matrix() - A.make_Matrix().left()| = " << l_error << std::endl;
39 REQUIRE(l_error < tolerance);
41 int r = random_int(J);
42 double r_error = frobenius(A.right(r).make_Matrix()-A.make_Matrix().right(r));
43 myra::out() <<
" |A.right().make_Matrix() - A.make_Matrix().right()| = " << r_error << std::endl;
44 REQUIRE(r_error < tolerance);
46 int t = random_int(I);
47 double t_error = frobenius(A.top(t).make_Matrix()-A.make_Matrix().top(t));
48 myra::out() <<
" |A.top().make_Matrix() - A.make_Matrix().top()| = " << t_error << std::endl;
49 REQUIRE(t_error < tolerance);
51 int b = random_int(I);
52 double b_error = frobenius(A.bottom(b).make_Matrix()-A.make_Matrix().bottom(b));
53 myra::out() <<
" |A.bottom().make_Matrix() - A.make_Matrix().bottom()| = " << b_error << std::endl;
54 REQUIRE(b_error < tolerance);
55 myra::out() << std::endl;
60 ADD_TEST(
"SparseMatrix",
"[sparse]")
Interface class for representing subranges of dense Matrix's.
Routines for computing Frobenius norms of various algebraic containers.
Convenience type for building Pattern's, uses coordinate/couplet format. Note that PatternBuilder may...
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.
General purpose dense matrix container, O(i*j) storage.
Simplistic random number functions.
Container for a diagonal matrix, O(n) storage. Used by SVD, row/column scaling, etc.
Range/Iterator types associated with SparseMatrix.
|A.left().make_Matrix() - A.make_Matrix().left()| = 0
|A.right().make_Matrix() - A.make_Matrix().right()| = 0
|A.top().make_Matrix() - A.make_Matrix().top()| = 0
|A.bottom().make_Matrix() - A.make_Matrix().bottom()| = 0
|A.left().make_Matrix() - A.make_Matrix().left()| = 0
|A.right().make_Matrix() - A.make_Matrix().right()| = 0
|A.top().make_Matrix() - A.make_Matrix().top()| = 0
|A.bottom().make_Matrix() - A.make_Matrix().bottom()| = 0
|A.left().make_Matrix() - A.make_Matrix().left()| = 0
|A.right().make_Matrix() - A.make_Matrix().right()| = 0
|A.top().make_Matrix() - A.make_Matrix().top()| = 0
|A.bottom().make_Matrix() - A.make_Matrix().bottom()| = 0
|A.left().make_Matrix() - A.make_Matrix().left()| = 0
|A.right().make_Matrix() - A.make_Matrix().right()| = 0
|A.top().make_Matrix() - A.make_Matrix().top()| = 0
|A.bottom().make_Matrix() - A.make_Matrix().bottom()| = 0
|A.left().make_Matrix() - A.make_Matrix().left()| = 0
|A.right().make_Matrix() - A.make_Matrix().right()| = 0
|A.top().make_Matrix() - A.make_Matrix().top()| = 0
|A.bottom().make_Matrix() - A.make_Matrix().bottom()| = 0