givapp.m
来自「解大规模线性方程组的预条件Gmres方法.系数矩阵可以非对称正定.」· M 代码 · 共 26 行
M
26 行
function vrot=givapp(c,s,vin,k)
%givapp apply a sequence of Givens rotations
% input
% c, s vectors of length k-1 defining rotations
% vin vector of length k to which rotations are applied
% k k-1 = number of rotations
% output
% tranformed vector after rotations are applied
% called by gmres_r
% IFISS function: HCE; 15 March 2005.
%
% C. T. Kelley, July 10, 1994
%Copyright 1994 C. T. Kelley.
%Reproduced and distributed with permission of the copyright holder.
%
% This code comes with no guarantee or warranty of any kind.
%
% function vrot=givapp(c, s, vin, k)
%
vrot=vin;
for i=1:k
w1=c(i)*vrot(i)-s(i)*vrot(i+1); % Change on next line, 6/3/97
w2=s(i)*vrot(i)+conj(c(i))*vrot(i+1); % w2=s(i)*vrot(i)+c(i)*vrot(i+1);
vrot(i:i+1)=[w1,w2];
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?