## 7 Algorithms  
The iterative schemes can be adjust to have the same iterative form:  
\[\mathbf{x}_{k+1}=\mathbf{x}_{k}+\mathbf{u}_{k},\]  
but the governing equations for \(\mathbf{u}_{k}\) are different. In Table 1, we summarize the iterative schemes discussed in this paper.  
According to the different methods of the splitting iterative scheme we have the following iterative algorithms.  
Algorithms 1 and 2 can be applied to the above iterative schemes in Table 1. For saving notations we abbreviate them as A1-SOR and A2-SOR, and so on; they are Algorithms 1 and 2 for SOR, and so on. In Algorithm 2, \(\alpha\) is added to further accelerate the convergence speed. which needs to satisfy the constraint (15). For most cases we take \(\alpha=1\), otherwise specified.  
We can reduce the number of unknown parameters by using the maximization techniques, like as Theorem 6 for the QAOR method with the optimal value of \(r\).  
```
1: Give \(\mathbf{A}\), \(\mathbf{M}\), \(\mathbf{x}_{0}\), \(\alpha\), and \(\varepsilon\)
2: Do \(k=0,1,\ldots\), until \(\|\mathbf{r}_{k}\|<\varepsilon\)
3: \(\mathbf{r}_{k}=\mathbf{b}-\mathbf{A}\mathbf{x}_{k}\)
4: Solve \(\mathbf{Mu}_{k}=\mathbf{r}_{k}\)
5: \(\mathbf{x}_{k+1}=\mathbf{x}_{k}+\alpha\mathbf{u}_{k}\)
```  
**Algorithm 2**\(\eta_{k}\)-acceleration  
```
1: Give \(\mathbf{A}\), \(\mathbf{M}\), \(\mathbf{x}_{0}\), \(\alpha\), and \(\varepsilon\)
2: Do \(k=0,1,\ldots\), until \(\|\mathbf{r}_{k}\|<\varepsilon\)
3: \(\mathbf{r}_{k}=\mathbf{b}-\mathbf{A}\mathbf{x}_{c}k\)
4: Solve \(\mathbf{Mu}_{k}=\mathbf{r}_{k}\)
5: \(\eta_{k}=\frac{\mathbf{r}_{k}^{\mathrm{T}}\mathbf{Au}_{k}}{\|\mathbf{Au}_{k} \|^{2}}\)
6: \(\mathbf{x}_{k+1}=\mathbf{x}_{k}+\alpha\eta_{k}\mathbf{u}_{k}\)
```  
**Algorithm 3**\(\alpha\)-acceleration  
\begin{table}
\begin{tabular}{c c c c c} \hline
**SOR** & **AOR** & **ROR** & **POR** & **PROR** \\ \hline \(\mathbf{Pu}_{k}=w\mathbf{r}_{k}\) & \(\mathbf{Pu}_{k}=r\mathbf{r}_{k}\) & \(\mathbf{Pu}_{k}=r(1-w)\mathbf{r}_{k}\) & \(\mathbf{Qu}_{k}=r\mathbf{r}_{k}\) & \(\mathbf{Qu}_{k}=r(1-w)\mathbf{r}_{k}\) \\ \hline \end{tabular}
\end{table}
Table 1: Comparing the governing equations for \(\mathbf{u}_{k}\) for different iterative schemes; \(\mathbf{P}:=\mathbf{D}-w\mathbf{L}\) and \(\mathbf{Q}:=(1+\sigma)\mathbf{D}-w\mathbf{L}\); QAOR is a special case of POR with \(\sigma=r\).  
In Algorithm 3 for \(w\) of SOR, and Algorithm 4 for \(r\) of QAOR, we need some iterations with a loose convergence criterion say \(\epsilon_{1}=10^{-2}\); in Algorithm 5 for \(r\) of AOR and POR, and Algorithm 6 for \(r\) of ROR and PROR, they do not need any iteration.  
```
1: Give \(\mathbf{x}_{0}\), \(w^{(0)}\) and \(\epsilon_{1}\)
2: \(\mathbf{r}_{0}=\mathbf{b}-\mathbf{A}\mathbf{x}_{0}\)
3: Do \(k=0,1,\ldots\)
4: Solve \((\mathbf{D}-w^{(k)}\mathbf{L})\mathbf{v}_{0}=\mathbf{r}_{0}\)
5: \(w^{(k+1)}=\frac{\mathbf{r}_{0}^{2}\mathbf{A}\mathbf{v}_{0}}{\|\mathbf{A} \mathbf{v}_{0}\|^{2}}\)
6: Enddo, if \(|w^{(k+1)}-w^{(k)}|<\epsilon_{1}\)
```  
**Algorithm 3**for \(w\) of SOR  
```
1: Give \(\mathbf{x}_{0}\), \(w\), \(r^{(0)}\) and \(\epsilon_{1}\)
2: \(\mathbf{r}_{0}=\mathbf{b}-\mathbf{A}\mathbf{x}_{0}\)
3: Solve \([(1+r^{(k)})\mathbf{D}-w\mathbf{L}]\mathbf{v}_{0}=\mathbf{r}_{0}\)
4: \(r=\frac{\mathbf{r}_{0}^{2}\mathbf{A}\mathbf{v}_{0}}{\|\mathbf{A}\mathbf{v}_{0} \|^{2}}\)
```  
**Algorithm 4**for \(r\) of QAOR  
```
1: Give \(\mathbf{x}_{0}\), \(w\), \(\sigma\) (\(\sigma=0\) for AOR)
2: \(\mathbf{r}_{0}=\mathbf{b}-\mathbf{A}\mathbf{x}_{0}\)
3: Solve \([(1+\sigma)\mathbf{D}-w\mathbf{L}]\mathbf{v}_{0}=\mathbf{r}_{0}\)
4: \(r=\frac{\mathbf{r}_{0}^{2}\mathbf{A}\mathbf{v}_{0}}{\|\mathbf{A}\mathbf{v}_{0} \|^{2}}\)
```  
**Algorithm 5**for \(r\) of AOR and POR  
In Algorithm 5 for AOR if the optimization of \(r\) is carried out at all iteration steps it is equivalent to A2-SOR with \(r=\eta_{k}\).