24 #include <tests/myratest.h> 37 auto B = bothcat( A.top(12).left(6), A.top(12).right(14), A.bottom(8).left(6), A.bottom(8).right(14) );
38 Precision error = frobenius(A-B);
39 myra::out() <<
" |A - bothcat(a,a,a,a)| = " << error << std::endl;
40 REQUIRE(error < tolerance);
43 #ifdef MYRAMATH_ENABLE_CPP11 50 auto B = bothcat( A.add_const().windows({10,5,5},{6,8,6}) );
51 Precision error = frobenius(A-B);
52 myra::out() <<
" |A - bothcat(...)| = " << error << std::endl;
53 REQUIRE(error < tolerance);
64 auto B = bothcat( A.top(12).left(6), A.top(12).right(14), A.bottom(8).left(6), A.bottom(8).right(14) );
66 myra::out() <<
" A == bothcat(a,a,a,a) : " << (equal?
"true":
"false") << std::endl;
70 #ifdef MYRAMATH_ENABLE_CPP11 76 auto B = bothcat( A.add_const().windows({10,5,5},{6,8,6}) );
78 myra::out() <<
" A == bothcat(...) : " << (equal?
"true":
"false") << std::endl;
86 ADD_TEST(
"bothcat_SparseMatrix",
"[sparse]")
88 test1<NumberS>(1.0e-5f);
89 test1<NumberD>(1.0e-10);
90 test1<NumberC>(1.0e-5f);
91 test1<NumberZ>(1.0e-10);
94 #ifdef MYRAMATH_ENABLE_CPP11 96 ADD_TEST(
"bothcat_SparseMatrix_cpp11",
"[sparse]")
98 test2<NumberS>(1.0e-5f);
99 test2<NumberD>(1.0e-10);
100 test2<NumberC>(1.0e-5f);
101 test2<NumberZ>(1.0e-10);
106 ADD_TEST(
"bothcat_Pattern",
"[sparse]")
109 #ifdef MYRAMATH_ENABLE_CPP11 111 ADD_TEST(
"bothcat_Pattern_cpp11",
"[sparse]")
Routines to concatenate SparseMatrix's in two-by-two fashion.
Container of values, allows random (i,j) access.
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.
static Pattern random(int I, int J, int N)
Generates a random Pattern with size IxJ and (approximately) N nonzeros.
Definition: Pattern.cpp:300
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.
Returns frobenius norm of a SparseMatrix.
Range/Iterator types associated with SparseMatrix.
Interface class for representing subranges of contiguous int's.
A == bothcat(a,a,a,a) : true