
program Regfill

use sep
use inter_filt_reg2x
use inter_patch_reg2x 
implicit none
integer				:: prep, f, niter, n1, n2, size, nw1, nw2, npatch1, npatch2,  alias
real, dimension(:,:), pointer	:: x_interp, x_mis 		 
real 				:: eps 
call sep_init()


call from_param("prep", prep, 1)
call from_param("nw1", nw1, 1)
call from_param("nw2", nw2, 1)
call from_param("npatch1", npatch1, 1)
call from_param("npatch2", npatch2, 1) 
call from_param("f", f, 1)
call from_param("niter", niter, 100)
call from_param("size", size, 1) 
call from_param("alias", alias, 0)
call from_param("eps", eps, 1.0)
call from_history( "n1", n1)
call from_history( "n2", n2)

allocate (x_interp(n1,n2), x_mis(n1,n2))

call sep_read(x_mis)


! Calling the main filling program with regularization
call inter_patch_regx(nw1, nw2, niter, f, size, prep, x_mis, x_interp, npatch1, npatch2, n1, n2, alias, eps) 

call sep_write(x_interp)


call sep_close()


end program Regfill
