37 #include <tests/myratest.h> 44 template<
class Precision>
void test(
int X,
int Y, Precision tolerance)
46 myra::out() << typestring<Precision>() << std::endl;
49 auto A = laplacian2<Precision>(X,Y);
54 for (
int k = 0; k < K; ++k)
56 auto v_d = lanczos1(make_GemmAction(A),V,tolerance,100);
57 V.vector(k).assign(v_d.first);
62 Precision R_error = frobenius(R);
63 myra::out() <<
" |A*V-V*D| = " << R_error << std::endl;
66 Precision I_error = frobenius(gemm(V,
'T',V)-I);
67 myra::out() <<
" |V'V-I| = " << I_error << std::endl;
68 REQUIRE(R_error < tolerance*10.0);
69 REQUIRE(I_error < tolerance*10.0);
74 ADD_TEST(
"lanczos1",
"[iterative]")
76 test<float> (20,15,1.0e-4f);
77 test<double>(20,15,1.0e-8);
Interface class for representing subranges of DiagonalMatrix's.
Interface class for representing subranges of dense Matrix's.
Interface class for representing subranges of dense Vector's.
Applies the "Action" of a linear operator, b := A*x, used in iterative solution algorithms.
Variety of routines for mixed dense*sparse or dense*sparse matrix multiplies. The dense*dense case is...
Routines for computing Frobenius norms of various algebraic containers.
Routines for multiplying by a DiagonalMatrix.
General purpose compressed-sparse-column (CSC) container.
Definition: stlprint.h:32
Routines for printing the contents of various std::container's to a std::ostream using 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
Signatures for sparse matrix * dense vector multiplies. All delegate to gemm() under the hood...
General purpose dense matrix container, O(i*j) storage.
Container for either a column vector or row vector (depends upon the usage context) ...
An Action for multiplying by a dense Matrix or SparseMatrix using gemm().
Finds one dominant eigenpair of a real symmetric Action.
Container for a diagonal matrix, O(n) storage. Used by SVD, row/column scaling, etc.
Helper routines for reordering/filling 2D structured grids. Used by many unit tests.
Variety of routines all for dense Matrix*Matrix multiplies. Delegates to the BLAS.
Range/Iterator types associated with SparseMatrix.