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