dimod.bqm.adjarraybqm.AdjArrayBQM.to_numpy_matrix

AdjArrayBQM.to_numpy_matrix(variable_order=None)[source]

Convert a binary quadratic model to NumPy 2D array.

Parameters

variable_order (list, optional) – If provided, indexes the rows/columns of the NumPy array. If variable_order includes any variables not in the binary quadratic model, these are added to the NumPy array.

Returns

The binary quadratic model as a NumPy 2D array. Note that the binary quadratic model is converted to BINARY vartype.

Return type

numpy.ndarray

Note

This method will be deprecated in the future. The preferred pattern is to use to_dense().