The Hilbert matrix is extremely ill-conditioned, hence cannot be factorized by standard algorithms. However, an analytic solution for its Cholesky factorization exists, which has not been included in the current MATLAB function library.
Thanks for the explanation. Its apparent there is either a matlab release or OS related difference in this. But n=98 or 171 is still a serious improvement over the point where the direct chol(hilb(n)) gives up. chol only got as far as n=12 for me.
08 Mar 2006
Yi Cao
On my machine (XP, MATLAB 7.1), it works upto n=171 without any NaNs although beyond n=85, there are zeros in the diagnal. The need for the Cholesky factor of a Hilbert matrix comes from a least square optimization problem, where the original objective function is J=integral of 0.5z(x)'z(x)dx and z(x) is a nth order polynomial of x and its coefficients are nonlinear functions of decision variables to be optimized. This problem can be represented as a nonlinear least square problem, i.e. J=0.5X'HX, where X is a coefficient matrix of z(x) and H is the Hilbter matrix. Therefore, to solve the nonlinear least square problem, we need the Cholesky factor of the Hilbert matrix.
08 Mar 2006
John D'Errico
It indeed does produce a Cholesky factor, although the transpose of what chol would return. (Why does anyone need a hilbert matrix Cholesky factor?) I did verify that it is a valid Cholesky factor UP to n = 98, far beyond what chol can do. For n = 99 and above it began to generate some NaNs in the matrix. So beware the test cases in the help that show the use of cholhilb for n = 100 or even 1000.