Equana

Back to NDArray Operations

alloc

Allocate an array with the given shape and dtype. Optionally fill with a value.

Syntax

alloc(shape: Tuple, dt: String) → r

Backends

TypeScriptnumwa

Description

Allocate an array with the given shape and dtype. Optionally fill with a value.

Parameters

NameDescription
shapeTuple of dimension sizes
dtElement dtype as string

Returns

New NDArray, zero-initialized or filled with the given value

Examples

Try It
>> alloc((3, 4), "Float64")
Try It
>> alloc((2, 2), "Float64", 1.0)