home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Inverse of an upper Hessenberg matrix.
-
- // Syntax: invhess ( X , Y )
-
- // Description:
-
- // invhess(x, y), where X is an N-vector and Y an N-1 vector, is
- // the matrix whose lower triangle agrees with that of
- // ones(N,1)*X' and whose strict upper triangle agrees with that
- // of [1, Y]*ONES(1,N).
-
- // The matrix is nonsingular if X[1] != 0 and X[i+1] != Y[i] for
- // all i, and its inverse is an upper Hessenberg matrix. If Y is
- // omitted it defaults to -X[1:N-1].
-
- // Special case: if X is a scalar invhess(X) is the same as
- // invhess(1:X).
-
- // References:
- // F.N. Valvi and V.S. Geroyannis, Analytic inverses and
- // determinants for a class of matrices, IMA Journal of Numerical
- // Analysis, 7 (1987), pp. 123-128.
- // W.-L. Cao and W.J. Stewart, A note on inverses of Hessenberg-like
- // matrices, Linear Algebra and Appl., 76 (1986), pp. 233-240.
- // Y. Ikebe, On inverses of Hessenberg matrices, Linear Algebra and
- // Appl., 24 (1979), pp. 93-97.
- // P. Rozsa, On the inverse of band matrices, Integral Equations and
- // Operator Theory, 10 (1987), pp. 82-95.
-
- // This file is a translation of invhess.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.
-
- //-------------------------------------------------------------------//
-
- invhess = function ( x , y )
- {
- local (x, y)
-
- n = max(size(x));
- // Handle scalar x.
- if (n == 1)
- {
- n = x;
- x = 1:n;
- }
-
- x = x[:];
-
- if (!exist (y)) { y = -x; }
- y = y[:];
-
- A = ones(n,1)*x';
- for (j in 2:n)
- {
- A[1:j-1;j] = y[1:j-1];
- }
-
- return A;
- };
-