# A Parallel Two-Stage Iteration Method for Solving Continuous Sylvester Equations
## 5 Numerical Examples  
In order to illustrate the performance of the two-stage iteration (TS iteration) method, some examples were performed in Matlab on an Intel dual core processor (1.00 GHz, 2 GB RAM) and the parallel machine Lenovo Shen-teng 1800 cluster. All iterations were started from a zero matrix and terminated when the current iterate satisfied \(\|R^{(k)}\|<10^{-6}\), where \(R^{(k)}=F-(AX^{(k)}+X^{(k)}B)\) is the residual of the \(k\)th iteration. Here we compare the TS iteration method with the HSS iteration method proposed in [29]. **Notation:**: \begin{tabular}{l l} T & the computational time in seconds \\ ITs & the number of iteration steps \\ \(p\) & the total number of processors \\ S & speedup ratio \\ \(E_{1}\) & parallel efficiency \\ \(\Delta\) & error \(\|R^{(k)}\|\) \\ \end{tabular}   
**Example 1**. : _Consider the continuous Sylvester Equation (1) with \(m=n\) and the matrices_  
\[A=B=M+2 rN+\frac{100}{(n+1)^{2}}I,\]  
_where \(I\) is the identity matrix, and \(M,N\in R^{n\times n}\) are the tridiagonal matrices given by_  
\[M=\text{tridiag}(-1,-2,-1)\text{ and }N=\text{tridiag}(0.5,0,-0.5).\]  
The goal in this test is to compare the iteration steps and the computational time by using TS iteration method, HSS iteration method, and MCG method with \(r=0.01\), \(r=0.1\), and \(r=1.0\). The numerical results are listed in Tables 1-3, respectively. The optimal parameters \(\alpha_{exp}\) (with \(\beta_{exp}=\alpha_{exp}\)) for the HSS iteration method are given in Table 4 proposed in [29]. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**n**} & \multicolumn{2}{c}{**TS**} & \multicolumn{2}{c}{**HSS**} & \multicolumn{2}{c}{**MCG**} \\ \cline{2-7}  & **ITs** & **T** & **ITs** & **T** & **ITs** & **T** \\ \hline
32 & 4 & 0.030 & 41 & 0.053 & 237 & 0.036 \\
64 & 20 & 0.070 & 111 & 0.378 & 943 & 0.356 \\
128 & 130 & 1.411 & 270 & 5.995 & 4091 & 9.526 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of the the number of iteration steps (ITs) and the computational time in seconds (T) when choosing \(r=0.01\). HSS: Hermitian and skew-Hermitian splitting; MCG: modified conjugate gradient method; TS: two-stage iteration. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**n**} & \multicolumn{2}{c}{**TS**} & \multicolumn{2}{c}{**HSS**} & \multicolumn{2}{c}{**MCG**} \\ \cline{2-7}  & **ITs** & **T** & **ITs** & **T** & **ITs** & **T** \\ \hline
32 & 10 & 0.020 & 55 & 0.055 & 250 & 0.040 \\
64 & 27 & 0.159 & 96 & 0.464 & 1006 & 0.399 \\
128 & 149 & 2.593 & 205 & 7.996 & 3864 & 9.010 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of ITs and T when choosing \(r=0.1\). From the above tables, we see that both iteration steps and computational time by the TS method are much less than those by the HSS and MCG in all cases. The comparison between MCG and HSS is not straight-forward. Furthermore, for the above tables we observe that in some cases the number of iteration steps of MCG is larger than that of HSS, while on the contrary, for the computational time it mainly depends on the computational time of each iteration step. **Example 2**. : _Consider the elliptic partial differential equation_  
\[\frac{\partial^{2}u}{\partial x^{2}}+\frac{\partial^{2}u}{\partial y^{2}}+\sin 2 \pi x\frac{\partial u}{\partial x}+\sin 2\pi y\frac{\partial u}{\partial y}+u=0,0 \leq x,y\leq 1\]  
_with boundary condition_  
\[\left\{ \begin{aligned} u|_{x=0}&=u|_{x=1}=10+\cos\pi y \\ u|_{y=0}&=u|_{y=1}=10+\cos\pi x\end{aligned} \right..\]  
Let the step size be \(h=1/101\) and \(h=1/1001\). That means that the size of the linear system is \(100\times 100\) and \(1000\times 1000\), respectively. The equation is discretized by using five-point difference format, and then is transformed into a Sylvester equation. The numerical results are shown in Tables 5 and 6. This numerical experiment is performed on the parallel machine Lenovo Shen-teng 1800 cluster.