eigen.texi

来自「math library from gnu」· TEXI 代码 · 共 829 行 · 第 1/3 页

TEXI
829
字号
error code is returned.@end deftypefun@deftypefun int gsl_eigen_gen_QZ (gsl_matrix * @var{A}, gsl_matrix * @var{B}, gsl_vector_complex * @var{alpha}, gsl_vector * @var{beta}, gsl_matrix * @var{Q}, gsl_matrix * @var{Z}, gsl_eigen_gen_workspace * @var{w})This function is identical to @code{gsl_eigen_gen} except it alsocomputes the left and right Schur vectors and stores them into @var{Q}and @var{Z} respectively.@end deftypefun@deftypefun {gsl_eigen_genv_workspace *} gsl_eigen_genv_alloc (const size_t @var{n})This function allocates a workspace for computing eigenvalues andeigenvectors of @var{n}-by-@var{n} real generalized nonsymmetriceigensystems. The size of the workspace is @math{O(7n)}.@end deftypefun@deftypefun void gsl_eigen_genv_free (gsl_eigen_genv_workspace * @var{w})This function frees the memory associated with the workspace @var{w}.@end deftypefun@deftypefun int gsl_eigen_genv (gsl_matrix * @var{A}, gsl_matrix * @var{B}, gsl_vector_complex * @var{alpha}, gsl_vector * @var{beta}, gsl_matrix_complex * @var{evec}, gsl_eigen_genv_workspace * @var{w})This function computes eigenvalues and right eigenvectors of the@var{n}-by-@var{n} real generalized nonsymmetric matrix pair(@var{A}, @var{B}). The eigenvalues are stored in (@var{alpha}, @var{beta})and the eigenvectors are stored in @var{evec}. It first calls@code{gsl_eigen_gen} to compute the eigenvalues, Schur forms, andSchur vectors. Then it finds eigenvectors of the Schur forms andbacktransforms them using the Schur vectors. The Schur vectors aredestroyed in the process, but can be saved by using@code{gsl_eigen_genv_QZ}. The computed eigenvectors are normalizedto have unit magnitude. On output, (@var{A}, @var{B}) containsthe generalized Schur form (@math{S}, @math{T}). If @code{gsl_eigen_gen}fails, no eigenvectors are computed, and an error code is returned.@end deftypefun@deftypefun int gsl_eigen_genv_QZ (gsl_matrix * @var{A}, gsl_matrix * @var{B}, gsl_vector_complex * @var{alpha}, gsl_vector * @var{beta}, gsl_matrix_complex * @var{evec}, gsl_matrix * @var{Q}, gsl_matrix * @var{Z}, gsl_eigen_genv_workspace * @var{w})This function is identical to @code{gsl_eigen_genv} except it alsocomputes the left and right Schur vectors and stores them into @var{Q}and @var{Z} respectively.@end deftypefun@node Sorting Eigenvalues and Eigenvectors@section Sorting Eigenvalues and Eigenvectors@cindex sorting eigenvalues and eigenvectors@deftypefun int gsl_eigen_symmv_sort (gsl_vector * @var{eval}, gsl_matrix * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vector@var{eval} and the corresponding real eigenvectors stored in the columnsof the matrix @var{evec} into ascending or descending order according tothe value of the parameter @var{sort_type},@table @code@item GSL_EIGEN_SORT_VAL_ASCascending order in numerical value@item GSL_EIGEN_SORT_VAL_DESCdescending order in numerical value@item GSL_EIGEN_SORT_ABS_ASCascending order in magnitude@item GSL_EIGEN_SORT_ABS_DESCdescending order in magnitude@end table@end deftypefun@deftypefun int gsl_eigen_hermv_sort (gsl_vector * @var{eval}, gsl_matrix_complex * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vector@var{eval} and the corresponding complex eigenvectors stored in thecolumns of the matrix @var{evec} into ascending or descending orderaccording to the value of the parameter @var{sort_type} as shown above.@end deftypefun@deftypefun int gsl_eigen_nonsymmv_sort (gsl_vector_complex * @var{eval}, gsl_matrix_complex * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vector@var{eval} and the corresponding complex eigenvectors stored in thecolumns of the matrix @var{evec} into ascending or descending orderaccording to the value of the parameter @var{sort_type} as shown above.Only @code{GSL_EIGEN_SORT_ABS_ASC} and @code{GSL_EIGEN_SORT_ABS_DESC} aresupported due to the eigenvalues being complex.@end deftypefun@deftypefun int gsl_eigen_gensymmv_sort (gsl_vector * @var{eval}, gsl_matrix * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vector@var{eval} and the corresponding real eigenvectors stored in the columnsof the matrix @var{evec} into ascending or descending order according tothe value of the parameter @var{sort_type} as shown above.@end deftypefun@deftypefun int gsl_eigen_genhermv_sort (gsl_vector * @var{eval}, gsl_matrix_complex * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vector@var{eval} and the corresponding complex eigenvectors stored in the columnsof the matrix @var{evec} into ascending or descending order according tothe value of the parameter @var{sort_type} as shown above.@end deftypefun@deftypefun int gsl_eigen_genv_sort (gsl_vector_complex * @var{alpha}, gsl_vector * @var{beta}, gsl_matrix_complex * @var{evec}, gsl_eigen_sort_t @var{sort_type})This function simultaneously sorts the eigenvalues stored in the vectors(@var{alpha}, @var{beta}) and the corresponding complex eigenvectorsstored in the columns of the matrix @var{evec} into ascending ordescending order according to the value of the parameter @var{sort_type}as shown above. Only @code{GSL_EIGEN_SORT_ABS_ASC} and@code{GSL_EIGEN_SORT_ABS_DESC} are supported due to the eigenvalues beingcomplex.@end deftypefun@comment @deftypefun int gsl_eigen_jacobi (gsl_matrix * @var{matrix}, gsl_vector * @var{eval}, gsl_matrix * @var{evec}, unsigned int @var{max_rot}, unsigned int * @var{nrot})@comment This function finds the eigenvectors and eigenvalues of a real symmetric@comment matrix by Jacobi iteration. The data in the input matrix is destroyed.@comment @end deftypefun@comment @deftypefun int gsl_la_invert_jacobi (const gsl_matrix * @var{matrix}, gsl_matrix * @var{ainv}, unsigned int @var{max_rot})@comment Invert a matrix by Jacobi iteration.@comment @end deftypefun@comment @deftypefun int gsl_eigen_sort (gsl_vector * @var{eval}, gsl_matrix * @var{evec}, gsl_eigen_sort_t @var{sort_type})@comment This functions sorts the eigensystem results based on eigenvalues.@comment Sorts in order of increasing value or increasing@comment absolute value, depending on the value of@comment @var{sort_type}, which can be @code{GSL_EIGEN_SORT_VALUE}@comment or @code{GSL_EIGEN_SORT_ABSVALUE}.@comment @end deftypefun@node Eigenvalue and Eigenvector Examples@section ExamplesThe following program computes the eigenvalues and eigenvectors of the 4-th order Hilbert matrix, @math{H(i,j) = 1/(i + j + 1)}.@example@verbatiminclude examples/eigen.c@end example@noindentHere is the beginning of the output from the program,@example$ ./a.out eigenvalue = 9.67023e-05eigenvector = -0.02919330.328712-0.7914110.514553...@end example@noindentThis can be compared with the corresponding output from @sc{gnu octave},@exampleoctave> [v,d] = eig(hilb(4));octave> diag(d)  ans =   9.6702e-05   6.7383e-03   1.6914e-01   1.5002e+00octave> v v =   0.029193   0.179186  -0.582076   0.792608  -0.328712  -0.741918   0.370502   0.451923   0.791411   0.100228   0.509579   0.322416  -0.514553   0.638283   0.514048   0.252161@end example@noindentNote that the eigenvectors can differ by a change of sign, since thesign of an eigenvector is arbitrary.The following program illustrates the use of the nonsymmetriceigensolver, by computing the eigenvalues and eigenvectors ofthe Vandermonde matrix@c{$V(x;i,j) = x_i^{n - j}$}@math{V(x;i,j) = x_i^@{n - j@}}with @math{x = (-1,-2,3,4)}.@example@verbatiminclude examples/eigen_nonsymm.c@end example@noindentHere is the beginning of the output from the program,@example$ ./a.out eigenvalue = -6.41391 + 0ieigenvector = -0.0998822 + 0i-0.111251 + 0i0.292501 + 0i0.944505 + 0ieigenvalue = 5.54555 + 3.08545ieigenvector = -0.043487 + -0.0076308i0.0642377 + -0.142127i-0.515253 + 0.0405118i-0.840592 + -0.00148565i...@end example@noindentThis can be compared with the corresponding output from @sc{gnu octave},@exampleoctave> [v,d] = eig(vander([-1 -2 3 4]));octave> diag(d)ans =  -6.4139 + 0.0000i   5.5456 + 3.0854i   5.5456 - 3.0854i   2.3228 + 0.0000ioctave> vv = Columns 1 through 3:  -0.09988 + 0.00000i  -0.04350 - 0.00755i  -0.04350 + 0.00755i  -0.11125 + 0.00000i   0.06399 - 0.14224i   0.06399 + 0.14224i   0.29250 + 0.00000i  -0.51518 + 0.04142i  -0.51518 - 0.04142i   0.94451 + 0.00000i  -0.84059 + 0.00000i  -0.84059 - 0.00000i Column 4:  -0.14493 + 0.00000i   0.35660 + 0.00000i   0.91937 + 0.00000i   0.08118 + 0.00000i@end exampleNote that the eigenvectors corresponding to the eigenvalue@math{5.54555 + 3.08545i} are slightly different. This is becausethey differ by the multiplicative constant@math{0.9999984 + 0.0017674i} which has magnitude 1.@node Eigenvalue and Eigenvector References@section References and Further ReadingFurther information on the algorithms described in this section can befound in the following book,@itemize @asis@itemG. H. Golub, C. F. Van Loan, @cite{Matrix Computations} (3rd Ed, 1996),Johns Hopkins University Press, ISBN 0-8018-5414-8.@end itemize@noindentFurther information on the generalized eigensystems QZ algorithmcan be found in this paper,@itemize @asis@itemC. Moler, G. Stewart, "An Algorithm for Generalized Matrix EigenvalueProblems," SIAM J. Numer. Anal., Vol 10, No 2, 1973.@end itemize@noindent@cindex LAPACKEigensystem routines for very large matrices can be found in theFortran library @sc{lapack}. The @sc{lapack} library is described in,@itemize @asis@item@cite{LAPACK Users' Guide} (Third Edition, 1999), Published by SIAM,ISBN 0-89871-447-8.@uref{http://www.netlib.org/lapack} @end itemize@noindentThe @sc{lapack} source code can be found at the website above along withan online copy of the users guide.

⌨️ 快捷键说明

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