22 integer,
allocatable :: nl0r(:)
23 integer,
allocatable :: l0rl0b_to_l0(:,:,:)
24 integer,
allocatable :: il0rz(:,:)
25 integer,
allocatable :: nc3(:)
26 logical,
allocatable :: vbal_block(:,:)
27 logical,
allocatable :: diag_block(:)
28 logical,
allocatable :: avg_block(:)
29 logical,
allocatable :: fit_block(:)
30 logical,
allocatable :: b_block(:)
31 logical,
allocatable :: nicas_block(:)
32 logical,
allocatable :: cv_block(:)
33 character(len=11),
allocatable :: blockname(:)
34 integer,
allocatable :: b_to_v1(:)
35 integer,
allocatable :: b_to_v2(:)
36 integer,
allocatable :: b_to_ts1(:)
37 integer,
allocatable :: b_to_ts2(:)
57 class(bpar_type),
intent(inout) :: bpar
58 type(nam_type),
intent(in) :: nam
59 type(geom_type),
intent(in) :: geom
62 integer :: ib,iv,jv,its,jts,il0,jl0r,jl0off
67 bpar%nb = nam%nv*nam%nts
71 bpar%nb = nam%nv**2*nam%nts**2
80 bpar%nl0rmax =
min(nam%nl0r,geom%nl0)
81 allocate(bpar%l0rl0b_to_l0(bpar%nl0rmax,geom%nl0,bpar%nbe))
82 allocate(bpar%il0rz(geom%nl0,bpar%nbe))
83 allocate(bpar%nl0r(bpar%nbe))
84 allocate(bpar%nc3(bpar%nbe))
85 allocate(bpar%vbal_block(nam%nv,nam%nv))
86 allocate(bpar%diag_block(bpar%nbe))
87 allocate(bpar%avg_block(bpar%nbe))
88 allocate(bpar%fit_block(bpar%nbe))
89 allocate(bpar%B_block(bpar%nbe))
90 allocate(bpar%nicas_block(bpar%nbe))
91 allocate(bpar%cv_block(bpar%nbe))
92 allocate(bpar%blockname(bpar%nbe))
93 allocate(bpar%b_to_v1(bpar%nbe))
94 allocate(bpar%b_to_v2(bpar%nbe))
95 allocate(bpar%b_to_ts1(bpar%nbe))
96 allocate(bpar%b_to_ts2(bpar%nbe))
99 call msi(bpar%l0rl0b_to_l0)
102 if (nam%new_lct)
then 108 bpar%nl0r(ib) = bpar%nl0rmax
110 jl0off = il0-(bpar%nl0r(ib)-1)/2-1
111 if (jl0off<1) jl0off = 0
112 if (jl0off+bpar%nl0rmax>geom%nl0) jl0off = geom%nl0-bpar%nl0rmax
113 do jl0r=1,bpar%nl0rmax
114 bpar%l0rl0b_to_l0(jl0r,il0,ib) = jl0off+jl0r
115 if (bpar%l0rl0b_to_l0(jl0r,il0,ib)==il0) bpar%il0rz(il0,ib) = jl0r
118 bpar%nc3(ib) = nam%nc3
119 bpar%nc3(ib) = nam%nc3
121 bpar%vbal_block(iv,jv) = (iv>1).and.(jv<iv).and.nam%vbal_block((iv-1)*(iv-2)/2+jv)
123 bpar%diag_block(ib) = .true.
124 bpar%avg_block(ib) = .false.
125 bpar%fit_block(ib) = .false.
126 bpar%B_block(ib) = .true.
127 bpar%nicas_block(ib) = .true.
128 bpar%cv_block(ib) = .true.
131 write(bpar%blockname(ib),
'(i2.2,a,i2.2,a,i2.2,a,i2.2)') iv,
'_',iv,
'_',its,
'_',its
132 bpar%b_to_v1(ib) = iv
133 bpar%b_to_v2(ib) = iv
134 bpar%b_to_ts1(ib) = its
135 bpar%b_to_ts2(ib) = its
148 if ((trim(nam%strategy)==
'diag_all').or.((iv==jv).and.(its==jts)))
then 149 bpar%nl0r(ib) = bpar%nl0rmax
151 jl0off = il0-(bpar%nl0r(ib)-1)/2-1
152 if (jl0off<1) jl0off = 0
153 if (jl0off+bpar%nl0rmax>geom%nl0) jl0off = geom%nl0-bpar%nl0rmax
154 do jl0r=1,bpar%nl0rmax
155 bpar%l0rl0b_to_l0(jl0r,il0,ib) = jl0off+jl0r
156 if (bpar%l0rl0b_to_l0(jl0r,il0,ib)==il0) bpar%il0rz(il0,ib) = jl0r
159 bpar%nc3(ib) = nam%nc3
162 bpar%l0rl0b_to_l0(:,il0,ib) = il0
170 bpar%vbal_block(iv,jv) = (iv>1).and.(jv<iv).and.nam%vbal_block((iv-1)*(iv-2)/2+jv)
171 select case (nam%strategy)
173 bpar%diag_block(ib) = .true.
174 bpar%avg_block(ib) = .true.
175 bpar%B_block(ib) = .false.
176 bpar%nicas_block(ib) = .false.
177 bpar%cv_block(ib) = .false.
179 bpar%diag_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
180 bpar%avg_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
181 bpar%B_block(ib) = (ib==bpar%nbe)
182 bpar%nicas_block(ib) = (ib==bpar%nbe)
183 bpar%cv_block(ib) = (ib==bpar%nbe)
184 case (
'common_univariate')
185 bpar%diag_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
186 bpar%avg_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
187 bpar%B_block(ib) = (ib==bpar%nbe)
188 bpar%nicas_block(ib) = (ib==bpar%nbe)
189 bpar%cv_block(ib) = (iv==jv).and.(its==jts)
190 case (
'common_weighted')
191 bpar%diag_block(ib) = .true.
192 bpar%avg_block(ib) = (iv==jv).and.(its==jts)
193 bpar%B_block(ib) = .true.
194 bpar%nicas_block(ib) = (bpar%nbe==bpar%nb)
195 bpar%cv_block(ib) = (iv==jv).and.(its==jts)
196 case (
'specific_univariate')
197 bpar%diag_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
198 bpar%avg_block(ib) = .false.
199 bpar%B_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
200 bpar%nicas_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
201 bpar%cv_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
202 case (
'specific_multivariate')
203 bpar%diag_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
204 bpar%avg_block(ib) = (bpar%nbe==bpar%nb)
205 bpar%B_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
206 bpar%nicas_block(ib) = (iv==jv).and.(its==1).and.(jts==1)
207 bpar%cv_block(ib) = (ib==bpar%nbe)
209 bpar%fit_block(ib) = (bpar%nb==1).or.(bpar%diag_block(ib).and.(iv==jv).and.(its==jts) &
210 & .and.(trim(nam%minim_algo)/=
'none'))
211 if (nam%local_diag) bpar%fit_block(ib) = bpar%fit_block(ib).and.bpar%nicas_block(ib)
214 write(bpar%blockname(ib),
'(i2.2,a,i2.2,a,i2.2,a,i2.2)') iv,
'_',jv,
'_',its,
'_',jts
215 bpar%b_to_v1(ib) = iv
216 bpar%b_to_v2(ib) = jv
217 bpar%b_to_ts1(ib) = its
218 bpar%b_to_ts2(ib) = jts
227 if (bpar%nbe>bpar%nb)
then 232 bpar%nl0r(ib) = bpar%nl0rmax
234 jl0off = il0-(bpar%nl0r(ib)-1)/2-1
235 if (jl0off<1) jl0off = 0
236 if (jl0off+bpar%nl0rmax>geom%nl0) jl0off = geom%nl0-bpar%nl0rmax
237 do jl0r=1,bpar%nl0rmax
238 bpar%l0rl0b_to_l0(jl0r,il0,ib) = jl0off+jl0r
239 if (bpar%l0rl0b_to_l0(jl0r,il0,ib)==il0) bpar%il0rz(il0,ib) = jl0r
242 bpar%nc3(ib) = nam%nc3
245 select case (nam%strategy)
247 bpar%diag_block(ib) = .true.
248 bpar%avg_block(ib) = .false.
249 bpar%B_block(ib) = .false.
250 bpar%nicas_block(ib) = .false.
251 bpar%cv_block(ib) = .false.
253 bpar%diag_block(ib) = .true.
254 bpar%avg_block(ib) = .false.
255 bpar%B_block(ib) = .true.
256 bpar%nicas_block(ib) = .true.
257 bpar%cv_block(ib) = .true.
258 case (
'common_univariate')
259 bpar%diag_block(ib) = .true.
260 bpar%avg_block(ib) = .false.
261 bpar%B_block(ib) = .true.
262 bpar%nicas_block(ib) = .true.
263 bpar%cv_block(ib) = .false.
264 case (
'common_weighted')
265 bpar%diag_block(ib) = .true.
266 bpar%avg_block(ib) = .false.
267 bpar%B_block(ib) = .true.
268 bpar%nicas_block(ib) = .true.
269 bpar%cv_block(ib) = .false.
270 case (
'specific_univariate')
271 bpar%diag_block(ib) = .false.
272 bpar%avg_block(ib) = .false.
273 bpar%B_block(ib) = .false.
274 bpar%nicas_block(ib) = .false.
275 bpar%cv_block(ib) = .false.
276 case (
'specific_multivariate')
277 bpar%diag_block(ib) = .false.
278 bpar%avg_block(ib) = .false.
279 bpar%B_block(ib) = .false.
280 bpar%nicas_block(ib) = .false.
281 bpar%cv_block(ib) = .true.
283 bpar%fit_block(ib) = bpar%diag_block(ib).and.(trim(nam%minim_algo)/=
'none')
284 if (nam%local_diag) bpar%fit_block(ib) = bpar%fit_block(ib).and.bpar%nicas_block(ib)
287 bpar%blockname(ib) =
'common' 290 bpar%b_to_ts1(ib) = 0
291 bpar%b_to_ts2(ib) = 0
306 class(bpar_type),
intent(inout) :: bpar
309 if (
allocated(bpar%nl0r))
deallocate(bpar%nl0r)
310 if (
allocated(bpar%l0rl0b_to_l0))
deallocate(bpar%l0rl0b_to_l0)
311 if (
allocated(bpar%il0rz))
deallocate(bpar%il0rz)
312 if (
allocated(bpar%nc3))
deallocate(bpar%nc3)
313 if (
allocated(bpar%vbal_block))
deallocate(bpar%vbal_block)
314 if (
allocated(bpar%diag_block))
deallocate(bpar%diag_block)
315 if (
allocated(bpar%avg_block))
deallocate(bpar%avg_block)
316 if (
allocated(bpar%fit_block))
deallocate(bpar%fit_block)
317 if (
allocated(bpar%B_block))
deallocate(bpar%B_block)
318 if (
allocated(bpar%nicas_block))
deallocate(bpar%nicas_block)
319 if (
allocated(bpar%cv_block))
deallocate(bpar%cv_block)
320 if (
allocated(bpar%blockname))
deallocate(bpar%blockname)
321 if (
allocated(bpar%b_to_v1))
deallocate(bpar%b_to_v1)
322 if (
allocated(bpar%b_to_v2))
deallocate(bpar%b_to_v2)
323 if (
allocated(bpar%b_to_ts1))
deallocate(bpar%b_to_ts1)
324 if (
allocated(bpar%b_to_ts2))
deallocate(bpar%b_to_ts2)
subroutine bpar_dealloc(bpar)
subroutine bpar_alloc(bpar, nam, geom)
integer, parameter, public kind_real