3#include <amdis/linearalgebra/petsc/MatrixBackend.hpp>
4#include <amdis/linearalgebra/petsc/VectorBackend.hpp>
9 template <
class Matrix,
class RowDofMap,
class ColDofMap>
10 auto residuum(Matrix
const& A, PetscVector<ColDofMap>
const& x, PetscVector<RowDofMap>
const& b)
13 VecDuplicate(b.vector(), &r);
14 MatMult(A.matrix(), x.vector(), r);
15 VecAXPY(r, -1.0, b.vector());
18 VecNorm(r, NORM_2, &res);
24 template <
class Matrix,
class RowDofMap,
class ColDofMap>
25 auto relResiduum(Matrix
const& A, PetscVector<ColDofMap>
const& x, PetscVector<RowDofMap>
const& b)
28 VecNorm(b.vector(), NORM_2, &bNrm);
29 return residuum(A,x,b) / bNrm;