Skip to content

Commit 6cbd9ba

Browse files
committed
added more constraints for dfc test
1 parent e774db9 commit 6cbd9ba

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

test/bspline_defc_test.f90

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ program bspline_defc_test
4646
real(wp),dimension(ndata) :: bcoef
4747
real(wp),dimension(ndata*10) :: x_int, y_int
4848

49-
integer,parameter :: nconst = 2 !! for [[dfc]]
49+
integer,parameter :: nconst = 4 !! for [[dfc]]
5050
real(wp),dimension(nconst) :: xconst
5151
real(wp),dimension(nconst) :: yconst
5252
integer ,dimension(nconst) :: nderiv
@@ -137,20 +137,31 @@ program bspline_defc_test
137137
!--------------------------------------------------------
138138
! now, do the least squares splines with some constraints:
139139

140-
j = 1 ! 1st derivative
140+
j = 1 ! 1st derivative constraints
141+
141142
itype = 2 ! (J-th deriv. at X) == Y
142143
xconst(1) = xdata(1)
143144
yconst(1) = 0.0_wp ! == constraint for derivative at initial point
144145
nderiv(1) = itype+4*J
145146

146-
j = 1 ! 1st derivative
147-
itype = 0 ! (J-th deriv. at X) <= Y.
148-
xconst(2) = xdata(ndata)
149-
yconst(2) = -2.0_wp ! <= inequality constraint for derivative at final point
147+
itype = 1 ! (J-th deriv. at X) >= Y.
148+
xconst(2) = xdata(2)
149+
yconst(2) = 0.0_wp ! >= inequality constraint for derivative at seconmd point
150150
nderiv(2) = itype+4*J
151151

152-
neqcon = 1 ! num equality constraints
153-
nincon = 1 ! num inequality constraints
152+
itype = 0 ! (J-th deriv. at X) <= Y.
153+
xconst(3) = xdata(ndata)
154+
yconst(3) = -2.0_wp ! <= inequality constraint for derivative at final point
155+
nderiv(3) = itype+4*J
156+
157+
itype = 3 ! (J-th deriv. at X) == (J-th deriv. at Y).
158+
xconst(4) = xdata(3)
159+
yconst(4) = xdata(4) ! == constraint on 3rd and 4th derivatives
160+
nderiv(4) = itype+4*J
161+
162+
neqcon = 2 ! num equality constraints
163+
nincon = 2 ! num inequality constraints
164+
154165
mode = 1 ! a new problem
155166
l = nbkpt-nord+1
156167
iw1 = nincon+2*l

0 commit comments

Comments
 (0)