dimod.AdjVectorBQM.to_numpy_vectors

AdjVectorBQM.to_numpy_vectors(self, variable_order=None, dtype=None, index_dtype=None, sort_indices=False, sort_labels=True, return_labels=False)

Convert binary quadratic model to NumPy vectors.

Parameters
  • variable_order (iterable, optional, default=None) – Variable order for the vector output. By default uses the order of the binary quadratic model.

  • dtype (data-type, optional, default=None) – Desired NumPy data type for the linear biases.

  • index_dtype (data-type, optional, default=None) – Desired NumPy data type for the indices.

  • sort_indices (Boolean, optional, default=False) – If True, sorts index vectors of variables and interactions.

  • sort_labels (Boolean, optional, default=True) – If True, sorts vectors based on variable labels.

  • return_labels (Boolean, optional, default=False) – If True, returns a list of variable labels.

Returns

A tuple containing:

Array of linear biases.

3-tuple of arrays u, v, and b, where the first two are variables that form interactions and the third is the quadratic bias of the interaction.

Offset.

Optionally, variable labels.

Return type

tuple