Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryoris committed Feb 11, 2025
1 parent e67ef50 commit 0ca6b4f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ def __init__(
super().__init__("LinFunction", num_state_qubits + num_compare + 1, [], label=label)

def _define(self):
num_state_qubits = self.num_qubits - 1
num_compare = int(len(self.breakpoints) > 1)
num_state_qubits = self.num_qubits - num_compare - 1

# do rescaling
a, b = self.domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def mapped_coeffs(self) -> List[List[float]]:
Returns:
The mapped coefficients.
"""
print("valled")
return _map_coeffs(self._hom_coeffs)

@property
Expand Down
2 changes: 2 additions & 0 deletions qiskit/synthesis/arithmetic/comparators/compare_greedy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

"""Integer comparator based on 2s complement."""

import numpy as np
from qiskit.circuit import QuantumCircuit


Expand All @@ -29,6 +30,7 @@ def synth_integer_comparator_greedy(

# make sure to always choose the comparison where we have to place less than
# (2 ** n)/2 MCX gates
value = int(np.ceil(value))
if (value < 2 ** (num_state_qubits - 1) and geq) or (
value > 2 ** (num_state_qubits - 1) and not geq
):
Expand Down
10 changes: 4 additions & 6 deletions test/python/circuit/library/test_linear_amplitude_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def evaluate_function(
return np.pi / 4 + np.pi * rescaling_factor / 2 * (normalized - 0.5)

@data(
# (2, 1, 0, (0, 3), (0, 3), 0.1, None),
# (3, 1, 0, (0, 1), (0, 1), 0.01, None),
(2, 1, 0, (0, 3), (0, 3), 0.1, None),
(3, 1, 0, (0, 1), (0, 1), 0.01, None),
(1, [0, 0], [0, 0], (0, 2), (0, 1), 0.1, [0, 1]),
# (2, [1, -1], [0, 1], (0, 2), (0, 1), 0.1, [0, 1]),
# (3, [1, 0, -1, 0], [0, 0.5, -0.5, -0.5], (0, 2.5), (-0.5, 0.5), 0.1, [0, 0.5, 1, 2]),
(2, [1, -1], [0, 1], (0, 2), (0, 1), 0.1, [0, 1]),
(3, [1, 0, -1, 0], [0, 0.5, -0.5, -0.5], (0, 2.5), (-0.5, 0.5), 0.1, [0, 0.5, 1, 2]),
)
@unpack
def test_polynomial_function(
Expand All @@ -116,8 +116,6 @@ def test_polynomial_function(
linear_f = constructor(
num_state_qubits, slope, offset, domain, image, rescaling_factor, breakpoints
)
print(linear_f)
print("anc", num_ancillas)
self.assertFunctionIsCorrect(linear_f, reference, num_ancillas)

def test_not_including_start_in_breakpoints(self):
Expand Down

0 comments on commit 0ca6b4f

Please sign in to comment.