| [cdcdotresult,n,cb,cx,incx,cy,incy]=cdcdot(n,cb,cx,incx,cy,incy); |
function [cdcdotresult,n,cb,cx,incx,cy,incy]=cdcdot(n,cb,cx,incx,cy,incy);
cdcdotresult=[];
persistent dsdoti dsdotr dt1 dt2 dt3 dt4 i kx ky ;
;
%***BEGIN PROLOGUE CDCDOT
%***PURPOSE Compute the inner product of two vectors with extended
% precision accumulation.
%***LIBRARY SLATEC (BLAS)
%***CATEGORY D1A4
%***TYPE COMPLEX (SDSDOT-S, CDCDOT-C)
%***KEYWORDS BLAS, DOT PRODUCT, INNER PRODUCT, LINEAR ALGEBRA, VECTOR
%***AUTHOR Lawson, C. L., (JPL)
% Hanson, R. J., (SNLA)
% Kincaid, D. R., (U. of Texas)
% Krogh, F. T., (JPL)
%***DESCRIPTION
%
% B L A S Subprogram
% Description of Parameters
%
% --Input--
% N number of elements in input vector(s)
% CB complex scalar to be added to inner product
% CX complex vector with N elements
% INCX storage spacing between elements of CX
% CY complex vector with N elements
% INCY storage spacing between elements of CY
%
% --Output--
% CDCDOT complex dot product (CB if N .LE. 0)
%
% Returns complex result with dot product accumulated in D.P.
% CDCDOT = CB + sum for I = 0 to N-1 of CX(LX+I*INCY)*CY(LY+I*INCY)
% where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
% defined in a similar way using INCY.
%
%***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
% Krogh, Basic linear algebra subprograms for Fortran
% usage, Algorithm No. 539, Transactions on Mathematical
% Software 5, 3 (September 1979), pp. 308-323.
%***ROUTINES CALLED (NONE)
%***REVISION HISTORY (YYMMDD)
% 791001 DATE WRITTEN
% 890531 Changed all specific intrinsics to generic. (WRB)
% 890531 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 920310 Corrected definition of LX in DESCRIPTION. (WRB)
% 920501 Reformatted the REFERENCES section. (WRB)
%***end PROLOGUE CDCDOT
if isempty(i), i=0; end;
if isempty(kx), kx=0; end;
if isempty(ky), ky=0; end;
cx_shape=size(cx);cx=reshape(cx,1,[]);
cy_shape=size(cy);cy=reshape(cy,1,[]);
if isempty(dsdotr), dsdotr=0; end;
if isempty(dsdoti), dsdoti=0; end;
if isempty(dt1), dt1=0; end;
if isempty(dt2), dt2=0; end;
if isempty(dt3), dt3=0; end;
if isempty(dt4), dt4=0; end;
%***FIRST EXECUTABLE STATEMENT CDCDOT
dsdotr = (real(cb));
dsdoti = (imag(cb));
if( n>0 )
kx = 1;
ky = 1;
if( incx<0 )
kx = fix(1 +(1-n).*incx);
end;
if( incy<0 )
ky = fix(1 +(1-n).*incy);
end;
for i = 1 : n;
dt1 = (real(cx(kx)));
dt2 = (real(cy(ky)));
dt3 = (imag(cx(kx)));
dt4 = (imag(cy(ky)));
dsdotr = dsdotr +(dt1.*dt2) -(dt3.*dt4);
dsdoti = dsdoti +(dt1.*dt4) +(dt3.*dt2);
kx = fix(kx + incx);
ky = fix(ky + incy);
end; i = fix(n+1);
end;
cdcdotresult = complex(real(dsdotr),real(dsdoti));
cx_shape=zeros(cx_shape);cx_shape(:)=cx(1:numel(cx_shape));cx=cx_shape;
cy_shape=zeros(cy_shape);cy_shape(:)=cy(1:numel(cy_shape));cy=cy_shape;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',n); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(6)), assignin('caller','FUntemp',incy); evalin('caller',[inputname(6),'=FUntemp;']); end
if csnil&&~isempty(inputname(4)), assignin('caller','FUntemp',incx); evalin('caller',[inputname(4),'=FUntemp;']); end
if csnil&&~isempty(inputname(5)), assignin('caller','FUntemp',cy); evalin('caller',[inputname(5),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',cx); evalin('caller',[inputname(3),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',cb); evalin('caller',[inputname(2),'=FUntemp;']); end
end
%DECK CDCOR
|
|