27 #include <tests/myratest.h> 36 myra::out() << typestring<Number>() << std::endl;
40 auto action = -make_GemmAction(A);
43 Precision error = frobenius(-A-action.
make_Matrix());
44 myra::out() <<
" |A(action) - A(dense)| = " << error << std::endl;
45 REQUIRE(error < tolerance);
52 Precision error = frobenius(-A*X-B);
53 myra::out() <<
" |A*X - B| = " << error << std::endl;
54 REQUIRE(error < tolerance);
60 auto alpha = random<Number>();
61 auto beta = random<Number>();
62 auto C = -alpha*A*X + beta*B;
64 Precision error = frobenius(B-C);
65 myra::out() <<
" | (alpha*A*X+beta*B)[action] - (alpha*A*X+beta*B)[dense] | = " << error << std::endl;
66 REQUIRE(error < tolerance);
72 ADD_TEST(
"NegateAction",
"[iterative]")
78 test1<NumberS>(I,J,K,1.0e-4f);
79 test1<NumberD>(I,J,K,1.0e-10);
80 test1<NumberC>(I,J,K,1.0e-4f);
81 test1<NumberZ>(I,J,K,1.0e-10);
Interface class for representing subranges of dense Matrix's.
Applies the "Action" of a linear operator, b := A*x, used in iterative solution algorithms.
static Matrix< Number > zeros(int I, int J)
Generates a zeros Matrix of specified size.
Definition: Matrix.cpp:357
Routines for computing Frobenius norms of various algebraic containers.
static Matrix< Number > random(int I, int J)
Generates a random Matrix of specified size.
Definition: Matrix.cpp:353
Returns the negation of an Action A.
Various utility functions/classes related to scalar Number types.
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
Matrix< Number > make_Matrix() const
Tabulates *this into a dense Matrix.
Definition: Action.cpp:71
An Action for multiplying by a dense Matrix or SparseMatrix using gemm().
Simplistic random number functions.
void multiply(const CMatrixRange< Number > &X, const MatrixRange< Number > &B, Number alpha, Number beta) const
Assigns B = alpha*A*X + beta*B.
Definition: Action.cpp:55
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
float
|A(action) - A(dense)| = 0
|A*X - B| = 0
| (alpha*A*X+beta*B)[action] - (alpha*A*X+beta*B)[dense] | = 0
double
|A(action) - A(dense)| = 0
|A*X - B| = 0
| (alpha*A*X+beta*B)[action] - (alpha*A*X+beta*B)[dense] | = 0
std::complex<float>
|A(action) - A(dense)| = 0
|A*X - B| = 0
| (alpha*A*X+beta*B)[action] - (alpha*A*X+beta*B)[dense] | = 6.51404e-07
std::complex<double>
|A(action) - A(dense)| = 0
|A*X - B| = 0
| (alpha*A*X+beta*B)[action] - (alpha*A*X+beta*B)[dense] | = 1.07295e-15