data classes module
- class data_classes.LinkedList(input_array, linked_array=None)[source]
Bases:
ndarrayNumPy ndarray subclass that keeps a second “linked” array in sync for element-wise updates and structural operations (sort, delete, reshape).
- linked_array
Secondary array kept in sync with the primary array.
- Type:
array_like or None
- sync_delete(index)[source]
Delete items by index in both arrays and return a new object when a linked_array is present.
- sync_reshape(size)[source]
Reshape both arrays consistently and return a new object when a linked_array is present.
- sync_delete(index)[source]
Delete the specified index/indices from the array and its linked array.
- Parameters:
index (int, slice, or array_like) – Indices to remove. Passed to
np.delete.- Returns:
A new LinkedList with the specified entries removed when a linked_array is present; otherwise, a regular ndarray.
- Return type:
LinkedList or ndarray
- sync_reshape(size)[source]
Reshape both the array and the linked array to the specified size.
- Parameters:
size (tuple of int) – New shape to apply to both arrays. Must be compatible with the number of elements.
- Returns:
A new LinkedList if a linked_array exists; otherwise, a regular ndarray.
- Return type:
LinkedList or ndarray
- sync_sort()[source]
Sort the array in ascending order and apply the same permutation to the linked array.
- Returns:
In-place operation; no return value.
- Return type:
None
- sync_split(indices_or_sections, axis=0)[source]
Split both the array and the linked array into multiple sub-arrays.
- Parameters:
indices_or_sections (int or 1-D array_like) – If an integer, it indicates the number of equal splits to make. If an array, it indicates the indices at which to split.
axis (int, optional) – Axis along which to split. Default is 0.
- Returns:
A list of LinkedList objects if a linked_array exists; otherwise, a list of regular ndarray arrays.
- Return type:
list of LinkedList or ndarray