trait NumArrayTrait (View source)

Methods

static NdArray
zeros()

Creates a NdArray with zero as default value

static NdArray
ones()

Creates a NdArray with one as default value

static NdArray
nulls()

Creates a NdArray with null as default value 'empty' can not be used in PHP

static NdArray
full(array $shape, mixed $value)

Creates a NdArray with a default value

static mixed|array
createArray(array $params, mixed $value)

Construct a n-dim array with a default value

static NdArray
nulls_like(array|NdArray $matrix)

Construct a new array of nulls with the same shape and type as a given array.

static NdArray
zeros_like(array|NdArray $matrix)

Construct a new array of zeros with the same shape and type as a given array.

static NdArray
ones_like(array|NdArray $matrix)

Construct a new array of ones with the same shape and type as a given array.

static NdArray
full_like(array|NdArray $matrix, $value = null)

Construct a new array with the same shape and type as a given array, filled with a given value

static NdArray
broadcast_to(array|NdArray $matrix, array $shape)

Broadcast an array to a new shape.

Details

final static NdArray zeros()

Creates a NdArray with zero as default value

Return Value

NdArray

final static NdArray ones()

Creates a NdArray with one as default value

Return Value

NdArray

final static NdArray nulls()

Creates a NdArray with null as default value 'empty' can not be used in PHP

Return Value

NdArray

final static NdArray full(array $shape, mixed $value)

Creates a NdArray with a default value

Parameters

array $shape
mixed $value

Return Value

NdArray

final static protected mixed|array createArray(array $params, mixed $value)

Construct a n-dim array with a default value

Parameters

array $params
mixed $value

Return Value

mixed|array

final static NdArray nulls_like(array|NdArray $matrix)

Construct a new array of nulls with the same shape and type as a given array.

Parameters

array|NdArray $matrix

Return Value

NdArray

final static NdArray zeros_like(array|NdArray $matrix)

Construct a new array of zeros with the same shape and type as a given array.

Parameters

array|NdArray $matrix

Return Value

NdArray

final static NdArray ones_like(array|NdArray $matrix)

Construct a new array of ones with the same shape and type as a given array.

Parameters

array|NdArray $matrix

Return Value

NdArray

final static NdArray full_like(array|NdArray $matrix, $value = null)

Construct a new array with the same shape and type as a given array, filled with a given value

Parameters

array|NdArray $matrix
$value

Return Value

NdArray

final static NdArray broadcast_to(array|NdArray $matrix, array $shape)

Broadcast an array to a new shape.

Parameters

array|NdArray $matrix
array $shape

Return Value

NdArray