Code covered by the BSD License  

Highlights from
slatec

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

[u,idmn,i,j,uxxx,uxxxx]=dx4(u,idmn,i,j,uxxx,uxxxx);
function [u,idmn,i,j,uxxx,uxxxx]=dx4(u,idmn,i,j,uxxx,uxxxx);

global spl4_5; if isempty(spl4_5), spl4_5=0; end;
global spl4_6; if isempty(spl4_6), spl4_6=0; end;
global spl4_7; if isempty(spl4_7), spl4_7=0; end;
global spl4_8; if isempty(spl4_8), spl4_8=0; end;
global spl4_15; if isempty(spl4_15), spl4_15=0; end;
global spl4_19; if isempty(spl4_19), spl4_19=0; end;
global spl4_16; if isempty(spl4_16), spl4_16=0; end;
global spl4_20; if isempty(spl4_20), spl4_20=0; end;
global spl4_17; if isempty(spl4_17), spl4_17=0; end;
global spl4_18; if isempty(spl4_18), spl4_18=0; end;
global spl4_11; if isempty(spl4_11), spl4_11=0; end;
global spl4_13; if isempty(spl4_13), spl4_13=0; end;
global spl4_3; if isempty(spl4_3), spl4_3=0; end;
global spl4_1; if isempty(spl4_1), spl4_1=0; end;
global spl4_2; if isempty(spl4_2), spl4_2=0; end;
global spl4_4; if isempty(spl4_4), spl4_4=0; end;
global spl4_9; if isempty(spl4_9), spl4_9=0; end;
global spl4_12; if isempty(spl4_12), spl4_12=0; end;
global spl4_10; if isempty(spl4_10), spl4_10=0; end;
global spl4_14; if isempty(spl4_14), spl4_14=0; end;
%***BEGIN PROLOGUE  DX4
%***SUBSIDIARY
%***PURPOSE  Subsidiary to SEPX4
%***LIBRARY   SLATEC
%***TYPE      SINGLE PRECISION (DX4-S)
%***AUTHOR  (UNKNOWN)
%***DESCRIPTION
%
%     This program computes second order finite difference
%     approximations to the third and fourth X
%     partial derivatives of U at the (I,J) mesh point.
%
%***SEE ALSO  SEPX4
%***ROUTINES CALLED  (NONE)
%***COMMON BLOCKS    SPL4
%***REVISION HISTORY  (YYMMDD)
%   801001  DATE WRITTEN
%   891214  Prologue converted to Version 4.0 format.  (BAB)
%   900402  Added TYPE section.  (WRB)
%***end PROLOGUE  DX4
%
% common :: ;
%% common /spl4  / kswx , kswy , k , l , ait , bit , cit , dit ,mit , nit , is , ms , js , ns , dlx , dly ,tdlx3 , tdly3 , dlx4 , dly4;
%% common /spl4  / spl4_1 , spl4_2 , spl4_3 , spl4_4 , spl4_5 , spl4_6 , spl4_7 , spl4_8 ,spl4_9 , spl4_10 , spl4_11 , spl4_12 , spl4_13 , spl4_14 , spl4_15 , spl4_16 ,spl4_17 , spl4_18 , spl4_19 , spl4_20;
u_shape=size(u);u=reshape([u(:).',zeros(1,ceil(numel(u)./prod([idmn])).*prod([idmn])-numel(u))],idmn,[]);
%***FIRST EXECUTABLE STATEMENT  DX4
if( i>2 && i<(spl4_3-1) )
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS ON THE INTERIOR
%
uxxx =(-u(i-2,j)+2.0.*u(i-1,j)-2.0.*u(i+1,j)+u(i+2,j))./spl4_17;
uxxxx =(u(i-2,j)-4.0.*u(i-1,j)+6.0.*u(i,j)-4.0.*u(i+1,j)+u(i+2,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
if( i~=1 )
if( i==2 )
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT X=A+DLX
%
if( spl4_1==1 )
%
%     PERIODIC AT X=A+DLX
%
uxxx =(-u(spl4_3-1,j)+2.0.*u(1,j)-2.0.*u(3,j)+u(4,j))./(spl4_17);
uxxxx =(u(spl4_3-1,j)-4.0.*u(1,j)+6.0.*u(2,j)-4.0.*u(3,j)+u(4,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uxxx =(-3.0.*u(1,j)+10.0.*u(2,j)-12.0.*u(3,j)+6.0.*u(4,j)-u(5,j))./spl4_17;
uxxxx =(2.0.*u(1,j)-9.0.*u(2,j)+16.0.*u(3,j)-14.0.*u(4,j)+6.0.*u(5,j)-u(6,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
elseif( i==spl4_3-1 ) ;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT X=B-DLX
%
if( spl4_1==1 )
%
%     PERIODIC AT X=B-DLX
%
uxxx =(-u(spl4_3-3,j)+2.0.*u(spl4_3-2,j)-2.0.*u(1,j)+u(2,j))./spl4_17;
uxxxx =(u(spl4_3-3,j)-4.0.*u(spl4_3-2,j)+6.0.*u(spl4_3-1,j)-4.0.*u(1,j)+u(2,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uxxx =(u(spl4_3-4,j)-6.0.*u(spl4_3-3,j)+12.0.*u(spl4_3-2,j)-10.0.*u(spl4_3-1,j)+3.0.*u(spl4_3,j))./spl4_17;
uxxxx =(-u(spl4_3-5,j)+6.0.*u(spl4_3-4,j)-14.0.*u(spl4_3-3,j)+16.0.*u(spl4_3-2,j)-9.0.*u(spl4_3-1,j)+2.0.*u(spl4_3,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
elseif( i==spl4_3 ) ;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT X=B
%
uxxx = -(3.0.*u(spl4_3-4,j)-14.0.*u(spl4_3-3,j)+24.0.*u(spl4_3-2,j)-18.0.*u(spl4_3-1,j)+5.0.*u(spl4_3,j))./spl4_17;
uxxxx =(-2.0.*u(spl4_3-5,j)+11.0.*u(spl4_3-4,j)-24.0.*u(spl4_3-3,j)+26.0.*u(spl4_3-2,j)-14.0.*u(spl4_3-1,j)+3.0.*u(spl4_3,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
end;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT X=A
%
if( spl4_1==1 )
%
%     PERIODIC AT X=A
%
uxxx =(-u(spl4_3-2,j)+2.0.*u(spl4_3-1,j)-2.0.*u(2,j)+u(3,j))./(spl4_17);
uxxxx =(u(spl4_3-2,j)-4.0.*u(spl4_3-1,j)+6.0.*u(1,j)-4.0.*u(2,j)+u(3,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uxxx =(-5.0.*u(1,j)+18.0.*u(2,j)-24.0.*u(3,j)+14.0.*u(4,j)-3.0.*u(5,j))./(spl4_17);
uxxxx =(3.0.*u(1,j)-14.0.*u(2,j)+26.0.*u(3,j)-24.0.*u(4,j)+11.0.*u(5,j)-2.0.*u(6,j))./spl4_19;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
end;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
end
%DECK DXADD

Contact us at files@mathworks.com