Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose internal rust interface to DenseLayout (Qiskit#12104)
* Expose internal rust interface to DenseLayout This commit makes a small change to the rust code for DenseLayout that enables calling it more easily from rust. The primary obstacle was the pyfunction used PyReadonlyArray2<f64> inputs which precludes calling it with rust constructed Array2Views<f64>. This adds a new inner public function which takes the array view directly and then the pyfunction's only job is to convert the inputs and outputs to Python. The python side of the function is still building a sparse matrix and then runs reverse Cuthill–McKee to get a permutation of the densest subgraph so any rust consumers will want to keep that in mind (and maybe use sprs to do the same). At the same time it corrects an oversight in the original implementation where the returned numpy arrays of the densest subgraph are copied instead of being returned as references. This should slightly improve performance by eliminating 3 array copies that weren't needed. * Remove PyResult --------- Co-authored-by: Henry Zou <[email protected]>
- Loading branch information