    Basic operators and adjoints  Next: Transient convolution Up: FAMILIAR OPERATORS Previous: FAMILIAR OPERATORS

In numerical analysis, we represent the derivative of a time function by a finite difference. This subtracts neighboring time points and divides by the sample interval . Finite difference amounts to convolution with the filter . Omitting the , we express this concept as: (3)

The filter is seen in any column in the middle of the matrix, namely . In the transposed matrix, the filter-impulse response is time-reversed to . Therefore, mathematically, we can say that the adjoint of the time derivative operation is the negative time derivative. Likewise, in the Fourier domain, the complex conjugate of is . We can also speak of the adjoint of the boundary conditions: we might say that the adjoint of no boundary condition'' is a specified value'' boundary condition. The last row in equation (3) is optional. It may seem unnatural to append a null row, but it can be a small convenience (when plotting) to have the input and output be the same size.

Equation (3) is implemented by the code in module igrad1 that does the operator itself (the forward operator) and its adjoint.

 void sf_igrad1_lop(bool adj, bool add, int nx, int ny, float *xx, float *yy) /*< linear operator >*/ { int i; sf_adjnull(adj,add,nx,ny,xx,yy); for (i=0; i < nx-1; i++) { if (adj) { xx[i+1] += yy[i]; xx[i] -= yy[i]; } else { yy[i] += xx[i+1] - xx[i]; } } } 

The adjoint code may seem strange. It might seem more natural to code the adjoint to be the negative of the operator itself; and then, make the special adjustments for the boundaries. The code given, however, is correct and requires no adjustments at the ends. To see why, notice for each value of i, the operator itself handles one row of equation (3), while for each i, the adjoint handles one column. That is why coding the adjoint in this way does not require any special work on the ends. The present method of coding reminds us that the adjoint of a sum of terms is a collection of assignments. Think of the meaning of for any particular and . The adjoint simply accumulates that same value of going the other direction .

where we see that each component of the matrix is handled both by the operator and the adjoint. Think about the forward operator pulling'' a sum into yy(i), and think about the adjoint operator pushing'' or spraying'' the impulse yy(i) back into xx().

Figure 1 illustrates the use of module igrad1 for each north-south line of a topographic map. We observe that the gradient gives an impression of illumination from a low sun angle. Figure 1.
Topography near Stanford (top) southward slope (bottom).   To apply igrad1 along the 1-axis for each point on the 2-axis of a two-dimensional map, we use the loop

for (iy=0; iy < ny; iy++)    Basic operators and adjoints  