An important attribute, common to all Mappings, is the InvertInvert flag. This is a boolean (integer) attribute that can be assigned a new value at any time. If it is non-zero, it has the effect of interchanging the MappingMapping's input and output coordinates and the Mapping is then said to be inverted. By default, the Invert attribute is zero.
There is no magic in this. There is no fancy arithmetic involved in inverting mathematical functions, for instance. The Invert flag is simply a switch that interchanges a Mapping's input and output ports. If it is non-zero, the Mapping's NinNin and NoutNout attributes are swapped, its TranForwardTranForward and TranInverseTranInverse attributes are swapped, and when you ask for what was once the forward transformation you get the inverse transformation instead (and vice versa). When you return the Invert attribute to zero, or clear it, the Mapping returns to its original behaviour.
Often, the actual value of the Invert attribute is unimportant and you simply wish to invert its boolean sense, so that what was the Mapping's input becomes its output and vice versa. This is most easily accomplished using astInvertastInvert, as follows:
If the Mapping you have happens to be the wrong way around, astInvert allows you to correct the problem.