-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add a method to make a graph from a complex matrix #411
Comments
So I have a draft locally implementing this but the only thing in your example which I will not able to do is reproduce the types in the output edge list. In your example for the real numbers they're floats in the output weight list, but when retworkx looks at the underlying numpy array it will see a 3x3 array Other than that the PR is ready to go however unfortunately it's blocked on PyO3/pyo3#1798 and won't work yet. I will push it up as a WIP for the time being (and it'll fail on the msrv tests). So unfortunately I don't think this will make 0.10.0 as it's blocked on a pyo3 release. |
This commit adds a new constructor method from_complex_adjacency_matrix that will build a new graph from an adjacency matrix with complex elements. Fixes Qiskit#411
This commit adds a new constructor method from_complex_adjacency_matrix that will build a new graph from an adjacency matrix with complex elements. Fixes Qiskit#411
Thank you for the quick response. Having the output type |
This commit adds a new constructor method from_complex_adjacency_matrix that will build a new graph from an adjacency matrix with complex elements. Fixes Qiskit#411
* Add from complex matrix function This commit adds a new constructor method from_complex_adjacency_matrix that will build a new graph from an adjacency matrix with complex elements. Fixes #411 * Make from_adjacency_matrix generic and add PyGraph version This commit updates the implementation of the from_adjacency_matrix() functions to have a shared generic private function to be shared across the per type variants. To accomplish this the IsNan trait from rust nightly is copied into retworkx (so we can build with stable rust). If in the future if an int type variant is added we'll need to implement this trait for the int type (and just return false). Co-authored-by: georgios-ts <[email protected]> * Add tests * Add release notes * Fix copy paste issues in do strange Co-authored-by: georgios-ts <[email protected]> * Remove unused Zero trait bound on generic function * Iterate over enumerate elements instead of index range Co-authored-by: georgios-ts <[email protected]> Co-authored-by: georgios-ts <[email protected]>
What is the expected enhancement?
Add a method like
from_complex_adjacency_matrix
, for makiing a graph from an adjacency matrix whose elements can be complex values.I expect this method to work as follows:
output:
When the input matrix is not symmetric, it may be convenient to make a graph from the elements of the upper triangular part of it, similar to
from_adjacency_matrix
.The text was updated successfully, but these errors were encountered: