dimod
dimod copied to clipboard
Provide a more informative deprecation message for `to_numpy_matrix` method
Description
The method to_numpy_matrix raises a deprecation warning with the message bqm.to_numpy_matrix() is deprecated since dimod 0.10.0. This note in the bqm.py file suggests to use the to_dense method instead but that method doesn't seem to exist in the code base. It is not clear whether an alternative is available for to_numpy_matrix.
Proposed Solution
Suggest an alternative(if any) to the to_numpy_matrix method with a short code snippet along with the current message.
Hi @AkashNarayanan , I agree. I think there are a few things that should be done
- [ ] Add a docstring
- [ ] Add the method to the docs
- [ ] Add a deprecation note to the docstring showing how to replace it. I.e.
ldata, (irow, icol, qdata), _ = bqm.to_numpy_vectors(variable_order)
dense = np.zeros((bqm.num_variables, bqm.num_variables), dtype=self.dtype)
dense[irow, icol] = qdata
- [ ] Add a note to the warning directing users to the docstring
Is this something that you'd be interested in taking on?
See also https://github.com/dwavesystems/dimod/issues/617