-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use "tensorised-Pauli decomposition" in
SparsePauliOp.from_operator
(…
…#11133) * Use "tensorised-Pauli decomposition" in `SparsePauliOp.from_operator` This switches the implementation of `SparsePauliOp.from_operator` to the "tensorised-Pauli decomposition" described in https://arxiv.org/abs/2310.13421. This initial implementation is a relatively naive implementation of the algorithm as described in the paper, with a couple of engineering improvements over the paper's accompaniment at HANTLUK/PauliDecomposition@932ce3926 (i.e. constant-factor improvements, rather than complexity improvements). This makes the "zero check" on the recursions short-circuiting, which means rather matrix elements need to be examined on average after each recursive step. Further, the constant-factor multiplication is tracked separately as a single scalar throughout the recursion to avoid a full-matrix complex multiplication at every recursive step (which is approximately six real-floating-point operations per complex multiplication). There is plenty of space in this implementation to reduce internal memory allocations by reusing swap space, and to dispatch the different components of the decomposition to threaded workers. _Effective_ threading is more non-trivial, as a typical operator will have structure that could be exploiting to more optimally dispatch the threads. These can be investigated later. * Remove unused import * Remove superfluous `num_qubits` argument * Export `ZXPaulis` to Python space * Add comment on array-builder logic * Use `num_traits::Zero` trait for zero checking * Use custom ilog2 * Use stdlib `ilog2`
- Loading branch information
1 parent
e573245
commit 52affa5
Showing
5 changed files
with
231 additions
and
30 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/fast-sparse-pauli-operator-b41cacf11e8c4e0e.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
features: | ||
- | | ||
:meth:`.SparsePauliOp.from_operator` now uses an implementation of the | ||
"tensorized Pauli decomposition algorithm" presented in | ||
Hatznko, Binkowski and Gupta (2023) <https://arxiv.org/abs/2310.13421>`__. The method is now | ||
several orders of magnitude faster; for example, it is possible to decompose a random | ||
10-qubit operator in around 250ms on a consumer Macbook Pro (Intel i7, 2020). |