Welcome to Python-flavored Magnum! Please note that, while already being rather stable, this functionality is still considered experimental and some APIs might get changed without preserving full backwards compatibility.

corrade.containers.MutableStridedArrayView1D class

Mutable one-dimensional array view with stride information

Equivalent to StridedArrayView1D, but implementing __setitem__() as well.

Methods

def broadcasted(self, dimension: int, size: int) -> MutableStridedArrayView1D
Broadcast a dimension
def expanded(self, dimension: int, size: tuple[int, int]) -> MutableStridedArrayView2D
Expand a dimension
def expanded(self, dimension: int, size: tuple[int, int, int]) -> MutableStridedArrayView3D
Expand a dimension
def expanded(self, dimension: int, size: tuple[int, int, int, int]) -> MutableStridedArrayView4D
Expand a dimension
def flipped(self, dimension: int) -> MutableStridedArrayView1D
Flip a dimension
def slice_bit(self, index: int) -> MutableStridedBitArrayView1D
Slice to a bit

Special methods

def __buffer__(self, flags, /)
Return a buffer object that exposes the underlying memory of the object.
def __bytes__(self, /) -> bytes
Convert to bytes
def __getitem__(self, slice: slice) -> MutableStridedArrayView1D
Slice the view
def __getitem__(self, i: int) -> object
Value at given position
def __init__(self, /) -> None
Default constructor
def __init__(self, arg0: Buffer, /) -> None
Construct from a buffer
def __len__(self, /) -> int
View size in the top-level dimension
def __release_buffer__(self, buffer, /)
Release the buffer object that exposes the underlying memory of the object.
def __setitem__(self, i: int, value: object) -> None
Set a value at given position

Properties

dimensions: int get
Dimension count
format: str get
Format of each item
owner: object get
Memory owner object
size: tuple[int] get
View size in each dimension
stride: tuple[int] get
View stride in each dimension

Method documentation

def corrade.containers.MutableStridedArrayView1D.broadcasted(self, dimension: int, size: int) -> MutableStridedArrayView1D

Broadcast a dimension

Exceptions
IndexError If dimension is not 0

def corrade.containers.MutableStridedArrayView1D.expanded(self, dimension: int, size: tuple[int, int]) -> MutableStridedArrayView2D

Expand a dimension

Exceptions
IndexError If dimension is not 0
ValueError If product of size is not equal to size in dimension

def corrade.containers.MutableStridedArrayView1D.expanded(self, dimension: int, size: tuple[int, int, int]) -> MutableStridedArrayView3D

Expand a dimension

Exceptions
IndexError If dimension is not 0
ValueError If product of size is not equal to size in dimension

def corrade.containers.MutableStridedArrayView1D.expanded(self, dimension: int, size: tuple[int, int, int, int]) -> MutableStridedArrayView4D

Expand a dimension

Exceptions
IndexError If dimension is not 0
ValueError If product of size is not equal to size in dimension

def corrade.containers.MutableStridedArrayView1D.flipped(self, dimension: int) -> MutableStridedArrayView1D

Flip a dimension

Exceptions
IndexError If dimension is not 0

def corrade.containers.MutableStridedArrayView1D.__getitem__(self, i: int) -> object

Value at given position

Exceptions
IndexError If i is out of range
NotImplementedError If the view was created from a buffer and format is not one of 'b', 'B', 'h', 'H', 'i', 'I', 'q', 'Q', 'f' or 'd'

def corrade.containers.MutableStridedArrayView1D.__setitem__(self, i: int, value: object) -> None

Set a value at given position

Exceptions
IndexError If i is out of range
NotImplementedError If the view was created from a buffer and format is not one of 'b', 'B', 'h', 'H', 'i', 'I', 'q', 'Q', 'f' or 'd'