25 #include <tests/myratest.h> 33 myra::out() << typestring<Number>() << std::endl;
38 Precision error = frobenius( triu(A).make_Matrix() - triu(A.make_Matrix()) );
39 myra::out() <<
"|triu(A)(sparse) - triu(A)(dense)| = " << error << std::endl;
40 REQUIRE(error < tolerance);
43 void test(
int I,
int J,
int N)
49 for (
auto iterator = A.begin(); iterator != A.end(); ++iterator)
58 for (
auto iterator = U.begin(); iterator != U.end(); ++iterator)
59 if (iterator.i() > iterator.j())
66 ADD_TEST(
"triu",
"[sparse]")
68 test<NumberS>(20,30,150,1.0e-4f);
69 test<NumberD>(20,30,150,1.0e-12);
70 test<NumberC>(20,30,150,1.0e-4f);
71 test<NumberZ>(20,30,150,1.0e-12);
73 test<NumberS>(30,20,150,1.0e-4f);
74 test<NumberD>(30,20,150,1.0e-12);
75 test<NumberC>(30,20,150,1.0e-4f);
76 test<NumberZ>(30,20,150,1.0e-12);
79 ADD_TEST(
"triu_Pattern",
"[sparse]")
Returns the upper triangle of a SparseMatrixRange.
Interface class for representing subranges of dense Matrix's.
Routines for computing Frobenius norms of various algebraic containers.
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.
Returns the upper triangle of a dense Matrix.
static Pattern random(int I, int J, int N)
Generates a random Pattern with size IxJ and (approximately) N nonzeros.
Definition: Pattern.cpp:300
General purpose dense matrix container, O(i*j) storage.
Range/Iterator types associated with Pattern.
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Container class for a sparse nonzero pattern, used in reordering/symbolic analysis.
Range/Iterator types associated with SparseMatrix.