ABSTRACT

A.1 CG and PCG Implementation As described in Shewchuk 1994 [107], the PCG algorithm can be written as follows: 1 void pcg(A, x, b) { 2 Build preconditioner M from A 3

17 if (i % 50 == 0) {

— 13:03

— 13:03

the linear algebra routines and the preconditioner. The linear algebra routine module provides basic matrix and vector operations such as set, copy, multiplication, dot product, and norms. Consider the following interface:

1 template <typename S, typename V, typename M>

2 struct Blas {

3 typedef S ScalarType;

4 typedef V VectorType;

5 typedef M MatrixType;

7 // Sets the given scalar value to the output vector.