3431
|
1 ## Copyright (C) 1996 Auburn University. All rights reserved. |
|
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 ## -*- texinfo -*- |
3500
|
20 ## @deftypefn {Function File} {} zgshsr (@var{y}) |
3431
|
21 ## apply householder vector based on @math{e^(m)} to |
|
22 ## (column vector) y. |
|
23 ## Called by zgfslv |
|
24 ## @end deftypefn |
|
25 |
|
26 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
27 ## Created: July 24, 1992 |
|
28 ## Conversion to Octave by R. Bruce Tenison July 3, 1994 |
|
29 |
|
30 function x = zgshsr (y) |
|
31 |
4462
|
32 if (! isvector (y)) |
|
33 error (sprintf ("y(%dx%d) must be a vector", rows (y), columns (y))); |
3431
|
34 endif |
4462
|
35 x = vec (y); |
|
36 m = length (x); |
|
37 if (m > 1) |
|
38 beta = (1 + sqrt (m)) * x(1) + sum (x(2:m)); |
|
39 beta /= (m + sqrt (m)); |
|
40 x(1) -= (beta * (1 + sqrt (m))); |
|
41 x(2:m) -= (beta * ones (m-1,1)); |
3431
|
42 else |
|
43 x = -x; |
|
44 endif |
4462
|
45 |
3431
|
46 endfunction |