home *** CD-ROM | disk | FTP | other *** search
/ APDL Eductation Resources / APDL Eductation Resources.iso / programs / electronic / rlab / TestMatrix / frank_r < prev    next >
Encoding:
Text File  |  1994-12-20  |  2.4 KB  |  65 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Frank matrix - ill-conditioned eigenvalues.
  4.  
  5. // Syntax:    F = frank ( N , K ) 
  6.  
  7. // Description:
  8.  
  9. //    Create the Frank matrix of order N.  It is upper Hessenberg
  10. //    with determinant 1.  K = 0 is the default; if K = 1 the
  11. //    elements are reflected about the anti-diagonal
  12. //    (1,N)--(N,1). The eigenvalues of F may be obtained in terms of
  13. //    the zeros of the Hermite polynomials.  They are positive and
  14. //    occur in reciprocal pairs.  Thus if N is odd, 1 is an
  15. //    eigenvalue. F has FLOOR(N/2) ill-conditioned eigenvalues---the
  16. //    smaller ones. 
  17.  
  18. //    For large N, DET(FRANK(N)') comes out far from 1---see Frank
  19. //    (1958) and Wilkinson (1960) for discussions.
  20. //
  21. //      References:
  22. //      W.L. Frank, Computing eigenvalues of complex matrices by determinant
  23. //           evaluation and by methods of Danilewski and Wielandt, J. Soc.
  24. //           Indust. Appl. Math., 6 (1958), pp. 378-392 (see pp. 385, 388).
  25. //      G.H. Golub and J.H. Wilkinson, Ill-conditioned eigensystems and the
  26. //           computation of the Jordan canonical form, SIAM Review, 18 (1976),
  27. //             pp. 578-619 (Section 13).
  28. //      H. Rutishauser, On test matrices, Programmation en Mathematiques
  29. //           Numeriques, Editions Centre Nat. Recherche Sci., Paris, 165,
  30. //           1966, pp. 349-365.  Section 9.
  31. //      J.H. Wilkinson, Error analysis of floating-point computation,
  32. //           Numer. Math., 2 (1960), pp. 319-340 (Section 8).
  33. //      J.H. Wilkinson, The Algebraic Eigenvalue Problem, Oxford University
  34. //           Press, 1965 (pp. 92-93).
  35. //      The next two references give details of the eigensystem, as does
  36. //      Rutishauser (see above).
  37. //      P.J. Eberlein, A note on the matrices denoted by B_n, SIAM J. Appl.
  38. //           Math., 20 (1971), pp. 87-92.
  39. //      J.M. Varah, A generalization of the Frank matrix, SIAM J. Sci. Stat.
  40. //           Comput., 7 (1986), pp. 835-839.
  41.  
  42. //    This file is a translation of frank.m from version 2.0 of
  43. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  44. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  45.  
  46. //-------------------------------------------------------------------//
  47.  
  48. frank = function ( n , k )
  49. {
  50.   if (!exist (k)) { k = 0; }
  51.  
  52.   F = min( ones(n,1)*(1:n), (1:n)'*ones(1,n) );
  53.  
  54.   //   Take upper Hessenberg part.
  55.  
  56.   F = triu(F,-1);
  57.   if (k == 0)
  58.   {
  59.     p = n:1:-1;
  60.     F = F[p;p]';
  61.   }
  62.  
  63.   return F;
  64. };
  65.