# class CoordMapping

## Overview

Mapping of a coordinate to another. It supports analytic and grid-point-based mapping in subclasses. Here in this root CoordMapping class only the invariant unity mapping (or no mapping) is defined.

## Class methods

#### `CoordMapping.new`

  Constructor. One or more arguments can be needed in subclasses

## Methods

#### `map(x,y,z,...)`

  Maps data point(s)

  ARGUMENTS

  - x,y,z,... (one or more Numeric or NArray) : data points. Mapping is made of [x,y,z,..] (if Numeric) or [x[0],y[0],z[0],..], [x[1],y[1],z[1],..], ..(if NArray). Thus, the number of arguments must be equal to the rank of the mapping. Also, their lengths must agree with each other.

  RETURN VALUE

  - Array of p,q,r,... (Numeric or NArray) : mapping result

#### `map_grid(x,y,z,...)`

  Same as map but for a regular grid.

  ARGUMENTS

  - x,y,z,... (one or more 1D NArray) : coordinate values of a regular grid [x_i, y_j, z_k,..]. The shape of the grid is thus [x.length, y.length, z.length,..]. This method needs no redefinition, since it calls map inside.

#### `inverse_map(p,q,r,...)`

  Inversely maps data point(s).

  ARGUMENTS

  - p,q,r,... (one or more Numeric or NArray) : data points. Inverse mapping is made of [p,q,r,..] (if Numeric) or [p[0],q[0],r[0],..], [p[1],q[1],r[1],..], ..(if NArray). Thus, the number of arguments must be equal to the rank of the mapping. Also, if NArray, their lengths must agree with each other.

  RETURN VALUE

  - Array of x,y,z,... (Numeric or NArray) : inverse mapping result

#### `inverse`

  Returns the inverse mapping.

  RETURN VALUE

  - a CoordMapping

#### `inversion_rigorous?`

  Whether the inversion is rigorous (analytical)

  RETURN VALUE

  - true or false

# class LinearCoordMapping < CoordMapping

## Overview

Linear coordinate mapping expressed as offset + factor*x, where offset is a vector (NVect) and factor is a matrix (NMatrix).

Methods listed below are only those newly defined or those whose arguments are changed.

## Class methods

#### `LinearCoordMapping.new(offset=nil, factor=nil)`

  Constructor. If one of offset and factor is not specified (nil), a zero vector / a unit matrix is used (at least one of them must be given).

  ARGUMENTS

  - offset (NVector or nil) : the offset. Its length represents the rank of mapping. (if nil a zero vector is assumed)
  - factor (NMatrix or nil) : the factor. For consistency, ( offset.length == factor.shape[0] == factor.shape[1] ) is required.

## Methods

#### `offset`

  Returns the internally stored offset.

#### `factor`

  Returns the internally stored factor.