Code covered by the BSD License  

Highlights from
slatec

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

[n,v,val]=dfill(n,v,val);
function [n,v,val]=dfill(n,v,val);
persistent i is nr ; 

v_shape=size(v);v=reshape(v,1,[]);
if isempty(i), i=0; end;
if isempty(is), is=0; end;
if isempty(nr), nr=0; end;
if( n<=0 )
v_shape=zeros(v_shape);v_shape(:)=v(1:numel(v_shape));v=v_shape;
return;
end;
nr = fix(rem(n,4));
is = 1;
if( nr+1==4 )
is = 4;
v(1) = val;
v(2) = val;
v(3) = val;
end;
if( nr+1==3 )
is = 3;
v(1) = val;
v(2) = val;
end;
if( nr+1==2 )
is = 2;
v(1) = val;
end;
for i = is : 4: n ;
v(i) = val;
v(i+1) = val;
v(i+2) = val;
v(i+3) = val;
end; i = fix(n +1);
v_shape=zeros(v_shape);v_shape(:)=v(1:numel(v_shape));v=v_shape;
end %subroutine dfill

Contact us