NdArray::copy

Copy an array

Description

SciPhp\NdArray NdArray::copy()

Parameters

This function has no parameters.

Return Values

The new SciPhp\NdArray

Examples

Example #1: Copy a matrix

use SciPhp\NumPhp as np;

$x np::linspace(166)->resize(33);
$y $x->copy()->resize(26);

echo 
"x\n$x""y\n$y";

The above example will output:

x
[[1  2  3]
 [4  5  6]
 [1  2  3]]
y
[[1  2  3  4  5  6]
 [1  2  3  1  2  3]]

See Also