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.StridedBitArrayView1D class

One-dimensional bit array view with stride information

Provides one-dimensional read-only view on a memory range with custom stride values. See StridedBitArrayView2D, StridedBitArrayView3D, StridedBitArrayView4D, MutableStridedBitArrayView1D and others for multi-dimensional and mutable equivalents.

Memory ownership and reference counting

Similarly to BitArrayView, the view keeps a reference to the original memory owner object in the owner field. Slicing a view creates a new view referencing the same original object, without any dependency on the previous view. The owner is None if the view is empty.

Methods

def broadcasted(self, dimension: int, size: int) -> StridedBitArrayView1D
Broadcast a dimension
def expanded(self, dimension: int, size: tuple[int, int]) -> StridedBitArrayView2D
Expand a dimension
def expanded(self, dimension: int, size: tuple[int, int, int]) -> StridedBitArrayView3D
Expand a dimension
def expanded(self, dimension: int, size: tuple[int, int, int, int]) -> StridedBitArrayView4D
Expand a dimension
def flipped(self, dimension: int) -> StridedBitArrayView1D
Flip a dimension

Special methods

def __getitem__(self, slice: slice) -> StridedBitArrayView1D
Slice the view
def __getitem__(self, i: int) -> bool
Bit at given position
def __init__(self, /) -> None
Default constructor
def __init__(self, view: BitArrayView) -> None
Construct from a bit array view
def __init__(self, view: MutableBitArrayView) -> None
Construct from a bit array view
def __len__(self, /) -> int
View size in the top-level dimension

Properties

dimensions: int get
Dimension count
offset: int get
Bit offset
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.StridedBitArrayView1D.broadcasted(self, dimension: int, size: int) -> StridedBitArrayView1D

Broadcast a dimension

Exceptions
IndexError If dimension is not 0

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

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.StridedBitArrayView1D.expanded(self, dimension: int, size: tuple[int, int, int]) -> StridedBitArrayView3D

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.StridedBitArrayView1D.expanded(self, dimension: int, size: tuple[int, int, int, int]) -> StridedBitArrayView4D

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.StridedBitArrayView1D.flipped(self, dimension: int) -> StridedBitArrayView1D

Flip a dimension

Exceptions
IndexError If dimension is not 0