manual update
This commit is contained in:
1 parent
615b9634eb
commit
77e508a161
3 files changed
+18
-12
No files matched your search
+10
-5
@@ -62,8 +62,8 @@ the caller with the right size. With $\beta=0$ the previous contents of \code{r}
|
||||
\midrule
|
||||
\code{davidson} & yes & \code{divide=false} & \code{'n'}, $\beta=0$ \\
|
||||
\code{lanczos} & yes (must be true) & \code{divide=false}, only without \code{initguess} & \code{'n'}, $\beta=0$ and $\beta=1$ \\
|
||||
\code{conjgrad} & -- & \code{divide=true}, if \code{precondition} & \code{'n'}; \code{'t'} if \code{doguess} or non-square \\
|
||||
\code{gmres} & -- & \code{divide=true}, if \code{precondition} & \code{'n'}; \code{'t'} if \code{doguess} or non-square \\
|
||||
\code{conjgrad} & -- & \code{divide=true}, if \code{precondition} & \code{'n'}; \code{'t'} (\code{'c'} for complex \code{T}) if \code{doguess} or non-square \\
|
||||
\code{gmres} & -- & \code{divide=true}, if \code{precondition} & \code{'n'}; \code{'t'} (\code{'c'} for complex \code{T}) if \code{doguess} or non-square \\
|
||||
\code{explicit_matrix} & -- & -- & \code{'n'}, $\beta=0$ \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
@@ -221,8 +221,12 @@ diagonal elements; use \code{precondition=false} then.
|
||||
|
||||
\paragraph{Convergence.} The criterion is $|p|\le$ \code{tol} for the current search direction $p$ (an absolute criterion;
|
||||
in the first iteration $p$ is the preconditioned residual). The function calls \code{laerror} (``singular matrix'') if
|
||||
$p\cdot Ap$ (or $|Ap|^2$) or the residual product $r\cdot z$ vanishes. Only real \code{T} is supported (the scalars are
|
||||
\code{double}).
|
||||
$p\cdot Ap$ (or $|Ap|^2$) or the residual product $r\cdot z$ vanishes. The steps are $\alpha = r^\dagger z/p^\dagger Ap$ and
|
||||
$\beta = r_{\rm new}^\dagger z_{\rm new}/r^\dagger z$, $z$ being the preconditioned residual (the product $r^\dagger z$ is kept
|
||||
between the iterations). Complex \code{T} is supported for a hermitian
|
||||
positive (semi)definite matrix: the scalar products are conjugated ($p^\dagger Ap$, $r^\dagger z$) and $A^\dagger$ replaces
|
||||
$A\Tr$ in the start vector and in the normal equations. Started from \code{x}=0 on a consistent singular semidefinite system,
|
||||
the iterates stay in the range of $A$, so the result is the minimum-norm solution.
|
||||
|
||||
%-----------------------------------------------------------------------------------------------------------------------------
|
||||
\section{GMRES}\label{sec:iterative:gmres}
|
||||
@@ -248,7 +252,8 @@ On convergence the minimizer over the whole current Krylov space is returned. A
|
||||
the Krylov space is invariant) ends the current cycle with the solution in that space; if it is not converged (singular
|
||||
matrix), the next cycle starts from the new residual.
|
||||
Calls \code{laerror} for a $1\times1$ system (\code{ncols()==1}), for incompatible sizes and for an exactly singular triangular
|
||||
factor. The scalars are \code{double}, so only real \code{T} is supported.}
|
||||
factor. Complex \code{T} is supported: the Arnoldi coefficients are $v_i^\dagger z$, the Givens rotations are unitary
|
||||
(for real \code{T} the usual ones), and $A^\dagger$ replaces $A\Tr$ in the start vector and in the normal equations.}
|
||||
\lafunc{template<class T> void gmres_backsubstitute(const NRMat<T> &R, NRVec<T> &c, const NRVec<T> &d, const int k)}{Auxiliary:
|
||||
solves the upper triangular system $R_{0..k,0..k}\,c=d$ (calls \code{c.copyonwrite()}; \code{c} must be allocated).}
|
||||
\lafunc{template<typename T> void gmres_update(NRMat<T> &H, const NRVec<T> &cci, const NRVec<T> &ssi, NRVec<T> &d, NRVec<T> &c, const int k, NRVec<T> *v, AuxStorage<T> *st, const int incore, NRVec<T> &x)}{Auxiliary:
|
||||
|
||||
+3
-3
@@ -47,9 +47,9 @@ Members & Available for \\
|
||||
\midrule
|
||||
\texttt{gemm}, \texttt{norm}, \texttt{axpy(T,const NRMat\&)}, \texttt{dot}, \texttt{transpose}, \texttt{diagmultl}, \texttt{diagmultr},
|
||||
\texttt{operator*(const NRSMat\&)}, \texttt{diagonalset}, \texttt{inverse}, \texttt{svdinverse}, \texttt{absadjoint},
|
||||
\texttt{randomize}, \texttt{amax}, \texttt{amin}, \texttt{strassen} & \texttt{double}, \texttt{float}, \texttt{complex<double>}, \texttt{complex<float>} \\
|
||||
\texttt{randomize}, \texttt{amax}, \texttt{amin}, \texttt{strassen}, \texttt{diagonalof} & \texttt{double}, \texttt{float}, \texttt{complex<double>}, \texttt{complex<float>} \\
|
||||
\texttt{operator*(const NRMat\&)} & the same and \texttt{int} \\
|
||||
\texttt{diagonalof}, \texttt{orthonormalize}, \texttt{gemm} with \texttt{SparseMat} & \texttt{double}, \texttt{float} \\
|
||||
\texttt{orthonormalize}, \texttt{gemm} with \texttt{SparseMat} & \texttt{double}, \texttt{float} \\
|
||||
\texttt{nonhermiticity} & \texttt{complex<double>}, \texttt{complex<float>} \\
|
||||
everything else & all instantiated types \\
|
||||
\bottomrule
|
||||
@@ -177,7 +177,7 @@ Note that scalar addition and subtraction act on the \emph{diagonal} only, i.e.\
|
||||
\lafunc{const NRMat submatrix(const NRVec<int> &rows, const NRVec<int> &cols) const}{Copy of the elements $A_{r_i c_j}$ for given (arbitrary) lists of row and column indices; indices are always range-checked.}
|
||||
\lafunc{void storesubmatrix(const int fromrow, const int fromcol, const NRMat &rhs)}{Store \code{rhs} as a block with the upper left corner at (\code{fromrow},\code{fromcol}). Plain data only.}
|
||||
\lafunc{void storesubmatrix(const NRVec<int> &rows, const NRVec<int> &cols, const NRMat &rhs)}{Scatter: $A_{r_i c_j}\leftarrow R_{ij}$.}
|
||||
\lafunc{const T* diagonalof(NRVec<T> &r, const bool divide = 0, bool cache = false) const}{\code{double} and \code{float} only. For a square matrix copy the diagonal into \code{r}, or with \code{divide} divide \code{r} element-wise by the (nonzero) diagonal elements. For a non-square matrix the diagonal of $A\Tr A$ (squared column norms) is used instead; \code{r} must have \code{ncols()} elements. Returns pointer to \code{r}'s data, or NULL if \code{divide}. \code{cache} is unused. Same interface as in other matrix classes, so that it can be used by iterative solvers as a preconditioner (chapter~\ref{ch:iterative}).}
|
||||
\lafunc{const T* diagonalof(NRVec<T> &r, const bool divide = 0, bool cache = false) const}{For a square matrix copy the diagonal into \code{r}, or with \code{divide} divide \code{r} element-wise by the (nonzero) diagonal elements. For a non-square matrix the diagonal of $A\Tr A$ (squared column norms, $A^\dagger A$ for complex \code{T}) is used instead; complex \code{T} only on the CPU; \code{r} must have \code{ncols()} elements. Returns pointer to \code{r}'s data, or NULL if \code{divide}. \code{cache} is unused. Same interface as in other matrix classes, so that it can be used by iterative solvers as a preconditioner (chapter~\ref{ch:iterative}).}
|
||||
\lafunc{void diagonalset(const NRVec<T> &r)}{Set the diagonal; \code{r} has $\min(n,m)$ elements.}
|
||||
\end{lareference}
|
||||
|
||||
|
||||
+5
-4
@@ -62,8 +62,8 @@ Function & Available for \\
|
||||
\texttt{gdiagonalize} & real matrix (real or complex eigenvector storage), complex matrix \\
|
||||
\texttt{trace2} with \texttt{NRSMat} & \texttt{double}, \texttt{float}, \texttt{complex<double>}, \texttt{complex<float>} (hermitian) \\
|
||||
\texttt{diagonalize3}, \texttt{realmatrixfunction}, \texttt{complexmatrixfunction},
|
||||
\texttt{adjustphases}, \texttt{xcopy}, \texttt{xdot} & \texttt{double}, \texttt{float} \\
|
||||
\texttt{xaxpy} & \texttt{double}, \texttt{float}, \texttt{complex<double>}, \texttt{complex<float>} \\
|
||||
\texttt{adjustphases}, \texttt{xcopy} & \texttt{double}, \texttt{float} \\
|
||||
\texttt{xaxpy}, \texttt{xdot} & \texttt{double}, \texttt{float}, \texttt{complex<double>}, \texttt{complex<float>} \\
|
||||
templates of \texttt{matexp.h}, \texttt{power}, \texttt{commutator}, \texttt{twoside\_transform}, \dots & any type providing the needed operations \\
|
||||
\bottomrule
|
||||
\end{tabular}
|
||||
@@ -315,9 +315,10 @@ Application from the source: overlap of Slater determinants with signed spin-orb
|
||||
\code{operator()(int,int)}.}
|
||||
\lafunc{NRMat<T> reconstructmatrix<M,T>(const M &implicitmat)}{Explicit matrix of an implicit one (applying \code{gemv} to unit vectors), for debugging;
|
||||
both template arguments must be given. Equivalent to \code{explicit_matrix<T>} of \header{davidson.h} (chapter~\ref{ch:iterative}).}
|
||||
\lafunc{void xcopy(int n, const T *x, int incx, T *y, int incy); void xaxpy(int n, const T &a, const T *x, int incx, T *y, int incy); T xdot(int n, const T *x, int incx, const T *y, int incy)}{Type-generic
|
||||
\lafunc{void xcopy(int n, const T *x, int incx, T *y, int incy); void xaxpy(int n, const T &a, const T *x, int incx, T *y, int incy); T xdot(int n, const T *x, int incx, const T *y, int incy, bool conjugate=true)}{Type-generic
|
||||
names of the CBLAS routines (to ease switching between \code{float}/\code{double}/complex in user code); specialized for \code{double} and \code{float},
|
||||
\code{xaxpy} also for \code{complex<double>} and \code{complex<float>}.}
|
||||
\code{xaxpy} and \code{xdot} also for \code{complex<double>} and \code{complex<float>}. \code{xdot} returns $\sum_i \bar x_i y_i$,
|
||||
with \code{conjugate=false} $\sum_i x_i y_i$ (no difference for real \code{T}).}
|
||||
\end{lareference}
|
||||
|
||||
\section{Examples}\label{sec:nonclass:examples}
|
||||
|
||||
Reference in new issue
Block a user