    Madagascar Programming Reference Manual    ## Implementation of operators

It should be evident by now that the implementation of an operator should have at least four arguments: a variable x from which the operand (entity on which is applied) is read along with its length nx, and the variable y in which the result is stored and its length .

Also, since every operator comes along with its adjoint, the implementation of the linear operators described later in this chapter, gives also the possibility to compute the adjoint operator. This is done through the boolean adj input argument. When adj is true, the adjoint operator computed. As discussed before, the domains of and are in general different, therefore cannot be applied on . However it can always be applied on or some , which has the same domain as . For this reason, when adj is true, the operand is and the result is and thus, y is used as input and the result is stored in x. As an example if [sec:sf_copy_lop]sf_copy_lop (the identity operator) is called, then the result is that . However if additionally adj is true, then the result will be . If [sec:adjnull]adjnull (the null operator) is called, then the result is that . However if additionally adj is true, then the result will be .

Finally, it is often the case that we need to compute but . For this reason another boolean argument, namely add is defined. If add is true, then . Considering the same example with the identity operator, if sf_copy_lop is called with add being true, then . If additionally adj is true, then . Or if adjnull is called with add being true, if adj is false, and if adj is true, then (so in essence, if add is true, no matter what the value of adj, nothing happens).

As a conclusion, the linear operators described in this chapter have all the following form:

 adj add description returns 0 0 normal operation 0 1 normal operation with addition 1 0 adjoint operation 1 1 adjoint operation with addition     Madagascar Programming Reference Manual    