-
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.
Allow users to optionally specify Isometry tolerance (#6482)
* Allow users to optionally specify Isometry tolerance Instead of hard-coding a fixed value for floating-point epsilon tolerances, allow users to optionally specify what value of the tolerance they would like to use instead. Fixes #3789 * Added unit tests for custom isometry tolerance * Added release notes for custom isometry tolerance * Fixed lint errors * Update test/python/circuit/test_isometry.py Co-authored-by: Abby Mitchell <abby.mitchell@btinternet.com> Co-authored-by: Luciano Bello <bel@zurich.ibm.com>
- Loading branch information
1 parent
72567d5
commit 5f6db11
Showing
3 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
releasenotes/notes/custom-isometry-tolerance-ee6dcb4cafce9ad4.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,21 @@ | ||
--- | ||
features: | ||
- | | ||
Allowed users to set a custom isometry tolerance. Instead of hard-coding a | ||
fixed value for floating-point epsilon tolerances, allow users to | ||
optionally specify what value of the tolerance they would like to use | ||
instead. For example:: | ||
import numpy as np | ||
from qiskit import QuantumRegister, QuantumCircuit | ||
tolerance = 1e-8 | ||
iso = np.eye(2,2) | ||
num_q_output = int(np.log2(iso.shape[0])) | ||
num_q_input = int(np.log2(iso.shape[1])) | ||
q = QuantumRegister(num_q_output) | ||
qc = QuantumCircuit(q) | ||
qc.isometry(iso, q[:num_q_input], q[num_q_input:], epsilon=tolerance) | ||
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