Source: tests/sparse/threshold.cpp
22 #include <tests/myratest.h> 30 myra::out() << typestring<Number>() << std::endl;
34 auto B = dense2sparse_threshold(A.make_Matrix());
37 Precision error = frobenius(A-B);
38 myra::out() <<
" |A-threshold(A.make_Matrix())| = " << error << std::endl;
39 REQUIRE(error < tolerance);
44 ADD_TEST(
"sparse_threshold",
"[sparse]")
46 test<NumberS>(15,10,40,1.0e-4f);
47 test<NumberD>(15,10,40,1.0e-9);
48 test<NumberC>(15,10,40,1.0e-4f);
49 test<NumberZ>(15,10,40,1.0e-9);
Interface class for representing subranges of dense Matrix's.
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.
Reflects Precision trait for a Number, scalar Number types should specialize it.
Definition: Number.h:33
Generates a SparseMatrix by thresholding a dense Matrix, or another SparseMatrix. ...
Returns frobenius norm of a SparseMatrix.
Range/Iterator types associated with SparseMatrix.
Results: [PASS]
float
|A-threshold(A.make_Matrix())| = 0
double
|A-threshold(A.make_Matrix())| = 0
std::complex<float>
|A-threshold(A.make_Matrix())| = 0
std::complex<double>
|A-threshold(A.make_Matrix())| = 0
Go back to Summary of /test programs.