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.

Parameters:
  • 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.

Returns:

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

Return type:

ArrayVector

classmethod from_tuple(data, type=None)#

Constructs an ArrayVector object from a Python tuple.

Parameters:
  • 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.

Returns:

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

Return type:

ArrayVector

classmethod from_numpy(data, type=None)#

Constructs an ArrayVector object from a NumPy ndarray.

Parameters:
  • 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.

Returns:

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

Return type:

ArrayVector

to_numpy()#

Converts the ArrayVector to a NumPy ndarray.

Returns:

A NumPy array with dtype=”object”.

Return type:

np.ndarray

to_list()#

Converts the ArrayVector to a Python list of lists.

Returns:

A Python list where each element is also a list.

Return type:

list