ArrayVector#

class swordfish._swordfishcpp.ArrayVector#

A vector container designed to store arrays as its elements.

classmethod from_list(data, type=None)#

Constructs an ArrayVector object from a Python list of arrays.

参数:
  • data (list) -- A list where each element is an array-like object.

  • type (DataType, optional) -- An enumeration value from the DataType enum, specifying the target data type for the array elements. If None, the type will be inferred.

返回:

A new ArrayVector object containing the arrays from the input list.

返回类型:

ArrayVector

classmethod from_tuple(data, type=None)#

Constructs an ArrayVector object from a Python tuple.

参数:
  • data (tuple) -- A tuple where each element is an array-like object.

  • type (DataType, optional) -- An enumeration value from the DataType enum, specifying the target data type for the array elements. If None, the type will be inferred.

返回:

A new ArrayVector object containing the arrays from the input tuple.

返回类型:

ArrayVector

classmethod from_numpy(data, type=None)#

Constructs an ArrayVector object from a NumPy ndarray.

参数:
  • data (np.ndarray) -- A NumPy array.

  • type (DataType, optional) -- An enumeration value from the DataType enum, specifying the target data type for the array elements. If None, the type will be inferred from the NumPy array's dtype.

返回:

A new ArrayVector object containing the arrays from the input NumPy array.

返回类型:

ArrayVector

to_numpy()#

Converts the ArrayVector to a NumPy ndarray.

返回:

A NumPy array with dtype="object".

返回类型:

np.ndarray

to_list()#

Converts the ArrayVector to a Python list of lists.

返回:

A Python list where each element is also a list.

返回类型:

list