@@ -50,7 +50,7 @@ program bspline_defc_test
50
50
real (wp),dimension (nconst) :: xconst
51
51
real (wp),dimension (nconst) :: yconst
52
52
integer ,dimension (nconst) :: nderiv
53
- integer :: itype, mode, iw1, l, neqcon, nincon
53
+ integer :: itype, mode, iw1, l, neqcon, nincon, imode
54
54
55
55
call random_seed (size= isize)
56
56
allocate (iseed(isize)); iseed = 42_ip
@@ -162,23 +162,28 @@ program bspline_defc_test
162
162
neqcon = 2 ! num equality constraints
163
163
nincon = 2 ! num inequality constraints
164
164
165
- mode = 1 ! a new problem
166
- l = nbkpt- nord+1
167
- iw1 = nincon+2 * l
168
- lw = (nbkpt- nord+3 )* (nord+1 )+ 2 * max (ndata,nbkpt)+ nbkpt+ nord** 2 + &
169
- (l+ nconst)* l+2 * (neqcon+ l)+ (nincon+ l)+ (nincon+2 )* (l+6 )
170
- if (allocated (w)) deallocate (w)
171
- if (allocated (iw)) deallocate (iw)
172
- allocate (w(lw)) ; w = 0.0_wp
173
- allocate (iw(iw1)); iw = 0
174
- iw(1 ) = lw
175
- iw(2 ) = iw1
176
- call dfc (ndata, xdata, ydata, sddata, nord, nbkpt, bkpt, &
177
- nconst, xconst, yconst, nderiv, mode, coeff, w, iw)
178
- if (mode /= 0 ) then
179
- write (* ,* ) ' error calling dfc. mode = ' ,mode
180
- error stop
181
- end if
165
+ do imode = 1 , 2
166
+ ! run it twice just for testing, one with cov, one without
167
+ ! mode = 1 ! a new problem - no cov
168
+ ! mode = 2 ! a new problem - with cov
169
+ mode = imode
170
+ l = nbkpt- nord+1
171
+ iw1 = nincon+2 * l
172
+ lw = (nbkpt- nord+3 )* (nord+1 )+ 2 * max (ndata,nbkpt)+ nbkpt+ nord** 2 + &
173
+ (l+ nconst)* l+2 * (neqcon+ l)+ (nincon+ l)+ (nincon+2 )* (l+6 )
174
+ if (allocated (w)) deallocate (w)
175
+ if (allocated (iw)) deallocate (iw)
176
+ allocate (w(lw)) ; w = 0.0_wp
177
+ allocate (iw(iw1)); iw = 0
178
+ iw(1 ) = lw
179
+ iw(2 ) = iw1
180
+ call dfc (ndata, xdata, ydata, sddata, nord, nbkpt, bkpt, &
181
+ nconst, xconst, yconst, nderiv, mode, coeff, w, iw)
182
+ if (mode /= 0 ) then
183
+ write (* ,* ) ' error calling dfc. mode = ' ,mode
184
+ error stop
185
+ end if
186
+ end do
182
187
! use the splines to interpolate the data:
183
188
inbvx = 1
184
189
w0 = 0.0_wp
@@ -213,7 +218,7 @@ program bspline_defc_test
213
218
label= ' Least squares bspline' ,&
214
219
linestyle= ' r-' ,markersize= 2 ,linewidth= 2 ,istat= istat)
215
220
call plt% add_plot(xdata,ydata_est_constr,&
216
- label= ' Least squares bspline with constraint ' ,&
221
+ label= ' Least squares bspline with constraints ' ,&
217
222
linestyle= ' g.-' ,markersize= 4 ,linewidth= 2 ,istat= istat)
218
223
call plt% savefig(pyfile= ' bspline_defc_test.py' , figfile= ' bspline_defc_test.png' ,istat= istat)
219
224
0 commit comments