void dsrtomo_oper(bool adj, bool add, int nx, int nr, float *x, float *r) /*< linear operator >*/ { int i,j; sf_adjnull(adj,add,nx,nr,x,r); if (adj) { /* given dt solve dw */ /* data precon */ for (i=0; i < nn[1]*nn[2]; i++) { if (dp != NULL && dp[i] != 1) pstk[(long) i*nn[0]] = 0.; else pstk[(long) i*nn[0]] = r[i]; for (j=1; j < nn[0]; j++) pstk[(long) i*nn[0]+j] = 0.; } /* linear operator */ upgrad_inverse(upg,temp,pstk,NULL); upgrad_spread(upg,x,temp); /* model precon */ if (mp != NULL) { for (i=0; i < nn[0]*nn[1]; i++) { if (mp[i] != 1) x[i] = 0.; } } } else { /* given dw solve dt */ /* model precon */ if (mp != NULL) { for (i=0; i < nn[0]*nn[1]; i++) { if (mp[i] != 1) x[i] = 0.; } } /* linear operator */ upgrad_collect(upg,x,temp); upgrad_solve(upg,temp,pstk,NULL); /* data precon */ for (i=0; i < nn[1]*nn[2]; i++) { if (dp != NULL && dp[i] != 1) r[i] = 0.; else r[i] = pstk[(long) i*nn[0]]; } } }
void fatomo_lop(bool adj, bool add, int nx, int nr, float *x, float *r) /*< linear operator >*/ { int it, is, count; sf_adjnull(adj,add,nx,nr,x,r); if (adj) { /* given dt solve ds */ count = 0; for (is=0; is < ns; is++) { for (it=0; it < nt; it++) { if (mask[is][it] == 1) { tempt[it] = r[count]; count++; } else { tempt[it] = 0.; } } upgrad_inverse(upglist[is],tempx,tempt,NULL); for (it=0; it < nt; it++) x[it]+=tempx[it]; } } else { /* given ds solve dt */ count = 0; for (is=0; is < ns; is++) { upgrad_solve(upglist[is],x,tempt,NULL); for (it=0; it < nt; it++) { if (mask[is][it] == 1) { r[count] = tempt[it]; count++; } } } } }