Dynamic-Calibration/utils/SDPT3-4.0/Solver/Arrow.m

42 lines
1.0 KiB
Mathematica
Raw Normal View History

2019-12-18 11:25:45 +00:00
%%********************************************************
%% Arrow:
%%
%% Fx = Arrow(pblk,f,x,options);
%%
%% if options == 0;
%% Fx = Arr(F)*x
%% if options == 1;
%% Fx = Arr(F)^{-1}*x
%%*****************************************************************
%% SDPT3: version 4.0
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%*****************************************************************
function Fx = Arrow(pblk,f,x,options);
if nargin == 3; options = 0; end;
s = 1 + [0, cumsum(pblk{2})];
idx1 = s(1:length(pblk{2}));
if options == 0
inprod = mexqops(pblk{2},f,x,1);
Fx = mexqops(pblk{2},f(idx1),x,3) + mexqops(pblk{2},x(idx1),f,3);
Fx(idx1) = inprod;
else
gamf2 = mexqops(pblk{2},f,f,2);
gamprod = mexqops(pblk{2},f,x,2);
alpha = gamprod./gamf2;
Fx = mexqops(pblk{2},1./f(idx1),x,3) - mexqops(pblk{2},alpha./f(idx1),f,3);
Fx(idx1) = alpha;
end
%%
%%********************************************************