For large sparse matrices, direct methods that build a full decomposition of the matrix are usually unprofitable: during the decomposition, new nonzero elements appear in the positions of the original zeros — the so-called fill-in. As a result, the main advantage of a sparse matrix is lost — a small memory footprint and a small number of arithmetic operations.
We will solve system (3.1) by the iterative preconditioned conjugate gradient method (PCG). The method applies to symmetric positive definite matrices — exactly those that arise in FEM problems with elliptic operators and in implicit heat conduction schemes. Let us write out the algorithm step by step.
Let be the initial guess. The initial residual takes the form
The initial search direction and the preconditioning vector have the form
where is the preconditioner matrix: it approximates , but systems with it are much cheaper to solve. Then at every iteration we compute
The iterations continue until the squared norm of the residual drops below a given threshold
The main computational cost of each iteration is one multiplication of the sparse matrix by a vector, . This is precisely why the matrix is converted from COO to CSR before the iterations start: in this format the multiplication of a row by the vector runs only over the nonzero elements.
Next, let us talk about preconditioners.