spectrochempy.identity
- identity(n, dtype=None, **kwargs)[source]
Return the identity
NDDataset
of a given shape.The identity array is a square array with ones on the main diagonal.
- Parameters:
n (int) – Number of rows (and columns) in
n
xn
output.dtype (data-type, optional) – Data-type of the output. Defaults to
float
.**kwargs – Other parameters to be passed to the object constructor (units, coordset, mask …).
- Returns:
identity –
n
xn
array with its main diagonal set to one, and all other elements 0.
See also
Examples
>>> scp.identity(3).data array([[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]])