X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/book_gpu.git/blobdiff_plain/4932967a1c684dc3f7ed04c19144101278b79972..a9f4a14a06edf88832d058ec85346ff66bd171b4:/BookGPU/Chapters/chapter16/bdf.tex?ds=inline

diff --git a/BookGPU/Chapters/chapter16/bdf.tex b/BookGPU/Chapters/chapter16/bdf.tex
index dcf6313..bd4e5d5 100644
--- a/BookGPU/Chapters/chapter16/bdf.tex
+++ b/BookGPU/Chapters/chapter16/bdf.tex
@@ -116,6 +116,27 @@ J\! =\! \frac{\ud x_M}{\ud x_0}
      \! + \! \frac{\alpha_2}{h_M} C_{M-2} \frac{\ud x_{M-2}}{\ud x_0}\right].
 \end{equation}
 
+\begin{algorithm}
+\caption{The matrix-free\index{matrix-free} method for
+ Krylov subspace\index{Krylov subspace} construction.}
+\label{alg:mf_Gear}
+  \KwIn{ current Krylov subspace basis vector $v$,
+           time step lengths $h_i$,
+           saved $C_i$ matrices and LU\index{LU} factors of $J_i$, $i=0,\ldots,M$}
+  \KwOut{ matrix-vector product $r$, such that $r = A v$}
+  solve $J_1 p_2 = h_1^{-1} C_0 v$ for $p_2$\;
+  solve $J_2 p_1 = h_2^{-1} \left( \alpha_1 C_1 p_2 + \alpha_2 C_0 v \right)$ for $p_1$\;
+  \For{$i=3 \ldots M$}{
+     solve
+       $J_i p_0 = \alpha_1 h_i^{-1} C_{i-1} p_1 + \alpha_2 h_i^{-1} C_{i-2} p_2$
+       for $p_0$ \label{line:mf_Gear_loop}\;
+     $p_2 = p_1$\;
+     $p_1 = p_0$\;
+  }
+   $r = (k-1) p_0 - k v$ \label{line:shift}\;
+\end{algorithm}
+
+
 %% \begin{algorithm}
 %% \caption{The matrix-free\index{matrix-free} method for
 %%  Krylov subspace\index{Krylov subspace} construction.}
@@ -138,7 +159,6 @@ J\! =\! \frac{\ud x_M}{\ud x_0}
 %% \end{algorithmic}
 %% \end{algorithm}
 
-
 %It is easy to judge that, as $J$ is dense, explicitly
 %computing $J$ is expensive and impractical for large problems.
 %In addition, with a dense matrix,
