Generate a Vandermonde matrix.
SciPhp\NdArray
NdArray::vander(
[
int
$num
])
The columns of the output matrix are powers of the vector.
$num
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 3, 4])->vander();
echo "m\n$m";
The above example will output:
m [[1 1 1 1 ] [8 4 2 1 ] [27 9 3 1 ] [64 16 4 1 ]]
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 3, 4])->vander(3);
echo "m\n$m";
The above example will output:
m [[1 1 1 ] [4 2 1 ] [9 3 1 ] [16 4 1 ]]
use SciPhp\NumPhp as np;
$m = np::ar([1, 2, 3])->vander(5);
echo "m\n$m";
The above example will output:
m [[1 1 1 1 1 ] [16 8 4 2 1 ] [81 27 9 3 1 ]]