From 2cdef5d636a072c125b708e20e14f2183598beea Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Fri, 23 Oct 2015 16:02:10 -0400 Subject: [PATCH] docs stdlib/linalg: more RST formatting fixes (cherry picked from commit 5c82c3e8641b8d2ea220bd2cd0de1a7887137435) --- base/docs/helpdb.jl | 26 +++++----- base/linalg/arnoldi.jl | 92 ++++++++++++++++----------------- doc/stdlib/linalg.rst | 115 +++++++++++++++++++++-------------------- 3 files changed, 117 insertions(+), 116 deletions(-) diff --git a/base/docs/helpdb.jl b/base/docs/helpdb.jl index 92e5652b65f71..0ede15da29136 100644 --- a/base/docs/helpdb.jl +++ b/base/docs/helpdb.jl @@ -7402,11 +7402,12 @@ doc""" Uses :func:`eigs` underneath. Inputs are: - * ``A``: Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``, ``eltype(A)``, ``A * vector`` and ``A' * vector``. - * ``nsv``: Number of singular values. - * ``ritzvec``: Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``, default is ``true``. If ``false`` the singular vectors are omitted from the output. - * ``tol``: tolerance, see :func:`eigs`. - * ``maxiter``: Maximum number of iterations, see :func:`eigs`. + +* ``A``: Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``, ``eltype(A)``, ``A * vector`` and ``A' * vector``. +* ``nsv``: Number of singular values. +* ``ritzvec``: Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``, default is ``true``. If ``false`` the singular vectors are omitted from the output. +* ``tol``: tolerance, see :func:`eigs`. +* ``maxiter``: Maximum number of iterations, see :func:`eigs`. **Example**:: @@ -7647,14 +7648,13 @@ straight line to the given points `(x, y)`, i.e., such that the squared error between `y` and `a + b*x` is minimized. **Example**: -``` - using PyPlot - x = [1.0:12.0;] - y = [5.5, 6.3, 7.6, 8.8, 10.9, 11.79, 13.48, 15.02, 17.77, 20.81, 22.0, 22.99] - a, b = linreg(x, y) # Linear regression - plot(x, y, "o") # Plot (x, y) points - plot(x, [a+b*i for i in x]) # Plot line determined by linear regression -``` + + using PyPlot + x = [1.0:12.0;] + y = [5.5, 6.3, 7.6, 8.8, 10.9, 11.79, 13.48, 15.02, 17.77, 20.81, 22.0, 22.99] + a, b = linreg(x, y) # Linear regression + plot(x, y, "o") # Plot (x, y) points + plot(x, [a+b*i for i in x]) # Plot line determined by linear regression """ linreg(x,y) diff --git a/base/linalg/arnoldi.jl b/base/linalg/arnoldi.jl index 0806a6c60aaf8..a6c843605eed1 100644 --- a/base/linalg/arnoldi.jl +++ b/base/linalg/arnoldi.jl @@ -11,29 +11,29 @@ Computes eigenvalues ``d`` of ``A`` using Lanczos or Arnoldi iterations for real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``. The default is ``ncv = max(20,2*nev+1)``. - - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations + +* ``nev``: Number of eigenvalues +* ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``. The default is ``ncv = max(20,2*nev+1)``. + Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. +* ``which``: type of eigenvalues to compute. See the note below. + + ========= ====================================================================================================================== + ``which`` type of eigenvalues + ========= ====================================================================================================================== + ``:LM`` eigenvalues of largest magnitude (default) + ``:SM`` eigenvalues of smallest magnitude + ``:LR`` eigenvalues of largest real part + ``:SR`` eigenvalues of smallest real part + ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) + ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) + ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) + ========= ====================================================================================================================== + +* ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) +* ``maxiter``: Maximum number of iterations (default = 300) +* ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. +* ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` +* ``v0``: starting vector from which to start the iterations ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. @@ -58,29 +58,29 @@ Computes generalized eigenvalues ``d`` of ``A`` and ``B`` using Lanczos or Arnol real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``. The default is ``ncv = max(20,2*nev+1)``. - - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations + +* ``nev``: Number of eigenvalues +* ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``. The default is ``ncv = max(20,2*nev+1)``. + Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. +* ``which``: type of eigenvalues to compute. See the note below. + + ========= ====================================================================================================================== + ``which`` type of eigenvalues + ========= ====================================================================================================================== + ``:LM`` eigenvalues of largest magnitude (default) + ``:SM`` eigenvalues of smallest magnitude + ``:LR`` eigenvalues of largest real part + ``:SR`` eigenvalues of smallest real part + ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) + ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) + ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) + ========= ====================================================================================================================== + +* ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) +* ``maxiter``: Maximum number of iterations (default = 300) +* ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. +* ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` +* ``v0``: starting vector from which to start the iterations ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. diff --git a/doc/stdlib/linalg.rst b/doc/stdlib/linalg.rst index 101924474d95f..156bd98d53488 100644 --- a/doc/stdlib/linalg.rst +++ b/doc/stdlib/linalg.rst @@ -780,12 +780,12 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. code-block:: julia - using PyPlot - x = [1.0:12.0;] - y = [5.5, 6.3, 7.6, 8.8, 10.9, 11.79, 13.48, 15.02, 17.77, 20.81, 22.0, 22.99] - a, b = linreg(x, y) # Linear regression - plot(x, y, "o") # Plot (x, y) points - plot(x, [a+b*i for i in x]) # Plot line determined by linear regression + using PyPlot + x = [1.0:12.0;] + y = [5.5, 6.3, 7.6, 8.8, 10.9, 11.79, 13.48, 15.02, 17.77, 20.81, 22.0, 22.99] + a, b = linreg(x, y) # Linear regression + plot(x, y, "o") # Plot (x, y) points + plot(x, [a+b*i for i in x]) # Plot line determined by linear regression .. function:: linreg(x, y, w) @@ -926,29 +926,29 @@ Linear algebra functions in Julia are largely implemented by calling functions f real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``. The default is ``ncv = max(20,2*nev+1)``. - - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations + + * ``nev``: Number of eigenvalues + * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``. The default is ``ncv = max(20,2*nev+1)``. + Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. + * ``which``: type of eigenvalues to compute. See the note below. + + ========= ====================================================================================================================== + ``which`` type of eigenvalues + ========= ====================================================================================================================== + ``:LM`` eigenvalues of largest magnitude (default) + ``:SM`` eigenvalues of smallest magnitude + ``:LR`` eigenvalues of largest real part + ``:SR`` eigenvalues of smallest real part + ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) + ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) + ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) + ========= ====================================================================================================================== + + * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) + * ``maxiter``: Maximum number of iterations (default = 300) + * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. + * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` + * ``v0``: starting vector from which to start the iterations ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. @@ -969,29 +969,29 @@ Linear algebra functions in Julia are largely implemented by calling functions f real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``. The default is ``ncv = max(20,2*nev+1)``. - - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations + + * ``nev``: Number of eigenvalues + * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``. The default is ``ncv = max(20,2*nev+1)``. + Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. + * ``which``: type of eigenvalues to compute. See the note below. + + ========= ====================================================================================================================== + ``which`` type of eigenvalues + ========= ====================================================================================================================== + ``:LM`` eigenvalues of largest magnitude (default) + ``:SM`` eigenvalues of smallest magnitude + ``:LR`` eigenvalues of largest real part + ``:SR`` eigenvalues of smallest real part + ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) + ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) + ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) + ========= ====================================================================================================================== + + * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) + * ``maxiter``: Maximum number of iterations (default = 300) + * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. + * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` + * ``v0``: starting vector from which to start the iterations ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. @@ -1012,11 +1012,12 @@ Linear algebra functions in Julia are largely implemented by calling functions f Uses :func:`eigs` underneath. Inputs are: - * ``A``: Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``, ``eltype(A)``, ``A * vector`` and ``A' * vector``. - * ``nsv``: Number of singular values. - * ``ritzvec``: Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``, default is ``true``. If ``false`` the singular vectors are omitted from the output. - * ``tol``: tolerance, see :func:`eigs`. - * ``maxiter``: Maximum number of iterations, see :func:`eigs`. + + * ``A``: Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``, ``eltype(A)``, ``A * vector`` and ``A' * vector``. + * ``nsv``: Number of singular values. + * ``ritzvec``: Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``, default is ``true``. If ``false`` the singular vectors are omitted from the output. + * ``tol``: tolerance, see :func:`eigs`. + * ``maxiter``: Maximum number of iterations, see :func:`eigs`. **Example**::