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.

参数:

data (list) -- The input data as a Python list instance.

返回:

A new AnyVector object containing the data from the input list. The elements retain their original types.

返回类型:

AnyVector

classmethod from_tuple(data)#

Constructs an AnyVector object from a Python tuple.

参数:

data (tuple) -- The input data as a Python tuple instance.

返回:

A new AnyVector object containing the data from the input tuple. The elements retain their original types.

返回类型:

AnyVector

classmethod from_numpy(data)#

Constructs an AnyVector object from a NumPy ndarray.

参数:

data (np.ndarray) -- The input data as a NumPy ndarray.

返回:

A new AnyVector object containing the data from the input ndarray.

返回类型:

AnyVector

to_numpy()#

Converts the AnyVector to a NumPy ndarray.

返回:

A NumPy array containing the data from the AnyVector. The array has dtype="object" and each element is a Constant.

返回类型:

np.ndarray

to_list()#

Converts the AnyVector to a Python list.

返回:

A Python list containing the data from the AnyVector. Each element in the list is a Constant object.

返回类型:

list