When the matrix has a special form, such as
(1) |
do ix = 1, nx { do ib = 1, nb { iy = ib + ix - 1 if operator itself (convolution) y(iy) = y(iy) + b(ib) x(ix) if adjoint (correlation) x(ix) = x(ix) + b(ib) y(iy) }}
Again, notice that the ``bottom line'' in the program is that x and y are simply interchanged.
Equation (1) could be rewritten as
(2) |
The program contran()
can be used with either
equation (1) or
equation (2),
because the calling program can swap the xx and bb variables.
The name contran() denotes convolution
with ``transpose'' and with ``transient'' end effects.
# Convolve and correlate (adjoint convolve).
#
subroutine contran( adj, add, nx, xx, nb, bb, yy)
integer ix, ib, ny, adj, add, nx, nb
real xx(nx) # input signal
real bb(nb) # filter (or output crosscorrelation)
real yy(nx+nb-1) # filtered signal (or second input signal)
ny = nx + nb - 1 # length of filtered signal
call adjnull( adj, add, bb, nb, yy, ny)
do ib= 1, nb {
do ix= 1, nx {
if( adj == 0 )
yy( ib+ix-1) = yy( ib+ix-1) + xx( ix) * bb(ib)
else
bb( ib) = bb( ib) + xx( ix) * yy( ib+ix-1)
}}
return; end