Construct a new N-dimensional array
SciPhp\NdArray
NumPhp::ar(
array
$data
)
NumPhp::ar() is an alias of NumPy.array() in Python.
$data
The new SciPhp\NdArray
use SciPhp\NumPhp as np;
// x, y, z coordinates
$x = np::ar([1, 2, 3]);
echo $x;
The above example will output:
[1 2 3]
use SciPhp\NumPhp as np;
$x = np::ar([[1, 2], [3, 4]]);
echo $x;
The above example will output:
[[1 2] [3 4]]