#### Description:

This function returns pointers to two Mappings which, when applied either in series or parallel, are equivalent to the supplied Mapping.

Since the Frame class inherits from the Mapping class, Frames can be considered as special types of Mappings and so this method can be used to decompose either CmpMaps or CmpFrames.

#### Synopsis

void astDecompose( AstMapping ∗this, AstMapping ∗∗map1, AstMapping ∗∗map2, int ∗series, int ∗invert1, int ∗invert2 )

#### Parameters:

##### this

Pointer to the Mapping.

##### map1

Address of a location to receive a pointer to first component Mapping.

##### map2

Address of a location to receive a pointer to second component Mapping.

##### series

Address of a location to receive a value indicating if the component Mappings are applied in series or parallel. A non-zero value means that the supplied Mapping is equivalent to applying map1 followed by map2 in series. A zero value means that the supplied Mapping is equivalent to applying map1 to the lower numbered axes and map2 to the higher numbered axes, in parallel.

##### invert1

The value of the Invert attribute to be used with map1.

##### invert2

The value of the Invert attribute to be used with map2.

#### Applicability

##### CmpMap

If the supplied Mapping is a CmpMap, then map1 and map2 will be returned holding pointers to the component Mappings used to create the CmpMap, either in series or parallel. Note, changing the Invert attribute of either of the component Mappings using the returned pointers will have no effect on the supplied CmpMap. This is because the CmpMap remembers and uses the original settings of the Invert attributes (that is, the values of the Invert attributes when the CmpMap was first created). These are the Invert values which are returned in invert1 and invert2.

##### TranMap

If the supplied Mapping is a TranMap, then map1 and map2 will be returned holding pointers to the forward and inverse Mappings represented by the TranMap (zero will be returned for series). Note, changing the Invert attribute of either of the component Mappings using the returned pointers will have no effect on the supplied TranMap. This is because the TranMap remembers and uses the original settings of the Invert attributes (that is, the values of the Invert attributes when the TranMap was first created). These are the Invert values which are returned in invert1 and invert2.

##### Mapping

For any class of Mapping other than a CmpMap, map1 will be returned holding a clone of the supplied Mapping pointer, and map2 will be returned holding a NULL pointer. Invert1 will be returned holding the current value of the Invert attribute for the supplied Mapping, and invert2 will be returned holding zero.

##### CmpFrame

If the supplied Mapping is a CmpFrame, then map1 and map2 will be returned holding pointers to the component Frames used to create the CmpFrame. The component Frames are considered to be in applied in parallel.

##### Frame

For any class of Frame other than a CmpFrame, map1 will be returned holding a clone of the supplied Frame pointer, and map2 will be returned holding a NULL pointer.

#### Notes:

- The returned Invert values should be used in preference to the current values of the Invert attribute in map1 and map2. This is because the attributes may have changed value since the Mappings were combined.

- Any changes made to the component Mappings using the returned pointers will be reflected in the supplied Mapping.

Copyright (C) 2021 East Asian Observatory