buffer
Buffer
¶
Bases: FTyped[BufferFType[FT]], ABC
Abstract base class for buffer-like data structures. Buffers support random access, and can be resized. They are used to store data in a way that allows for efficient reading and writing of elements.
Source code in src/finch/finch_assembly/buffer.py
element_type
property
¶
Return the type of elements stored in the buffer. This is typically the same as the dtype used to create the buffer.
length_type
property
¶
Return the type of indices used to access elements in the buffer. This is typically an integer type.
owner
property
¶
Object retaining the storage, which may change on resize.
Raw pointers must be reacquired after resize. Borrowing implementations retain the previous allocation for existing views when they detach.
length()
abstractmethod
¶
resize(new_len)
abstractmethod
¶
to_numpy(*, copy=None)
abstractmethod
¶
Return logical values as a NumPy array.
copy=True returns independent storage, copy=False requires shared
storage, and copy=None shares storage when supported and copies otherwise.
Source code in src/finch/finch_assembly/buffer.py
BufferFType
¶
Abstract base class for the ftype of arguments. The ftype defines how the data structures store data, and can construct a data structure with the call method.
Source code in src/finch/finch_assembly/buffer.py
length_type(arg)
¶
The length type of the given argument. The length type is the type of the value returned by len(arg).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arg
|
FTyped | FType
|
The object to determine the length type for. |
required |
Returns:
| Type | Description |
|---|---|
FDTypeInteger
|
The length type of the given object. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the length type is not implemented for the given type. |