#### Description:

This function creates a new CmpMap and optionally initialises its attributes.

A CmpMap is a compound Mapping which allows two component Mappings (of any class) to be connected together to form a more complex Mapping. This connection may either be `"` in series`"` (where the first Mapping is used to transform the coordinates of each point and the second mapping is then applied to the result), or `"` in parallel`"` (where one Mapping transforms the earlier coordinates for each point and the second Mapping simultaneously transforms the later coordinates).

Since a CmpMap is itself a Mapping, it can be used as a component in forming further CmpMaps. Mappings of arbitrary complexity may be built from simple individual Mappings in this way.

#### Synopsis

AstCmpMap ∗astCmpMap( AstMapping ∗map1, AstMapping ∗map2, int series, const char ∗options, ... )

#### Parameters:

##### map1

Pointer to the first component Mapping.

##### map2

Pointer to the second component Mapping.

##### series

If a non-zero value is given for this parameter, the two component Mappings will be connected in series. A zero value requests that they are connected in parallel.

##### options

Pointer to a null-terminated string containing an optional comma-separated list of attribute assignments to be used for initialising the new CmpMap. The syntax used is identical to that for the astSet function and may include `"` printf`"` format specifiers identified by `"` %`"` symbols in the normal way.

##### ...

If the `"` options`"` string contains `"` %`"` format specifiers, then an optional list of additional arguments may follow it in order to supply values to be substituted for these specifiers. The rules for supplying these are identical to those for the astSet function (and for the C `"` printf`"` function).

#### Returned Value

##### astCmpMap()

A pointer to the new CmpMap.

#### Notes:

- If the component Mappings are connected in series, then using the resulting CmpMap to transform coordinates will cause the first Mapping to be applied, followed by the second Mapping. If the inverse CmpMap transformation is requested, the two component Mappings will be applied in both the reverse order and the reverse direction.

- When connecting two component Mappings in series, the number of output coordinates generated by the first Mapping (its Nout attribute) must equal the number of input coordinates accepted by the second Mapping (its Nin attribute).

- If the component Mappings of a CmpMap are connected in parallel, then the first Mapping will be used to transform the earlier input coordinates for each point (and to produce the earlier output coordinates) and the second Mapping will be used simultaneously to transform the remaining input coordinates (to produce the remaining output coordinates for each point). If the inverse transformation is requested, each Mapping will still be applied to the same coordinates, but in the reverse direction.

- When connecting two component Mappings in parallel, there is no restriction on the number of input and output coordinates for each Mapping.

- Note that the component Mappings supplied are not copied by astCmpMap (the new CmpMap simply retains a reference to them). They may continue to be used for other purposes, but should not be deleted. If a CmpMap containing a copy of its component Mappings is required, then a copy of the CmpMap should be made using astCopy.

- A null Object pointer (AST__NULL) will be returned if this function is invoked with the AST error status set, or if it should fail for any reason.

Copyright (C) 2021 East Asian Observatory