MyraMath
rcholesky2_mixed


Source: tests/multifrontal/rcholesky/rcholesky2_mixed.cpp

1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
11 // Containers.
13 #include <myramath/dense/Vector.h>
18 
19 // Algorithms.
22 #include <myramath/sparse/gemm.h>
23 #include <myramath/sparse/gemv.h>
25 
26 // Solver under test.
28 
29 // Details for setting up refinement.
33 
34 // Reporting.
36 #include <tests/myratest.h>
37 
38 using namespace myra;
39 using namespace myra_stlprint;
40 
41 ADD_TEST("rcholesky2_mixed","[multifrontal][parallel]")
42  {
43  // Define problem size.
44  int I = 64;
45  int J = 64;
46  int N = I*J;
47  // Make laplacian matrix A in double precision.
48  SparseMatrix<double> A = laplacian2<double>(I,J);
49  // Factor A = L*L' in float precision.
50  SparseRCholeskySolver<float> solver( lower_precision(A) );
51  // Make random b and x.
52  auto b = Vector<double>::random(N);
53  auto x = Vector<double>::zeros(N);
54  x = b;
55  // Solve A*x = b with pcg(), using the single precision solver as a preconditioner.
56  auto history = mixed_refine( make_GemmAction(A), make_SolveAction(solver), x, 1.0e-12, 20);
57  // Verify a low residual tolerance was reached.
58  double error = frobenius(A*x-b);
59  myra::out() << " error = " << error << std::endl;
60  myra::out() << " history = " << history << std::endl;
61  REQUIRE(error < 1.0e-10);
62  }
63 
Interface class for representing subranges of dense Vector&#39;s.
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 copying and lowering the precision of a SparseMatrix.
General purpose compressed-sparse-column (CSC) container.
static Vector< Number > random(int N)
Generates a random Vector of specified size.
Definition: Vector.cpp:276
Definition: syntax.dox:1
Definition: stlprint.h:32
Action< typename ReflectNumber< Solver >::type > make_SolveAction(const Solver &solver, char op='N')
Free function for making SolveAction&#39;s.
Definition: SolveAction.h:67
Routines for printing the contents of various std::container&#39;s to a std::ostream using operator <<...
Various utility functions/classes related to scalar Number types.
Signatures for sparse matrix * dense vector multiplies. All delegate to gemm() under the hood...
Like refine(), but uses a low-precision M to solve/refine a high-precision A.
static Vector< Number > zeros(int N)
Generates a zeros Vector of specified size.
Definition: Vector.cpp:280
Sparse direct solver suitable for real symmetric positive definite systems.
Container for either a column vector or row vector (depends upon the usage context) ...
Aggregates a (perm, iperm, swaps) triple into a vocabulary type.
Adapts a class with a .solve() method into an Action.
An Action for multiplying by a dense Matrix or SparseMatrix using gemm().
Sparse direct solver suitable for real symmetric positive definite systems.
Definition: SparseRCholeskySolver.h:61
Stores an IxJ matrix A in compressed sparse column format.
Definition: bothcat.h:23
Helper routines for reordering/filling 2D structured grids. Used by many unit tests.
Range/Iterator types associated with SparseMatrix.


Results: [PASS]

error = 9.37776e-13
history = [ 1.37703e-07 2.53913e-14 ] (2)


Go back to Summary of /test programs.