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,uyyy,uyyyy]=dy4(u,idmn,i,j,uyyy,uyyyy);
function [u,idmn,i,j,uyyy,uyyyy]=dy4(u,idmn,i,j,uyyy,uyyyy);

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  DY4
%***SUBSIDIARY
%***PURPOSE  Subsidiary to SEPX4
%***LIBRARY   SLATEC
%***TYPE      SINGLE PRECISION (DY4-S)
%***AUTHOR  (UNKNOWN)
%***DESCRIPTION
%
%     This program computes second order finite difference
%     approximations to the third and fourth Y
%     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  DY4
%
% 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  DY4
if( j>2 && j<(spl4_4-1) )
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS ON THE INTERIOR
%
uyyy =(-u(i,j-2)+2.0.*u(i,j-1)-2.0.*u(i,j+1)+u(i,j+2))./spl4_18;
uyyyy =(u(i,j-2)-4.0.*u(i,j-1)+6.0.*u(i,j)-4.0.*u(i,j+1)+u(i,j+2))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
if( j~=1 )
if( j==2 )
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT Y=C+DLY
%
if( spl4_2==1 )
%
%     PERIODIC AT Y=C+DLY
%
uyyy =(-u(i,spl4_4-1)+2.0.*u(i,1)-2.0.*u(i,3)+u(i,4))./spl4_18;
uyyyy =(u(i,spl4_4-1)-4.0.*u(i,1)+6.0.*u(i,2)-4.0.*u(i,3)+u(i,4))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uyyy =(-3.0.*u(i,1)+10.0.*u(i,2)-12.0.*u(i,3)+6.0.*u(i,4)-u(i,5))./spl4_18;
uyyyy =(2.0.*u(i,1)-9.0.*u(i,2)+16.0.*u(i,3)-14.0.*u(i,4)+6.0.*u(i,5)-u(i,6))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
elseif( j==spl4_4-1 ) ;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT Y=D-DLY
%
if( spl4_2==1 )
%
%     PERIODIC AT Y=D-DLY
%
uyyy =(-u(i,spl4_4-3)+2.0.*u(i,spl4_4-2)-2.0.*u(i,1)+u(i,2))./spl4_18;
uyyyy =(u(i,spl4_4-3)-4.0.*u(i,spl4_4-2)+6.0.*u(i,spl4_4-1)-4.0.*u(i,1)+u(i,2))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uyyy =(u(i,spl4_4-4)-6.0.*u(i,spl4_4-3)+12.0.*u(i,spl4_4-2)-10.0.*u(i,spl4_4-1)+3.0.*u(i,spl4_4))./spl4_18;
uyyyy =(-u(i,spl4_4-5)+6.0.*u(i,spl4_4-4)-14.0.*u(i,spl4_4-3)+16.0.*u(i,spl4_4-2)-9.0.*u(i,spl4_4-1)+2.0.*u(i,spl4_4))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
elseif( j==spl4_4 ) ;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT Y=D
%
uyyy = -(3.0.*u(i,spl4_4-4)-14.0.*u(i,spl4_4-3)+24.0.*u(i,spl4_4-2)-18.0.*u(i,spl4_4-1)+5.0.*u(i,spl4_4))./spl4_18;
uyyyy =(-2.0.*u(i,spl4_4-5)+11.0.*u(i,spl4_4-4)-24.0.*u(i,spl4_4-3)+26.0.*u(i,spl4_4-2)-14.0.*u(i,spl4_4-1)+3.0.*u(i,spl4_4))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
end;
end;
%
%     COMPUTE PARTIAL DERIVATIVE APPROXIMATIONS AT Y=C
%
if( spl4_2==1 )
%
%     PERIODIC AT X=A
%
uyyy =(-u(i,spl4_4-2)+2.0.*u(i,spl4_4-1)-2.0.*u(i,2)+u(i,3))./spl4_18;
uyyyy =(u(i,spl4_4-2)-4.0.*u(i,spl4_4-1)+6.0.*u(i,1)-4.0.*u(i,2)+u(i,3))./spl4_20;
u_shape=zeros(u_shape);u_shape(:)=u(1:numel(u_shape));u=u_shape;
return;
else;
uyyy =(-5.0.*u(i,1)+18.0.*u(i,2)-24.0.*u(i,3)+14.0.*u(i,4)-3.0.*u(i,5))./spl4_18;
uyyyy =(3.0.*u(i,1)-14.0.*u(i,2)+26.0.*u(i,3)-24.0.*u(i,4)+11.0.*u(i,5)-2.0.*u(i,6))./spl4_20;
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 DYAIRY

Contact us