next up previous [pdf]

Next: THEORY OF UNDERDETERMINED LEAST-SQUARES Up: EMPTY BINS AND PRECONDITIONING Previous: SEABEAM: Filling the empty

Three codes for inverse masking

The selection (or masking) operator $ \bold K$ is implemented in mask() [*].
filt/lib/mask.c
    sf_adjnull (adj,add,nx,ny,x,y);

    for (ix=0; ix < nx; ix++) {
	if (m[ix]) {
	    if (adj) x[ix] += y[ix];
	    else     y[ix] += x[ix];

All the results shown in Figure 5.9 were created with the module mis2 [*]. Code locations with style=0,1,2 correspond to the fitting goals (5.27), (5.28), (5.29).

user/gee/mis2.c
void mis2(int niter         /* number of iterations */, 
	  int nx            /* model size */, 
	  float *xx         /* model */, 
	  sf_filter aa      /* helix filter */, 
	  const bool *known /* mask for known data */,
	  float eps         /* regularization parameter */,
	  bool doprec       /* to apply preconditioning */) 
/*< interpolate >*/
{
    int ix;
    float *dd;

    if (doprec) {                          /*  preconditioned */
	sf_mask_init(known);
	polydiv_init(nx, aa);
	sf_solver_prec(sf_mask_lop, sf_cgstep, polydiv_lop, 
		       nx, nx, nx, xx, xx, niter, eps, "end");
	polydiv_close();
    } else {                               /*  regularized */
	dd = sf_floatalloc(nx);
	for (ix=0; ix < nx; ix++) {
	    dd[ix]=0.;
	}

	sf_helicon_init(aa);
	sf_solver (sf_helicon_lop, sf_cgstep, nx, nx, xx, dd, niter, 
		   "known", known, "x0", xx, "end");
	free(dd);
    }
    sf_cgstep_close();
}


next up previous [pdf]

Next: THEORY OF UNDERDETERMINED LEAST-SQUARES Up: EMPTY BINS AND PRECONDITIONING Previous: SEABEAM: Filling the empty

2008-11-06