numojo.core.layout.array_methods¶
Array methods (numojo.core.layout.array_methods)
This module defines the NewAxis struct, which is used to represent the insertion of new axes into array shapes,
similar to the concept of None or np.newaxis in NumPy. The NewAxis struct can be used to indicate where
a new singleton dimension should be added to an array, enabling advanced indexing and broadcasting operations.
Example usage: newaxis = NewAxis() # Adds a single new axis newaxis3 = NewAxis(3) # Adds three new axes
Attributes: num (Int): The number of new axes to add. Defaults to 0 (single new axis).
Aliases¶
newaxis¶
Value: NewAxis()
Structs¶
NewAxis¶
Memory convention: memory_only
Implements: AnyType, Copyable, Hashable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, Stringable
Represents a new axis to be inserted into an array's shape.
The NewAxis struct is typically used in advanced indexing to add singleton dimensions
to arrays, facilitating broadcasting and reshaping operations.
Attributes: num (Int): The number of new axes to add.
Fields¶
num(Int)
Aliases¶
__del__is_trivial¶
Value: True
__move_ctor_is_trivial¶
Value: True
__copy_ctor_is_trivial¶
Value: True
Methods¶
__init__¶
Overload 1¶
static
Initializes a NewAxis instance with a default of one new axis.
Sets num to 0, which can be interpreted as a single new axis.
Args:
self(Self)[out]
Returns:
Self
Overload 2¶
static
Initializes a NewAxis instance with a specified number of new axes.
Args:
num(Int): The number of new axes to add.self(Self)[out]
Returns:
Self
__ne__¶
Checks inequality between two NewAxis instances.
Args:
self(Self)other(Self)
Returns:
Bool
__repr__¶
Returns a string representation of the NewAxis instance.
Args:
self(Self)
Returns:
String