Code covered by the BSD License  

Highlights from
slatec

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

[wnlt2result,me,mend,ir,factor,tau,scalemlv,wic]=wnlt2(me,mend,ir,factor,tau,scalemlv,wic);
function [wnlt2result,me,mend,ir,factor,tau,scalemlv,wic]=wnlt2(me,mend,ir,factor,tau,scalemlv,wic);
wnlt2result=[];
persistent j rn sn t ; 

;
%***BEGIN PROLOGUE  WNLT2
%***SUBSIDIARY
%***PURPOSE  Subsidiary to WNLIT
%***LIBRARY   SLATEC
%***TYPE      SINGLE PRECISION (WNLT2-S, DWNLT2-D)
%***AUTHOR  Hanson, R. J., (SNLA)
%           Haskell, K. H., (SNLA)
%***DESCRIPTION
%
%     To test independence of incoming column.
%
%     Test the column IC to determine if it is linearly independent
%     of the columns already in the basis.  In the initial tri. step,
%     we usually want the heavy weight ALAMDA to be included in the
%     test for independence.  In this case, the value of FACTOR will
%     have been set to 1.0E0 before this procedure is invoked.
%     In the potentially rank deficient problem, the value of FACTOR
%     will have been set to ALSQ=ALAMDA**2 to remove the effect of the
%     heavy weight from the test for independence.
%
%     Write new column as partitioned vector
%           (A1)  number of components in solution so far = NIV
%           (A2)  M-NIV components
%     And compute  SN = inverse weighted length of A1
%                  RN = inverse weighted length of A2
%     Call the column independent when RN .GT. TAU*SN
%
%***SEE ALSO  WNILT
%***ROUTINES CALLED  (NONE)
%***REVISION HISTORY  (YYMMDD)
%   790701  DATE WRITTEN
%   890620  Code extracted from WNLIT and made a subroutine.  (RWC))
%***end PROLOGUE  WNLT2
scale_shape=size(scalemlv);scalemlv=reshape(scalemlv,1,[]);
wic_shape=size(wic);wic=reshape(wic,1,[]);
%
if isempty(rn), rn=0; end;
if isempty(sn), sn=0; end;
if isempty(t), t=0; end;
if isempty(j), j=0; end;
%
%***FIRST EXECUTABLE STATEMENT  WNLT2
sn = 0.0e0;
rn = 0.0e0;
for j = 1 : mend;
t = scalemlv(j);
if( j<=me )
t = t./factor;
end;
t = t.*wic(j).^2;
%
if( j<ir )
sn = sn + t;
else;
rn = rn + t;
end;
end; j = fix(mend+1);
wnlt2result = rn>sn.*tau.^2;
scale_shape=zeros(scale_shape);scale_shape(:)=scalemlv(1:numel(scale_shape));scalemlv=scale_shape;
wic_shape=zeros(wic_shape);wic_shape(:)=wic(1:numel(wic_shape));wic=wic_shape;
csnil=dbstack(1); csnil=csnil(1).name(1)~='@';
if csnil&&~isempty(inputname(7)), assignin('caller','FUntemp',wic); evalin('caller',[inputname(7),'=FUntemp;']); end
if csnil&&~isempty(inputname(5)), assignin('caller','FUntemp',tau); evalin('caller',[inputname(5),'=FUntemp;']); end
if csnil&&~isempty(inputname(6)), assignin('caller','FUntemp',scalemlv); evalin('caller',[inputname(6),'=FUntemp;']); end
if csnil&&~isempty(inputname(2)), assignin('caller','FUntemp',mend); evalin('caller',[inputname(2),'=FUntemp;']); end
if csnil&&~isempty(inputname(1)), assignin('caller','FUntemp',me); evalin('caller',[inputname(1),'=FUntemp;']); end
if csnil&&~isempty(inputname(3)), assignin('caller','FUntemp',ir); evalin('caller',[inputname(3),'=FUntemp;']); end
if csnil&&~isempty(inputname(4)), assignin('caller','FUntemp',factor); evalin('caller',[inputname(4),'=FUntemp;']); end
end
%DECK WNLT3

Contact us