cmatrix.unit

cmatrix.unit()

Generate the unit matrix.

Parameters

Type

Description

size

int

the size of the square matrix

Returns
Matrix

The unit matrix

See also

set_ij()

Examples

>>> u=unit(4)
>>> print(u)
| +1.000 | +0.000 | +0.000 | +0.000 |
| +0.000 | +1.000 | +0.000 | +0.000 |
| +0.000 | +0.000 | +1.000 | +0.000 |
| +0.000 | +0.000 | +0.000 | +1.000 |
printed