Code covered by the BSD License  

Highlights from
slatec

from slatec by Ben Barrowes
The slatec library converted into matlab functions.

[dsdotresult,n,sx,incx,sy,incy]=dsdot(n,sx,incx,sy,incy);
function [dsdotresult,n,sx,incx,sy,incy]=dsdot(n,sx,incx,sy,incy);
dsdotresult=[];
persistent i kx ky ns ; 

;
if isempty(i), i=0; end;
if isempty(kx), kx=0; end;
if isempty(ky), ky=0; end;
if isempty(ns), ns=0; end;
%***BEGIN PROLOGUE  DSDOT
%***PURPOSE  Compute the inner product of two vectors with extended
%            precision accumulation and result.
%***LIBRARY   SLATEC (BLAS)
%***CATEGORY  D1A4
%***TYPE      doubleprecision (DSDOT-D, DCDOT-C)
%***KEYWORDS  BLAS, COMPLEX VECTORS, 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)
%       SX  single precision vector with N elements
%     INCX  storage spacing between elements of SX
%       SY  single precision vector with N elements
%     INCY  storage spacing between elements of SY
%
%     --Output--
%    DSDOT  doubleprecision dot product (zero if N.LE.0)
%
%     Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
%     DSDOT = sum for I = 0 to N-1 of  SX(LX+I*INCX) * SY(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
%   890831  Modified array declarations.  (WRB)
%   890831  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  DSDOT
sx_shape=size(sx);sx=reshape(sx,1,[]);
sy_shape=size(sy);sy=reshape(sy,1,[]);
%***FIRST EXECUTABLE STATEMENT  DSDOT
dsdotresult = 0.0d0;
if( n<=0 )
sx_shape=zeros(sx_shape);sx_shape(:)=sx(1:numel(sx_shape));sx=sx_shape;
sy_shape=zeros(sy_shape);sy_shape(:)=sy(1:numel(sy_shape));sy=sy_shape;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(4)), assignin('caller','FUntemp',sy); evalin('caller',[inputname(4),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',sx); evalin('caller',[inputname(2),'=FUntemp;']); end
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',n); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(5)), assignin('caller','FUntemp',incy); evalin('caller',[inputname(5),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',incx); evalin('caller',[inputname(3),'=FUntemp;']); end
return;
end;
if( incx==incy && incx>0 )
%
%     Code for equal, positive, non-unit increments.
%
ns = fix(n.*incx);
for i = 1 : incx: ns ;
dsdotresult = dsdotresult + (sx(i)).*(sy(i));
end; i = fix(ns +1);
else;
%
%     Code for unequal or nonpositive increments.
%
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;
dsdotresult = dsdotresult + (sx(kx)).*(sy(ky));
kx = fix(kx + incx);
ky = fix(ky + incy);
end; i = fix(n+1);
sx_shape=zeros(sx_shape);sx_shape(:)=sx(1:numel(sx_shape));sx=sx_shape;
sy_shape=zeros(sy_shape);sy_shape(:)=sy(1:numel(sy_shape));sy=sy_shape;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(4)), assignin('caller','FUntemp',sy); evalin('caller',[inputname(4),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',sx); evalin('caller',[inputname(2),'=FUntemp;']); end
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',n); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(5)), assignin('caller','FUntemp',incy); evalin('caller',[inputname(5),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',incx); evalin('caller',[inputname(3),'=FUntemp;']); end
return;
end;
sx_shape=zeros(sx_shape);sx_shape(:)=sx(1:numel(sx_shape));sx=sx_shape;
sy_shape=zeros(sy_shape);sy_shape(:)=sy(1:numel(sy_shape));sy=sy_shape;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(4)), assignin('caller','FUntemp',sy); evalin('caller',[inputname(4),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',sx); evalin('caller',[inputname(2),'=FUntemp;']); end
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',n); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(5)), assignin('caller','FUntemp',incy); evalin('caller',[inputname(5),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',incx); evalin('caller',[inputname(3),'=FUntemp;']); end
end
%DECK DSDSCL

Contact us at files@mathworks.com