Skip to content

Commit

Permalink
Change num of qubits in Estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
hitomitak committed Aug 25, 2023
1 parent 7e5472e commit 9366882
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion qiskit_aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
BASIS_GATES,
)

# pylint: disable=import-error, no-name-in-module
# pylint: disable=import-error, no-name-in-module, abstract-method
from .controller_wrappers import aer_controller_execute

logger = logging.getLogger(__name__)
Expand Down
32 changes: 1 addition & 31 deletions qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from .backend_utils import format_save_type, circuit_optypes
from .name_mapping import NAME_MAPPING

# pylint: disable=import-error, no-name-in-module
# pylint: disable=import-error, no-name-in-module, abstract-method
from .controller_wrappers import AerConfig

# Logger
Expand Down Expand Up @@ -356,36 +356,6 @@ def target(self):
)
return self._target

@property
def dtm(self):
if hasattr(self.configuration(), "dtm"):
return self.configuration().dtm
else:
return None

@property
def meas_map(self):
if hasattr(self.configuration(), "meas_map"):
return self.configuration().meas_map
else:
return None

def acquire_channel(self):
return None

def control_channel(self):
return None

def drive_channel(self):
return None

def measure_channel(self):
return None

@classmethod
def _default_options(cls):
pass

def clear_options(self):
"""Reset the simulator options to default values."""
self._options = self._default_options()
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
map_legacy_method_config,
)

# pylint: disable=import-error, no-name-in-module
# pylint: disable=import-error, no-name-in-module, abstract-method
from .controller_wrappers import aer_controller_execute

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/backends/statevector_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
add_final_save_op,
)

# pylint: disable=import-error, no-name-in-module
# pylint: disable=import-error, no-name-in-module, abstract-method
from .controller_wrappers import aer_controller_execute

# Logger
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/backends/unitary_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
map_legacy_method_config,
)

# pylint: disable=import-error, no-name-in-module
# pylint: disable=import-error, no-name-in-module, abstract-method
from .controller_wrappers import aer_controller_execute

# Logger
Expand Down
7 changes: 6 additions & 1 deletion qiskit_aer/primitives/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ def _create_meas_circuit(self, basis: Pauli, circuit_index: int):
return meas_circuit
transpile_opts = copy(self._transpile_options)
transpile_opts.update_options(initial_layout=self._layouts[circuit_index])
return transpile(meas_circuit, self._backend, **transpile_opts.__dict__)

_num_qubits = self._backend.num_qubits
self._backend.set_option("n_qubits", meas_circuit.num_qubits)
new_circ = transpile(meas_circuit, self._backend, **transpile_opts.__dict__)
self._backend.set_option("n_qubits", _num_qubits)
return new_circ

@staticmethod
def _combine_circs(circuit: QuantumCircuit, meas_circuits: list[QuantumCircuit]):
Expand Down

0 comments on commit 9366882

Please sign in to comment.