AnyVector#
- class swordfish._swordfishcpp.AnyVector#
A versatile vector container that can store elements of any type.
Extends the Vector class to allow storage of heterogeneous elements, making it suitable for mixed-type data scenarios.
- classmethod from_list(data)#
Constructs an AnyVector object from a Python list.
- Parameters:
data (list) – The input data as a Python list instance.
- Returns:
A new AnyVector object containing the data from the input list. The elements retain their original types.
- Return type:
- classmethod from_tuple(data)#
Constructs an AnyVector object from a Python tuple.
- Parameters:
data (tuple) – The input data as a Python tuple instance.
- Returns:
A new AnyVector object containing the data from the input tuple. The elements retain their original types.
- Return type:
- classmethod from_numpy(data)#
Constructs an AnyVector object from a NumPy ndarray.
- Parameters:
data (np.ndarray) – The input data as a NumPy ndarray.
- Returns:
A new AnyVector object containing the data from the input ndarray.
- Return type:
- to_numpy()#
Converts the AnyVector to a NumPy ndarray.
- Returns:
A NumPy array containing the data from the AnyVector. The array has dtype=”object” and each element is a Constant.
- Return type:
np.ndarray
- to_list()#
Converts the AnyVector to a Python list.
- Returns:
A Python list containing the data from the AnyVector. Each element in the list is a Constant object.
- Return type:
list