### AST_PERMMAP

Create a PermMap

#### Description:

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

A PermMap is a Mapping which permutes the order of coordinates, and possibly also changes the number of coordinates, between its input and output.

In addition to permuting the coordinate order, a PermMap may also assign constant values to coordinates. This is useful when the number of coordinates is being increased as it allows fixed values to be assigned to any new ones.

#### Invocation

RESULT = AST_PERMMAP( NIN, INPERM, NOUT, OUTPERM, CONSTANT, OPTIONS, STATUS )

#### Arguments

##### NIN = INTEGER (Given)
The number of input coordinates.
##### INPERM = INTEGER( NIN ) (Given)
An array which, for each input coordinate, should contain the number of the output coordinate whose value is to be used (note that this array therefore defines the inverse coordinate transformation). Coordinates are numbered starting from 1.

For details of additional special values that may be used in this array, see the description of the CONSTANT argument.

##### NOUT = INTEGER (Given)
The number of output coordinates.
##### OUTPERM = INTEGER( NOUT ) (Given)
An array which, for each output coordinate, should contain the number of the input coordinate whose value is to be used (note that this array therefore defines the forward coordinate transformation). Coordinates are numbered starting from 1.

For details of additional special values that may be used in this array, see the description of the CONSTANT argument.

##### CONSTANT = DOUBLE PRECISION( $\ast$ ) (Given)
An array containing values which may be assigned to input and/or output coordinates instead of deriving them from other coordinate values. If either of the INPERM or OUTPERM arrays contains a negative value, it is used to address this CONSTANT array (such that -1 addresses the first element, -2 addresses the second element, etc.) and the value obtained is used as the corresponding coordinate value.

Care should be taken to ensure that locations lying outside the extent of this array are not accidentally addressed. The array is not used if the INPERM and OUTPERM arrays do not contain negative values.

##### OPTIONS = CHARACTER $\ast$ ( $\ast$ ) (Given)
A character string containing an optional comma-separated list of attribute assignments to be used for initialising the new PermMap. The syntax used is identical to that for the AST_SET routine.
##### STATUS = INTEGER (Given and Returned)
The global status.

#### Returned Value

##### AST_PERMMAP = INTEGER
A pointer to the new PermMap.

#### Notes:

• If either of the INPERM or OUTPERM arrays contains a zero value (or a positive value which does not identify a valid output/input coordinate, as appropriate), then the value AST__BAD is assigned as the new coordinate value.

• This function does not attempt to ensure that the forward and inverse transformations performed by the PermMap are self-consistent in any way. You are therefore free to supply coordinate permutation arrays that achieve whatever effect is desired.

• A null Object pointer (AST__NULL) will be returned if this function is invoked with STATUS set to an error value, or if it should fail for any reason.