BS2DR
This function evaluates the derivative of a two-dimensional tensor-product spline, given its tensor-product B-spline representation.
Function Return Value
BS2DR — Value of the (IXDER, IYDER) derivative of the spline at (X, Y). (Output)
Required Arguments
IXDER — Order of the derivative in the X-direction. (Input)
IYDER — Order of the derivative in the Y-direction. (Input)
XX-coordinate of the point at which the spline is to be evaluated. (Input)
YY-coordinate of the point at which the spline is to be evaluated. (Input)
KXORD — Order of the spline in the X-direction. (Input)
KYORD — Order of the spline in the Y-direction. (Input)
XKNOT — Array of length NXCOEF + KXORD containing the knot sequence in the X-direction. (Input)
XKNOT must be nondecreasing.
YKNOT — Array of length NYCOEF + KYORD containing the knot sequence in the Y-direction. (Input)
YKNOT must be nondecreasing.
NXCOEF — Number of B-spline coefficients in the X-direction. (Input)
NYCOEF — Number of B-spline coefficients in the Y-direction. (Input)
BSCOEF — Array of length NXCOEF * NYCOEF containing the tensor-product B-spline coefficients. (Input)
BSCOEF is treated internally as a matrix of size NXCOEF by NYCOEF.
FORTRAN 90 Interface
Generic: BS2DR (IXDER, IYDER, X, Y, KXORD, KYORD, XKNOT, YKNOT, NXCOEF, NYCOEF, BSCOEF)
Specific: The specific interface names are S_BS2DR and D_BS2DR.
FORTRAN 77 Interface
Single: BS2DR (IXDER, IYDER, X, Y, KXORD, KYORD, XKNOT, YKNOT, NXCOEF, NYCOEF, BSCOEF)
Double: The double precision function name is DBS2DR.
Description
The routine BS2DR evaluates a partial derivative of a bivariate tensor-product spline (represented as a linear combination of tensor product B-splines) at a given point; see de Boor (1978, pages 351 353).
This routine returns the value of s(p,q)at a point (xy) given the coefficients c by computing
where kx and ky are the orders of the splines. (These numbers are passed to the subroutine in KXORD and KYORD, respectively.) Likewise, tx and ty are the corresponding knot sequences (XKNOT and YKNOT.)
Comments
1. Workspace may be explicitly provided, if desired, by use of B22DR/DB22DR. The reference is:
CALL B22DR(IXDER, IYDER, X, Y, KXORD, KYORD, XKNOT, YKNOT, NXCOEF, NYCOEF, BSCOEF, WK)
The additional argument is:
WK — Work array of length 3 * MAX(KXORD, KYORD) + KYORD.
2. Informational errors
Type
Code
Description
3
1
The point X does not satisfy XKNOT(KXORD) .LEX .LEXKNOT(NXCOEF + 1).
3
2
The point Y does not satisfy YKNOT(KYORD) .LEY .LEYKNOT(NYCOEF + 1).
Example
In this example, a spline interpolant s to a function f is constructed. We use the IMSL routine BS2IN to compute the interpolant and then BS2DR is employed to compute s(2,1)(xy). The values of this partial derivative and the error are computed on a 4 × 4 grid and then displayed.
 
USE BS2DR_INT
USE BSNAK_INT
USE UMACH_INT
USE BS2IN_INT
 
IMPLICIT NONE
! SPECIFICATIONS FOR PARAMETERS
INTEGER KXORD, KYORD, LDF, NXDATA, NXKNOT, NYDATA, NYKNOT
PARAMETER (KXORD=5, KYORD=3, NXDATA=21, NYDATA=6, LDF=NXDATA,&
NXKNOT=NXDATA+KXORD, NYKNOT=NYDATA+KYORD)
!
INTEGER I, J, NOUT, NXCOEF, NYCOEF
REAL BSCOEF(NXDATA,NYDATA), F, F21,&
FDATA(LDF,NYDATA), FLOAT, S21, X, XDATA(NXDATA),&
XKNOT(NXKNOT), Y, YDATA(NYDATA), YKNOT(NYKNOT)
INTRINSIC FLOAT
 
! Define function and (2,1) derivative
F(X,Y) = X*X*X*X + X*X*X*Y*Y
F21(X,Y) = 12.0*X*Y
! Set up interpolation points
DO 10 I=1, NXDATA
XDATA(I) = FLOAT(I-11)/10.0
10 CONTINUE
! Generate knot sequence
CALL BSNAK (NXDATA, XDATA, KXORD, XKNOT)
! Set up interpolation points
DO 20 I=1, NYDATA
YDATA(I) = FLOAT(I-1)/5.0
20 CONTINUE
! Generate knot sequence
CALL BSNAK (NYDATA, YDATA, KYORD, YKNOT)
! Generate FDATA
DO 40 I=1, NYDATA
DO 30 J=1, NXDATA
FDATA(J,I) = F(XDATA(J),YDATA(I))
30 CONTINUE
40 CONTINUE
! Interpolate
CALL BS2IN (XDATA, YDATA, FDATA, KXORD, KYORD, XKNOT, &
YKNOT, BSCOEF)
NXCOEF = NXDATA
NYCOEF = NYDATA
! Get output unit number
CALL UMACH (2, NOUT)
! Write heading
WRITE (NOUT,99999)
! Print (2,1) derivative over a
! grid of [0.0,1.0] x [0.0,1.0]
! at 16 points.
DO 60 I=1, 4
DO 50 J=1, 4
X = FLOAT(I-1)/3.0
Y = FLOAT(J-1)/3.0
! Evaluate spline
S21 = BS2DR(2,1,X,Y,KXORD,KYORD,XKNOT,YKNOT,NXCOEF,NYCOEF,&
BSCOEF)
WRITE (NOUT,'(3F15.4, F15.6)') X, Y, S21, F21(X,Y) - S21
50 CONTINUE
60 CONTINUE
99999 FORMAT (39X, '(2,1)', /, 13X, 'X', 14X, 'Y', 10X, 'S (X,Y)',&
5X, 'Error')
END
Output
(2,1)
X Y S (X,Y) Error
0.0000 0.0000 0.0000 0.000000
0.0000 0.3333 0.0000 0.000000
0.0000 0.6667 0.0000 0.000000
0.0000 1.0000 0.0000 0.000001
0.3333 0.0000 0.0000 0.000000
0.3333 0.3333 1.3333 0.000002
0.3333 0.6667 2.6667 -0.000002
0.3333 1.0000 4.0000 0.000008
0.6667 0.0000 0.0000 0.000006
0.6667 0.3333 2.6667 -0.000011
0.6667 0.6667 5.3333 0.000028
0.6667 1.0000 8.0001 -0.000134
1.0000 0.0000 -0.0004 0.000439
1.0000 0.3333 4.0003 -0.000319
1.0000 0.6667 7.9996 0.000363
1.0000 1.0000 12.0005 -0.000458
Published date: 03/19/2020
Last modified date: 03/19/2020