Skip to content

Commit 56ebadb

Browse files
committed
simplify RE for Sqrt
1 parent 7d71333 commit 56ebadb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

qmath/func/sqrt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _estimate(self, x: SymbolicQFixed):
7373
gidney_lelbows=num_elbows,
7474
gidney_relbows=num_elbows,
7575
toffs=n + 1 + (n % 2),
76-
local_ancillae=2 * x.num_qubits + 1 + 3 * (n % 2) + 3 * r,
76+
local_ancillae=2 * n + 1 + 3 * (n % 2) + r,
7777
active_volume=18.75 * n**2 + (151.5 + 37.5 * (n % 2)) * n + 170.25 * (n % 2) - 225,
7878
)
7979
self.get_qc().add_cost_event(cost)

qmath/func/sqrt_re_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# @pytest.mark.skipif(not RUN_SLOW_TESTS, reason="slow test")
1010
@pytest.mark.parametrize("half_arg", [False, True])
1111
def test_re_sqrt(half_arg: bool):
12-
op = Sqrt(half_arg=False)
12+
op = Sqrt(half_arg=half_arg)
1313
re_symbolic = re_symbolic_fixed_point(op)
1414
re_numeric = lambda assgn: re_numeric_fixed_point(op, assgn)
15-
for n in [5, 6, 7, 20, 21]:
16-
for radix in [0, 1, 2]:
15+
for n in [5, 6] + ([7, 20, 21] if RUN_SLOW_TESTS else []):
16+
for radix in [0, 1] + ([2, 5] if RUN_SLOW_TESTS else []):
1717
verify_re(re_symbolic, re_numeric, {"n": n, "radix": radix})

0 commit comments

Comments
 (0)