classmethod DiscreteQuadraticModel.from_numpy_vectors(case_starts, linear_biases, quadratic, labels=None)[source]

Construct a DQM from five numpy vectors.

Parameters
• case_starts (array-like) – A length num_variables() array. The cases associated with variable v are in the range [case_starts[v], cases_starts[v+1]).

• linear_biases (array-like) – A length num_cases() array. The linear biases.

A three tuple containing:

• irow: A length num_interactions() array. If the case interactions were defined in a sparse matrix, these would be the row indices.

• icol: A length num_interactions() array. If the case interactions were defined in a sparse matrix, these would be the column indices.

• quadratic_biases: A length num_interactions() array. If the case interactions were defined in a sparse matrix, these would be the values.

• labels (list, optional) – The variable labels. Defaults to index-labeled.

Example

>>> dqm = dimod.DiscreteQuadraticModel()