We often string together two operators to get a third. Because we generally deal with linear operators that are procedurally defined we cannot regard
and we must regard it as
Our Fortran programs interpret this as meaning that first memory must be allocated for ; must be erased; should be computed; should be erased; and finally should be computed. Coding all of this is error prone.
In C++, if you wish to form an operator C that is A acting on B, you simply write:
<type>opchain C = A * BThe class ``'' encapsulates the behavior of an operator that is a composite of other operators applied in sequence. When the new operator C is applied it will act as though
When a chained operator is applied in the conjugate sense it will be applied with each component operator conjugated and applied in the reverse order. The code that implements chained operators does not have to be rewritten for new operators, this removes another possible source of errors in writing new code.
A similar helper class is available to create an operator that is the conjugate of another operator, it is also very simple to use:
<type>opconj B = conjugate(A)Application of B.Forward() will be equivalent to applying A.Conjugate().