25 #include <tests/myratest.h> 33 myra::out() << typestring<Number>() << std::endl;
40 myra::out() <<
" |I(action) - I(matrix)| = " << error << std::endl;
41 REQUIRE(error < tolerance);
48 Precision error = frobenius(X-B);
49 myra::out() <<
" |I*X - X| = " << error << std::endl;
50 REQUIRE(error < tolerance);
56 auto alpha = random<Number>();
57 auto beta = random<Number>();
58 auto C = alpha*X + beta*B;
60 Precision error = frobenius(B-C);
61 myra::out() <<
" | (alpha*I*X+beta*B) - (alpha*X+beta*B) | = " << error << std::endl;
62 REQUIRE(error < tolerance);
68 ADD_TEST(
"IdentityAction",
"[iterative]")
72 test<NumberS>(I,J,1.0e-4f);
73 test<NumberD>(I,J,1.0e-12);
74 test<NumberC>(I,J,1.0e-4f);
75 test<NumberZ>(I,J,1.0e-12);
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
An Action that is just the identity operator.
Various utility functions/classes related to scalar Number types.
static Matrix< Number > identity(int IJ)
Generates an identity Matrix of specified size.
Definition: Matrix.cpp:349
General purpose dense matrix container, O(i*j) storage.
Applies the "Action" of a linear operator, b := A*x.
Definition: Action.h:29
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
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
float
|I(action) - I(matrix)| = 0
|I*X - X| = 0
| (alpha*I*X+beta*B) - (alpha*X+beta*B) | = 0
double
|I(action) - I(matrix)| = 0
|I*X - X| = 0
| (alpha*I*X+beta*B) - (alpha*X+beta*B) | = 0
std::complex<float>
|I(action) - I(matrix)| = 0
|I*X - X| = 0
| (alpha*I*X+beta*B) - (alpha*X+beta*B) | = 0
std::complex<double>
|I(action) - I(matrix)| = 0
|I*X - X| = 0
| (alpha*I*X+beta*B) - (alpha*X+beta*B) | = 0