linalg.texi

来自「math library from gnu」· TEXI 代码 · 共 1,201 行 · 第 1/4 页

TEXI
1,201
字号
@tex\beforedisplay$$A P = Q R$$\afterdisplay@end tex@ifinfo@exampleA P = Q R@end example@end ifinfo@noindentThe first @math{r} columns of @math{Q} form an orthonormal basisfor the range of @math{A} for a matrix with column rank @math{r}.  Thisdecomposition can also be used to convert the linear system @math{A x =b} into the triangular system @math{R y = Q^T b, x = P y}, which can besolved by back-substitution and permutation.  We denote the @math{QR}decomposition with column pivoting by @math{QRP^T} since @math{A = Q RP^T}.@deftypefun int gsl_linalg_QRPT_decomp (gsl_matrix * @var{A}, gsl_vector * @var{tau}, gsl_permutation * @var{p}, int * @var{signum}, gsl_vector * @var{norm})This function factorizes the @math{M}-by-@math{N} matrix @var{A} intothe @math{QRP^T} decomposition @math{A = Q R P^T}.  On output thediagonal and upper triangular part of the input matrix contain thematrix @math{R}. The permutation matrix @math{P} is stored in thepermutation @var{p}.  The sign of the permutation is given by@var{signum}. It has the value @math{(-1)^n}, where @math{n} is thenumber of interchanges in the permutation. The vector @var{tau} and thecolumns of the lower triangular part of the matrix @var{A} contain theHouseholder coefficients and vectors which encode the orthogonal matrix@var{Q}.  The vector @var{tau} must be of length @math{k=\min(M,N)}. Thematrix @math{Q} is related to these components by, @math{Q = Q_k ... Q_2Q_1} where @math{Q_i = I - \tau_i v_i v_i^T} and @math{v_i} is theHouseholder vector @math{v_i =(0,...,1,A(i+1,i),A(i+2,i),...,A(m,i))}. This is the same storage schemeas used by @sc{lapack}.  The vector @var{norm} is a workspace of length@var{N} used for column pivoting.The algorithm used to perform the decomposition is Householder QR withcolumn pivoting (Golub & Van Loan, @cite{Matrix Computations}, Algorithm5.4.1).@end deftypefun@deftypefun int gsl_linalg_QRPT_decomp2 (const gsl_matrix * @var{A}, gsl_matrix * @var{q}, gsl_matrix * @var{r}, gsl_vector * @var{tau}, gsl_permutation * @var{p}, int * @var{signum}, gsl_vector * @var{norm})This function factorizes the matrix @var{A} into the decomposition@math{A = Q R P^T} without modifying @var{A} itself and storing theoutput in the separate matrices @var{q} and @var{r}.@end deftypefun@deftypefun int gsl_linalg_QRPT_solve (const gsl_matrix * @var{QR}, const gsl_vector * @var{tau}, const gsl_permutation * @var{p}, const gsl_vector * @var{b}, gsl_vector * @var{x})This function solves the square system @math{A x = b} using the @math{QRP^T}decomposition of @math{A} held in (@var{QR}, @var{tau}, @var{p}) which must have been computed previously by @code{gsl_linalg_QRPT_decomp}.@end deftypefun@deftypefun int gsl_linalg_QRPT_svx (const gsl_matrix * @var{QR}, const gsl_vector * @var{tau}, const gsl_permutation * @var{p}, gsl_vector * @var{x})This function solves the square system @math{A x = b} in-place using the@math{QRP^T} decomposition of @math{A} held in(@var{QR},@var{tau},@var{p}). On input @var{x} should contain theright-hand side @math{b}, which is replaced by the solution on output.@end deftypefun@deftypefun int gsl_linalg_QRPT_QRsolve (const gsl_matrix * @var{Q}, const gsl_matrix * @var{R}, const gsl_permutation * @var{p}, const gsl_vector * @var{b}, gsl_vector * @var{x})This function solves the square system @math{R P^T x = Q^T b} for@var{x}. It can be used when the @math{QR} decomposition of a matrix isavailable in unpacked form as (@var{Q}, @var{R}).@end deftypefun@deftypefun int gsl_linalg_QRPT_update (gsl_matrix * @var{Q}, gsl_matrix * @var{R}, const gsl_permutation * @var{p}, gsl_vector * @var{w}, const gsl_vector * @var{v})This function performs a rank-1 update @math{w v^T} of the @math{QRP^T}decomposition (@var{Q}, @var{R}, @var{p}). The update is given by@math{Q'R' = Q (R + w v^T P)} where the output matrices @math{Q'} and@math{R'} are also orthogonal and right triangular. Note that @var{w} isdestroyed by the update. The permutation @var{p} is not changed.@end deftypefun@deftypefun int gsl_linalg_QRPT_Rsolve (const gsl_matrix * @var{QR}, const gsl_permutation * @var{p}, const gsl_vector * @var{b}, gsl_vector * @var{x})This function solves the triangular system @math{R P^T x = b} for the@math{N}-by-@math{N} matrix @math{R} contained in @var{QR}.@end deftypefun@deftypefun int gsl_linalg_QRPT_Rsvx (const gsl_matrix * @var{QR}, const gsl_permutation * @var{p}, gsl_vector * @var{x})This function solves the triangular system @math{R P^T x = b} in-placefor the @math{N}-by-@math{N} matrix @math{R} contained in @var{QR}. Oninput @var{x} should contain the right-hand side @math{b}, which isreplaced by the solution on output.@end deftypefun@node Singular Value Decomposition@section Singular Value Decomposition@cindex SVD@cindex singular value decompositionA general rectangular @math{M}-by-@math{N} matrix @math{A} has asingular value decomposition (@sc{svd}) into the product of an@math{M}-by-@math{N} orthogonal matrix @math{U}, an @math{N}-by-@math{N}diagonal matrix of singular values @math{S} and the transpose of an@math{N}-by-@math{N} orthogonal square matrix @math{V},@tex\beforedisplay$$A = U S V^T$$\afterdisplay@end tex@ifinfo@exampleA = U S V^T@end example@end ifinfo@noindentThe singular values@c{$\sigma_i = S_{ii}$}@math{\sigma_i = S_@{ii@}} are all non-negative and aregenerally chosen to form a non-increasing sequence @c{$\sigma_1 \ge \sigma_2 \ge ... \ge \sigma_N \ge 0$}@math{\sigma_1 >= \sigma_2 >= ... >= \sigma_N >= 0}.  The singular value decomposition of a matrix has many practical uses.The condition number of the matrix is given by the ratio of the largestsingular value to the smallest singular value. The presence of a zerosingular value indicates that the matrix is singular. The number ofnon-zero singular values indicates the rank of the matrix.  In practicesingular value decomposition of a rank-deficient matrix will not produceexact zeroes for singular values, due to finite numericalprecision.  Small singular values should be edited by choosing a suitabletolerance.For a rank-deficient matrix, the null space of @math{A} is given bythe columns of @math{V} corresponding to the zero singular values.Similarly, the range of @math{A} is given by columns of @math{U}corresponding to the non-zero singular values.Note that the routines here compute the ``thin'' version of the SVDwith @math{U} as @math{M}-by-@math{N} orthogonal matrix. This allowsin-place computation and is the most commonly-used form in practice.Mathematically, the ``full'' SVD is defined with @math{U} as an@math{M}-by-@math{M} orthogonal matrix and @math{S} as an@math{M}-by-@math{N} diagonal matrix (with additional rows of zeros).@deftypefun int gsl_linalg_SV_decomp (gsl_matrix * @var{A}, gsl_matrix * @var{V}, gsl_vector * @var{S}, gsl_vector * @var{work})This function factorizes the @math{M}-by-@math{N} matrix @var{A} intothe singular value decomposition @math{A = U S V^T} for @c{$M \ge N$}@math{M >= N}.  On output the matrix @var{A} is replaced by@math{U}. The diagonal elements of the singular value matrix @math{S}are stored in the vector @var{S}. The singular values are non-negativeand form a non-increasing sequence from @math{S_1} to @math{S_N}. Thematrix @var{V} contains the elements of @math{V} in untransposedform. To form the product @math{U S V^T} it is necessary to take thetranspose of @var{V}.  A workspace of length @var{N} is required in@var{work}.This routine uses the Golub-Reinsch SVD algorithm.  @end deftypefun@deftypefun int gsl_linalg_SV_decomp_mod (gsl_matrix * @var{A}, gsl_matrix * @var{X}, gsl_matrix * @var{V}, gsl_vector * @var{S}, gsl_vector * @var{work})This function computes the SVD using the modified Golub-Reinschalgorithm, which is faster for @c{$M \gg N$}@math{M>>N}.  It requires the vector @var{work} of length @var{N} and the@math{N}-by-@math{N} matrix @var{X} as additional working space.@end deftypefun@deftypefun int gsl_linalg_SV_decomp_jacobi (gsl_matrix * @var{A}, gsl_matrix * @var{V}, gsl_vector * @var{S})This function computes the SVD of the @math{M}-by-@math{N} matrix @var{A}using one-sided Jacobi orthogonalization for @c{$M \ge N$} @math{M >= N}.  The Jacobi method can compute singular values to higherrelative accuracy than Golub-Reinsch algorithms (see references fordetails).@end deftypefun@deftypefun int gsl_linalg_SV_solve (gsl_matrix * @var{U}, gsl_matrix * @var{V}, gsl_vector * @var{S}, const gsl_vector * @var{b}, gsl_vector * @var{x})This function solves the system @math{A x = b} using the singular valuedecomposition (@var{U}, @var{S}, @var{V}) held in @math{A} which must have been computed previously by @code{gsl_linalg_SV_decomp}.Only non-zero singular values are used in computing the solution. Theparts of the solution corresponding to singular values of zero areignored.  Other singular values can be edited out by setting them tozero before calling this function. In the over-determined case where @var{A} has more rows than columns thesystem is solved in the least squares sense, returning the solution@var{x} which minimizes @math{||A x - b||_2}.@end deftypefun@node Cholesky Decomposition@section Cholesky Decomposition@cindex Cholesky decomposition@cindex square root of a matrix, Cholesky decomposition@cindex matrix square root, Cholesky decompositionA symmetric, positive definite square matrix @math{A} has a Choleskydecomposition into a product of a lower triangular matrix @math{L} andits transpose @math{L^T},@tex\beforedisplay$$A = L L^T$$\afterdisplay@end tex@ifinfo@exampleA = L L^T@end example@end ifinfo@noindentThis is sometimes referred to as taking the square-root of a matrix. TheCholesky decomposition can only be carried out when all the eigenvaluesof the matrix are positive.  This decomposition can be used to convertthe linear system @math{A x = b} into a pair of triangular systems(@math{L y = b}, @math{L^T x = y}), which can be solved by forward andback-substitution.@deftypefun int gsl_linalg_cholesky_decomp (gsl_matrix * @var{A})@deftypefunx int gsl_linalg_complex_cholesky_decomp (gsl_matrix_complex * @var{A})These functions factorize the symmetric, positive-definite square matrix@var{A} into the Cholesky decomposition @math{A = L L^T} (or@c{$A = L L^{\dagger}$}@math{A = L L^H}for the complex case). On input, the values from the diagonal and lower-triangular part of the matrix @var{A} are used (the upper triangular part is ignored).  On output the diagonal and lower triangular part of the inputmatrix @var{A} contain the matrix @math{L}, while the upper triangular partof the input matrix is overwritten with @math{L^T} (the diagonal terms beingidentical for both @math{L} and @math{L^T}).  If the matrix is notpositive-definite then the decomposition will fail, returning theerror code @code{GSL_EDOM}.  When testing whether a matrix is positive-definite, disable the errorhandler first to avoid triggering an error.@end deftypefun@deftypefun int gsl_linalg_cholesky_solve (const gsl_matrix * @var{cholesky}, const gsl_vector * @var{b}, gsl_vector * @var{x})@deftypefunx int gsl_linalg_complex_cholesky_solve (const gsl_matrix_complex * @var{cholesky}, const gsl_vector_complex * @var{b}, gsl_vector_complex * @var{x})These functions solve the system @math{A x = b} using the Choleskydecomposition of @math{A} held in the matrix @var{cholesky} which musthave been previously computed by @code{gsl_linalg_cholesky_decomp} or@code{gsl_linalg_complex_cholesky_decomp}.@end deftypefun@deftypefun int gsl_linalg_cholesky_svx (const gsl_matrix * @var{cholesky}, gsl_vector * @var{x})@deftypefunx int gsl_linalg_complex_cholesky_svx (const gsl_matrix_complex * @var{cholesky}, gsl_vector_complex * @var{x})These functions solve the system @math{A x = b} in-place using theCholesky decomposition of @math{A} held in the matrix @var{cholesky}which must have been previously computed by by@code{gsl_linalg_cholesky_decomp} or@code{gsl_linalg_complex_cholesky_decomp}. On input @var{x} shouldcontain the right-hand side @math{b}, which is replaced by thesolution on output.@end deftypefun@deftypefun int gsl_linalg_cholesky_invert (gsl_matrix * @var{cholesky})This function computes the inverse of the matrix @var{cholesky} whichmust have been previously computed by @code{gsl_linalg_cholesky_decomp}.The inverse of the original matrix @math{A} is stored in @var{cholesky}on output.@end deftypefun@node Tridiagonal Decomposition of Real Symmetric Matrices@section Tridiagonal Decomposition of Real Symmetric Matrices@cindex  tridiagonal decompositionA symmetric matrix @math{A} can be factorized by similaritytransformations into the form,@tex\beforedisplay$$A = Q T Q^T$$\afterdisplay@end tex@ifinfo@exampleA = Q T Q^T@end example@end ifinfo@noindentwhere @math{Q} is an orthogonal matrix and @math{T} is a symmetrictridiagonal matrix.@deftypefun int gsl_linalg_symmtd_decomp (gsl_matrix * @var{A}, gsl_vector * @var{tau})This function factorizes the symmetric square matrix @var{A} into thesymmetric tridiagonal decomposition @math{Q T Q^T}.  On output thediagonal and subdiagonal part of the input matrix @var{A} contain thetridiagonal matrix @math{T}.  The remaining lower triangular part of theinput matrix contains the Householder vectors which, together with theHouseholder coefficients @var{tau}, encode the orthogonal matrix@math{Q}. This storage scheme is the same as used by @sc{lapack}.  Theupper triangular part of @var{A} is not referenced.@end deftypefun@deftypefun int gsl_linalg_symmtd_unpack (const gsl_matrix * @var{A}, const gsl_vector * @var{tau}, gsl_matrix * @var{Q}, gsl_vector * @var{diag}, gsl_vector * @var{subdiag})This function unpacks the encoded symmetric tridiagonal decomposition

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?