Skip to content

ndArray

ndArrays represent an nth dimensional array that you can perform vectorised operations on.


properties

Buffer : {T}

A flat table containing the array's values.

ndim : number

The dimension number of the array.

Shape : {number}

The table that defines the dimensions of the array.

Strides : {number}

The table that defines how indices get converted into a flat index.

Offset : number

The offset where the first index begins.

type : "ndArray"

The type of the object, this being "ndArray"

dtype : string

The datatype of the values the array is holding.


methods

copy -> ()

ndArray:copy(

): ndArray

creates a new copy of the original ndArray.

view -> ()

ndArray:view(

): ndArray

creates a new view of the original ndArray.

reshape -> ()

ndArray:reshape(
    ... : number
): ndArray

creates a new view of the original ndArray using the arguments provided for the shape.

flatten -> ()

ndArray:flatten(

): ndArray

creates a new view of the original ndArray as a flat array.

eye -> ()

ndArray:eye(

): ndArray

returns the identity matrix of the ndArray.

transpose -> ()

ndArray:transpose(

): ndArray

creates a new view of the original ndArray which is transposed.

item -> ()

ndArray:item(
    ... : number
): ndArray

gets the value from the ndArray using the indices provided. 0d ndArrays will just return the value they're holding.

toflatlist -> ()

ndArray:toflatlist(
    ... : number
): {T}

returns a flat table of elements from the ndArray, with respect to its shape, stride and offset.

swap -> ()

ndArray:swap(
    index1 : number,
    index2 : number,
    axis : number
): ndArray

does a implace swap across an axis between the values at index1 and index2