von Romaxx » Sa 21. Dez 2019, 12:24
Ich möchte gerne ein geschweifte Klammer über zwei zeilen in the algorithm umgebnung setzen.
Wie mache ich das?
\begin{algorithm}
\caption{GPR Prediction} \label{alg:gprprediction}
\algorithmicrequire{ Standardized set of training input-data \inm{\mathbf{X}}, set of training output-data \inm{\mathbf{y}}, set of test input-data \inm{\mathbf{X}_*}, covariance function \inm{\mathrm{k}}, learned parameters \inm{\boldsymbol\uptheta_I}}\\
\algorithmicensure{ Model prediction \inm{\mathbf{m}_{f_{\mathbf{X}_*}}, \boldsymbol\Sigma_{f_{\mathbf{X}_*}}}}
\begin{algorithmic}
\Function{\inm{\mathbf{m}_{f_{\mathbf{X}_*}}, \boldsymbol\Sigma_{f_{\mathbf{X}_*}}=}Prediction}{\inm{\mathbf{X},\mathbf{y},\mathbf{X}_*,\mathrm{k}\boldsymbol\uptheta_I}}:
\State \inm{L = \text{cholesky}(K)}; (pre-computation)
\State \inm{\boldsymbol\upalpha = L^T\backslash(L\backslash\mathbf{y})}; (pre-computation)
\State \inm{\mathbf{v} = LK_{NN_*}};
\State \inm{\mathbf{m}_{f_{\mathbf{X}_*}}=K_{N_*N}\boldsymbol\upalpha};
\State \inm{\boldsymbol\Sigma_{f_{\mathbf{X}_*}}= \text{diag}(K_{N_*N_*})- \mathbf{v}^T\mathbf{v}};
\EndFunction
\end{algorithmic}
\end{algorithm}
Z.B. möchte ich (pre-computation; Zeile 7 und 8 ), das in meinem code zweimal auftaucht, mit einer geschweiften klammer ersetzen, das über zwei Zeilen geht.
Vielen dank.
Ich möchte gerne ein geschweifte Klammer über zwei zeilen in the algorithm umgebnung setzen.
Wie mache ich das?
[code]
\begin{algorithm}
\caption{GPR Prediction} \label{alg:gprprediction}
\algorithmicrequire{ Standardized set of training input-data \inm{\mathbf{X}}, set of training output-data \inm{\mathbf{y}}, set of test input-data \inm{\mathbf{X}_*}, covariance function \inm{\mathrm{k}}, learned parameters \inm{\boldsymbol\uptheta_I}}\\
\algorithmicensure{ Model prediction \inm{\mathbf{m}_{f_{\mathbf{X}_*}}, \boldsymbol\Sigma_{f_{\mathbf{X}_*}}}}
\begin{algorithmic}
\Function{\inm{\mathbf{m}_{f_{\mathbf{X}_*}}, \boldsymbol\Sigma_{f_{\mathbf{X}_*}}=}Prediction}{\inm{\mathbf{X},\mathbf{y},\mathbf{X}_*,\mathrm{k}\boldsymbol\uptheta_I}}:
\State \inm{L = \text{cholesky}(K)}; (pre-computation)
\State \inm{\boldsymbol\upalpha = L^T\backslash(L\backslash\mathbf{y})}; (pre-computation)
\State \inm{\mathbf{v} = LK_{NN_*}};
\State \inm{\mathbf{m}_{f_{\mathbf{X}_*}}=K_{N_*N}\boldsymbol\upalpha};
\State \inm{\boldsymbol\Sigma_{f_{\mathbf{X}_*}}= \text{diag}(K_{N_*N_*})- \mathbf{v}^T\mathbf{v}};
\EndFunction
\end{algorithmic}
\end{algorithm}
[/code]
Z.B. möchte ich (pre-computation; Zeile 7 und 8 ), das in meinem code zweimal auftaucht, mit einer geschweiften klammer ersetzen, das über zwei Zeilen geht.
Vielen dank.