Skip to content

Python API Reference

Classes

NumArray

shape property

Returns the shape of the array as a tuple, similar to numpy.ndarray.shape.

__add__(other)

Adds another NumArray or a scalar to the NumArray.

Returns:

Type Description
NumArray

A new NumArray with the result of the addition.

__getitem__(key)

Gets the item(s) at the specified index or slice.

Supports single-axis flipping using slice with step=-1.

Parameters:

Name Type Description Default
key Union[int, slice, Tuple[Any]]

Index, slice, or tuple of indices/slices for access.

required

Returns:

Type Description
Union[List[Any], NumArray]

Single item or a new NumArray with the sliced data.

__imul__(scalar)

In-place multiplication by a scalar.

__init__(data, dtype=None)

Initializes a NumArray object with the given data and data type.

Parameters:

Name Type Description Default
data Union[List[Any], NumArray]

Nested list of numerical data or existing NumArray.

required
dtype Union[None, str]

Data type of the numerical data ('int32', 'int64', 'float32' or 'float64'). If None, dtype is inferred.

None

__matmul__(other)

Implements the @ operator for matrix multiplication.

Parameters:

Name Type Description Default
other NumArray

Another NumArray to compute the matrix multiplication with.

required

Returns:

Type Description
NumArray

A new NumArray containing the result of the matrix multiplication.

__mul__(other)

Multiplies the NumArray by another NumArray or a scalar.

Returns:

Type Description
NumArray

A new NumArray with the result of the multiplication.

__rmatmul__(other)

Implements the @ operator for right matrix multiplication.

Parameters:

Name Type Description Default
other NumArray

Another NumArray to compute the matrix multiplication with.

required

Returns:

Type Description
NumArray

A new NumArray containing the result of the matrix multiplication.

__sub__(other)

Subtracts another NumArray or a scalar from the NumArray.

Returns:

Type Description
NumArray

A new NumArray with the result of the subtraction.

__truediv__(other)

Divides the NumArray by another NumArray or a scalar.

Returns:

Type Description
NumArray

A new NumArray with the result of the division.

concatenate(other, axis)

Concatenates the NumArray with another NumArray along the specified axis.

Parameters:

Name Type Description Default
other NumArray

Another NumArray to concatenate with.

required
axis int

Axis along which to concatenate.

required

Returns:

Type Description
NumArray

A new NumArray containing the concatenated data.

dot(other)

Computes the dot product or matrix multiplication with another NumArray.

Parameters:

Name Type Description Default
other NumArray

Another NumArray to compute the dot product with.

required

Returns:

Type Description
NumArray

A new NumArray containing the result of the dot product or matrix multiplication.

exp()

Computes the exponential of all elements in the NumArray.

Returns:

Type Description
NumArray

A new NumArray with the exponential of all elements.

flip(axis)

Flips the NumArray along the specified axis.

Parameters:

Name Type Description Default
axis Union[int, Sequence[int]]

Axis to flip along.

required

Returns:

Type Description
NumArray

A new NumArray with the flipped data.

log()

Computes the natural logarithm of all elements in the NumArray.

Returns:

Type Description
NumArray

A new NumArray with the natural logarithm of all elements.

matmul(other)

Computes the matrix multiplication with another NumArray, similar to NumPy's matmul.

Parameters:

Name Type Description Default
other NumArray

Another NumArray to compute the matrix multiplication with.

required

Returns:

Type Description
NumArray

A new NumArray containing the result of the matrix multiplication.

max(axis=None)

Return the maximum along the specified axis.

Parameters:

Name Type Description Default
axis Union[None, int, Sequence[int]]

Optional; Axis or axis along which to find the maximum. If None, the maximum of all elements is computed as a scalar.

None

Returns:

Type Description
Union[NumArray, float]

A new NumArray with the maximum values along the specified axis,

Union[NumArray, float]

or a scalar if no axis are given.

mean(axis=None)

Computes the mean of the NumArray along specified axis.

Parameters:

Name Type Description Default
axis Union[None, int, Sequence[int]]

Optional; Axis or axis along which to compute the mean. If None, the mean of all elements is computed as a scalar.

None

Returns:

Type Description
Union[NumArray, float]

A new NumArray with the mean values along the specified axis, or a scalar if no axis are given.

min(axis=None)

Return the minimum along the specified axis.

Parameters:

Name Type Description Default
axis Union[None, int, Sequence[int]]

Optional; Axis or axis along which to find the minimum. If None, the minimum of all elements is computed as a scalar.

None

Returns:

Type Description
Union[NumArray, float]

A new NumArray with the minimum values along the specified axis,

Union[NumArray, float]

or a scalar if no axis are given.

reshape(shape)

Reshapes the NumArray to the specified shape.

Parameters:

Name Type Description Default
shape List[int]

New shape for the NumArray.

required

Returns:

Type Description
NumArray

A new NumArray with the reshaped data.

sigmoid()

Computes the sigmoid of all elements in the NumArray.

Returns:

Type Description
NumArray

A new NumArray with the sigmoid of all elements.

slice(axis, start, stop)

Slices the NumArray along a specified axis.

Parameters:

Name Type Description Default
axis int

Axis to slice.

required
start Union[int, None]

Starting index of the slice.

required
stop Union[int, None]

Stopping index of the slice.

required

Returns:

Type Description
NumArray

A new NumArray with the sliced data.