home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Hilbert matrix.
-
- // Syntax: H = hilb ( N )
-
- // Description:
-
- // H is the N-by-N matrix with elements 1/(i+j-1). It is a famous
- // example of a badly conditioned matrix. cond(hilb(N)) grows
- // like EXP(3.5*N). See INVHILB (standard MATLAB routine) for the
- // exact inverse, which has integer entries. Hilb(N) is symmetric
- // positive definite, totally positive, and a Hankel matrix.
-
- // References:
- // M.-D. Choi, Tricks or treats with the Hilbert matrix, Amer. Math.
- // Monthly, 90 (1983), pp. 301-312.
- // M. Newman and J. Todd, The evaluation of matrix inversion
- // programs, J. Soc. Indust. Appl. Math., 6 (1958), pp. 466-476.
- // D.E. Knuth, The Art of Computer Programming,
- // Volume 1, Fundamental Algorithms, second edition, Addison-Wesley,
- // Reading, Massachusetts, 1973, p. 37.
-
- // This file is a translation of hilb.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- // Dependencies
- require cauchy
-
- //-------------------------------------------------------------------//
-
- hilb = function ( n )
- {
- local (H)
- if (n == 1)
- {
- H = 1;
- else
- H = cauchy( (1:n) - .5);
- }
-
- return H;
- };
-