-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get and set diagonal of coo_matrix, and related csgraph laplacian changes #3827
Conversation
Should close #3720. |
Hit the 50min cap with |
By the way, removing the placeholder COO-specific setdiag test causes the base class setdiag test to be run with COO. So superficially this PR looks like it removes a unit test but it actually adds one. |
It passes pep8 but one of the configurations failed to download wheels from pypi. |
Did you push to wrong branch? This PR now contains both setdiag and csgraph changes... |
Right, the csgraph changes use setdiag. |
Also closes #3835 by documenting the |
The code to set the diagonal is so messy because it is required to do things like
|
The coo_matrix.setdiag and coo_matrix.diagonal look good to me. |
@jakevdp: do you want to take a look at the laplacian changes? |
# Update the internal structure. | ||
self.row = np.concatenate((self.row[keep], new_row)) | ||
self.col = np.concatenate((self.col[keep], new_col)) | ||
self.data = np.concatenate((self.data[keep], new_data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to invalidate canonical order here: self.has_canonical_format = False
(now that gh-3646 was merged)
Merged the setdiag/diagonal parts in 62ac546 |
""" Return the Laplacian matrix of a directed graph. | ||
|
||
For non-symmetric graphs the out-degree is used in the computation. | ||
def laplacian(csgraph, normed=False, return_diag=False, use_out_degree=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the default be use_out_degree=True
to preserve the previous behavior claimed in the docstring?
Apart from the in-degree vs out-degree default, this looks ready for merge |
BUG: sparse.csgraph: laplacian fixups
Just checked --- the current behavior matched the previous one. |
No description provided.