Skip to content

Commit

Permalink
Add QuantumCircuit.find_bit to find index and Registers for a Bit. (Q…
Browse files Browse the repository at this point in the history
…iskit/qiskit#6621)

* Add Register.index and Register._bit_indices.

* Add QuantumCircuit.find_bit to find index and Registers for a Bit.

* Add typing information and crossrefs to find_bit

* Revert accidental changes from base

* Add release note.

* Fix formatting in reno

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 28, 2021
1 parent f0b0978 commit c2c6671
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions qiskit_algorithms/linear_solvers/matrices/numpy_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ def __init__(
self._evolution_time = None # makes sure the eigenvalues are contained in [0,1)
self._matrix = None

# store parameters
self.num_state_qubits = int(np.log2(matrix.shape[0]))
self.tolerance = tolerance
self.evolution_time = evolution_time
self.matrix = matrix
super().__init__(
num_state_qubits=int(np.log2(matrix.shape[0])),
tolerance=tolerance,
evolution_time=evolution_time,
name=name,
)

# store parameters
self.num_state_qubits = int(np.log2(matrix.shape[0]))
self.tolerance = tolerance
self.evolution_time = evolution_time
self.matrix = matrix

@property
def num_state_qubits(self) -> int:
r"""The number of state qubits representing the state :math:`|x\rangle`.
Expand Down Expand Up @@ -181,7 +182,6 @@ def _reset_registers(self, num_state_qubits: int) -> None:
"""
qr_state = QuantumRegister(num_state_qubits, "state")
self.qregs = [qr_state]
self._qubits = qr_state[:]

def _build(self) -> None:
"""Build the circuit"""
Expand Down

0 comments on commit c2c6671

Please sign in to comment.