dimod.bqm.adjarraybqm.AdjArrayBQM.from_numpy_vectors

classmethod AdjArrayBQM.from_numpy_vectors(linear, quadratic, offset, vartype, variable_order=None)

Create a binary quadratic model from vectors.

Parameters:
  • linear (array_like) – A 1D array-like iterable of linear biases.
  • quadratic (tuple[array_like, array_like, array_like]) – A 3-tuple of 1D array_like vectors of the form (row, col, bias).
  • offset (numeric, optional) – Constant offset for the binary quadratic model.
  • vartype (Vartype/str/set) –

    Variable type for the binary quadratic model. Accepted input values:

    • Vartype.SPIN, 'SPIN', {-1, 1}
    • Vartype.BINARY, 'BINARY', {0, 1}
  • variable_order (iterable, optional) – If provided, labels the variables; otherwise, indices are used.
Returns:

A binary quadratic model