The **linear interpolation**
operator is much like the binning operator but a little fancier.
When we perform the forward operation, we take each data coordinate
and see which two model mesh points bracket it.
Then we pick up the two bracketing model values
and weight each of them
in proportion to their nearness to the data coordinate,
and add them to get the data value (ordinate).
The adjoint operation is adding a data value
back into the model vector;
using the same two weights,
this operation distributes the ordinate value
between the two nearest points in the model vector.
For example, suppose we have a data point near each end of the model
and a third data point exactly in the middle.
Then for a model space 6 points long,
as shown in Figure 1,
we have the operator in (8).

helgerud
Uniformly sampled model space
and irregularly sampled data space corresponding
to (8).
Figure 1 |

(8) |

Subroutine `lint1()` does linear interpolation and its adjoint.

# Linear interpolation 1-D, uniform model mesh to data coordinates and values. # subroutine lint1( adj, add, o1,d1,coordinate, mm,m1, dd, nd) integer i, im, adj, add, id, m1, nd real f, fx,gx, o1,d1,coordinate(nd), mm(m1), dd( nd) call adjnull( adj, add, mm,m1, dd, nd) do id= 1, nd { f = (coordinate(id)-o1)/d1; i=f; im= 1+i if( 1<=im && im<m1) { fx=f-i; gx= 1.-fx if( adj == 0) dd(id) = dd(id) + gx * mm(im) + fx * mm(im+1) else { mm(im ) = mm(im ) + gx * dd(id) mm(im+1) = mm(im+1) + fx * dd(id) } } } return; end

12/26/2000