Using the HCL library, we can implement a chain of operators. There is no preset maximum number of operators that we can chain into one. The chain operator knows the order in which it must apply the operators that compose it, by the order in which the operators are handed to the chain at construction time. The chain operator is encapsulated inside the HCL_CompLinearOpAdj class, or a class of Compound Linear Operators with Adjoint. This class handles the chain of operators by keeping an array of abstract HCL_LinearOpAdj's. HCL_LinearOpAdj is the abstract base class from which any operator with Adjoint in the HCL library is derived. It can be considered as an empty class that attempts to define the set of member functions that are common to all linear operators that have an Adjoint.
Objects from the IGF90_ConvOp and IGF90_LinInterpOp classes can then
be handled abstractly in the chain operator as HCL_LinearOpAdj's. The
chain operator itself can also be chained with another operator into a
new chain operator. The following lines of code implement a basic
chain operator that is applied to an IGF90 object:
// Chain Linear interpolation and convolution
// Make a chained operator out of C and L
HCL_CompLinearOpAdj chain(&C, 0, &L, 0) ;
// x = C'(L'(data))
chain.Adjoint().Image( data, x );
x are IGF90 objects as defined in the
previous examples. Figure 2 shows the result of applying the
chain operator to the Seabeam data set. The result, as expected, is
the same as that obtained in Figure 1.
Figure 2 Chained interpolation and convolution operations on the Seabeam dataset. As expected, the result is the same as in the previous example, after application of the convolution to the interpolated data.
More operators can be added to the bottom of the chain operator
(they will be applied last) using the
SetNext() member function:
HCL_CompLinearOp chain2(&C, 0, &L, 0) ;
chain.SetNext(&chain2.Adjoint(), 0); // chain = L' C' L C