3240
|
1 # Copyright (C) 1993, 1998, 1999 A. Scottedward Hodel |
3211
|
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, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
3240
|
19 function [Uret,Ucols] = krylovb(A,V,k,eps1,pflg); |
|
20 # function [U,Ucols] = krylovb(A,V,k{,eps1,pflg}); |
3211
|
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) |
3240
|
26 # pflg: permutation flag |
3211
|
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. |
3240
|
32 # |
|
33 # Note: krylovb directly calls and is superseded by krylov. |
3211
|
34 |
3240
|
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 |
3211
|
46 |
|
47 endfunction |