⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zgfslv.m

📁 similer program for matlab
💻 M
字号:
## Copyright (C) 1996, 1998, 2000, 2005, 2007##               Auburn University.  All rights reserved.#### This file is part of Octave.#### Octave is free software; you can redistribute it and/or modify it## under the terms of the GNU General Public License as published by## the Free Software Foundation; either version 3 of the License, or (at## your option) any later version.#### Octave is distributed in the hope that it will be useful, but## WITHOUT ANY WARRANTY; without even the implied warranty of## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU## General Public License for more details.#### You should have received a copy of the GNU General Public License## along with Octave; see the file COPYING.  If not, see## <http://www.gnu.org/licenses/>.## -*- texinfo -*-## @deftypefn {Function File} {} zgfslv (@var{n}, @var{m}, @var{p}, @var{b})## Solve system of equations for dense zgep problem.## @end deftypefn## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>## Converted to Octave by R Bruce Tenison, July 3, 1994function x = zgfslv (n, m, p, b)  if (nargin != 4)    print_usage ();  endif  nmp = n+m+p;  gam1 = (2*n)+m+p;  gam2 = n+p;  gam3 = n+m;  G1 = givens (sqrt (m), -sqrt (p))';  G2 = givens (m+p, sqrt (n*(m+p)))';  x = b;  ## 1) U1 e^n = sqrt(n)e_1^n  ## 2) U2 e^m = sqrt(m)e_1^m  ## 3) U3 e^p = sqrt(p)e_1^p  xdx1 = 1:n;  xdx2 = n+(1:m);  xdx3 = n+m+(1:p);  x(xdx1,1) = zgshsr (x(xdx1,1));  x(xdx2,1) = zgshsr (x(xdx2,1));  x(xdx3,1) = zgshsr (x(xdx3,1));  ## 4) Givens rotations to reduce stray non-zero elements  idx1 = [n+1, n+m+1];  idx2 = [1, n+1];  x(idx1) = G1'*x(idx1);  x(idx2) = G2'*x(idx2);  ## 6) Scale x, then back-transform to get x  en = ones (n, 1);  em = ones (m, 1);  ep = ones (p, 1);  lam = [gam1*en; gam2*em; gam3*ep];  lam(1) = n+m+p;  lam(n+1) = 1;       # dummy value to avoid divide by zero  lam(n+m+1) = n+m+p;  x = x ./ lam;  x(n+1) = 0;  # minimum norm solution  ## back transform now.  x(idx2) = G2*x(idx2);  x(idx1) = G1*x(idx1);  x(xdx3,1) = zgshsr (x(xdx3,1));  x(xdx2,1) = zgshsr (x(xdx2,1));  x(xdx1,1) = zgshsr (x(xdx1,1));endfunction

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -