Construct a square 2-D array with ones on the diagonal and zeros elsewhere.
SciPhp\NdArray
NumPhp::identity(
int
$side
)
$side
use SciPhp\NumPhp as np;
$m = np::identity(4);
print $m;
The above example will output:
[[1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]]