Next: Composite Operators Up: PROGRAMMING ALGEBRA Previous: Composite vectors

## Operators

An operator object images an input vector to an output vector when its image() method is invoked. Furthermore, an operator knows about its domain and range, which are vector space objects.

For example, the linear NMO operator shifts a CMP gather's traces according to a hyperbolic time-offset relationship. An NMO input vector is an Rsf vector that contains the CMP gather. The operator's output vector is a moved-out CMP gather. The input and output space are identical except that the first axis of the output lists move-out corrected time, rather then true two-way traveltime, t. Figure 1 shows a reproducible World Wide Web document that invokes the Jag NMO operator. The class fragment progNmo implements an NMO operator's arithmetic core. The apply method combines the operator's forward and adjoint image operation in a combined loop, just as we are used to doing it at SEP. However, a programmer never invokes the apply method directly. Instead, he invokes the image() method of an operator or its adjoint.

  public void apply(boolean add, Vector in, Vector out) {
Rsf2   x = (Rsf2) in;
Rsf2   y = (Rsf2) out;
int   nx =  ((RsfSpace) x.getSpace()).getNSamples(1);
float dx = (((RsfSpace) x.getSpace()).getAxes()[1]).delta;
float ox = (((RsfSpace) x.getSpace()).getAxes()[1]).offset;
int   nz =  ((RsfSpace) x.getSpace()).getNSamples(0);
float dz = (((RsfSpace) x.getSpace()).getAxes()[0]).delta;
float oz = (((RsfSpace) x.getSpace()).getAxes()[0]).offset;

float[][] yy = y.d;
float[][] xx = x.d;

for (int ix=0; ix < nx ; ix++) { float xs = (ox + dx * ix) * 1f/vel  ;
for (int iz=0; iz < nz ; iz++) { float zs =  oz + dz * iz;
float ts = (float) Math.sqrt(zs * zs + xs * xs) + 1.e-20f;
float wt = (float) (zs/ts * (1./Math.sqrt(ts)));
int   it = (int) (.5 + (ts - oz) / dz);
if (it < nz) {
if(isFwd)
yy[ix][iz] += xx[ix][it] * wt;
else
xx[ix][it] += yy[ix][iz] * wt;
}
}}
}


The NMO operator is often combined with the Stacking operator. The Stacking operator takes a 2-D Rsf object and sums element-wise over the second axis. The Stacking operator is linear, too, and its adjoint fills a 2-D Rsf with a copy of the adjoint's 1-D input Rsf.

Next: Composite Operators Up: PROGRAMMING ALGEBRA Previous: Composite vectors
Stanford Exploration Project
11/11/1997