klyn.math.NDArray.ones
method
public static ones(notnull shape as ArrayList<Object>) as NDArray<T>
Description

Creates a new NDArray with ones.

Parameters
ParameterDescription
shapeDimensions as objects converted to integers.
Returns

A new NDArray filled with 1.

Throws
  • NullException if shape is null at runtime; statically null arguments are rejected with TypeError.
Example
dims = [2, 2]
a = NDArray<Int>.ones(dims)
print(a)