home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fb.zip / octave / SCRIPTS.ZIP / scripts / linear-algebra / krylovb.m < prev    next >
Text File  |  1999-10-13  |  2KB  |  48 lines

  1. # Copyright (C) 1993, 1998, 1999 A. Scottedward Hodel
  2. #
  3. # This file is part of Octave.
  4. #
  5. # Octave is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by the
  7. # Free Software Foundation; either version 2, or (at your option) any
  8. # later version.
  9. #
  10. # Octave is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13. # for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with Octave; see the file COPYING.  If not, write to the Free
  17. # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
  18.  
  19. function [Uret,Ucols] = krylovb(A,V,k,eps1,pflg);
  20.   # function [U,Ucols] = krylovb(A,V,k{,eps1,pflg});
  21.   # construct orthogonal basis U of block Krylov subspace;
  22.   #     [V AV A^2*V ... A^(k+1)*V];
  23.   # method used: householder reflections to guard against loss of
  24.   # orthogonality
  25.   # eps1: threshhold for 0 (default: 1e-12)
  26.   # pflg: permutation flag
  27.   # outputs:
  28.   #   returned basis U is orthogonal matrix; due to "zeroed"
  29.   #   columns of product, may not satisfy A U = U H identity
  30.   # Ucols: dimension of span of krylov subspace (based on eps1)
  31.   # if k > m-1, krylov returns the Hessenberg decompostion of A.
  32.   #
  33.   # Note: krylovb directly calls and is superseded by krylov.
  34.  
  35.   switch(nargin)
  36.   case(3),
  37.     [Uret,H,Ucols] = krylov(A,V,k);
  38.   case(4),
  39.     [Uret,H,Ucols] = krylov(A,V,k,eps1);
  40.   case(5),
  41.     [Uret,H,Ucols] = krylov(A,V,k,eps1,pflg);
  42.   otherwise,
  43.     usage("[Uret,Ucols] = krylovb(A,V,k{,eps1,pflg}); %d arguments passed", ...
  44.       nargin);
  45.   endswitch
  46.  
  47. endfunction
  48.