You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where $A$ is a matrix with $1 + 4 \gamma$ on the diagonal and $-\gamma$ on the off-diagonals, $U^{n+1}$ is a vector with all $U_{i,j}^{n+1}$ terms, $B$ is a matrix with $1 - 4 \gamma$ on the diagonal and $\gamma$ on the off-diagonals, and $U^{n}$ is a vector with all $U_{i,j}^{n}$ terms.
Conjugate-Gradient method
This is an algorithm to solve linear systems of equations. It is an iterative method, which means that it will converge to the solution after a number of iterations. The algorithm is as follows:
Choose an initial guess $x_0$ and set $r_0 = b - A x_0$.
If $r_0$ is sufficiently small, return $x_0$.
Set $p_0 = r_0$.
For $k = 0, 1, 2, \dots k_\text{max}$:
Set $\alpha_k = \frac{r_k^T r_k}{p_k^T A p_k}$.
Set $x_{k+1} = x_k + \alpha_k p_k$.
Set $r_{k+1} = r_k - \alpha_k A p_k$.
If $r_{k+1}$ is sufficiently small, return $x_{k+1}$.
Set $\beta_k = \frac{r_{k+1}^T r_{k+1}}{r_k^T r_k}$.