This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new b29f38128 Update backend initialization to support legacy simulator
types in AerSimulator (#836)
b29f38128 is described below
commit b29f38128d9f6a768b850a1346edf39476bf7822
Author: Ryan Huang <[email protected]>
AuthorDate: Fri Jan 16 11:45:18 2026 +0800
Update backend initialization to support legacy simulator types in
AerSimulator (#836)
1. Replaced deprecated Aer.get_backend() with AerSimulator(method=...) -
The StatevectorSimulator and other
legacy backends are deprecated in favor of the unified AerSimulator class.
2. Added mapping for legacy simulator types:
- aer_simulator → automatic
- statevector_simulator → statevector
- qasm_simulator → automatic
- unitary_simulator → unitary
3. Removed unused Aer import
---
qumat/qiskit_backend.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/qumat/qiskit_backend.py b/qumat/qiskit_backend.py
index d1dcda208..e4c771870 100644
--- a/qumat/qiskit_backend.py
+++ b/qumat/qiskit_backend.py
@@ -15,14 +15,27 @@
# limitations under the License.
#
import qiskit
-from qiskit_aer import Aer, AerSimulator
+from qiskit_aer import AerSimulator
def initialize_backend(backend_config):
backend_options = backend_config["backend_options"]
simulator_type = backend_options["simulator_type"]
shots = backend_options["shots"]
- backend = Aer.get_backend(simulator_type)
+
+ # Map legacy simulator types to AerSimulator methods
+ simulator_methods = {
+ "aer_simulator": "automatic",
+ "statevector_simulator": "statevector",
+ "qasm_simulator": "automatic",
+ "unitary_simulator": "unitary",
+ }
+
+ if simulator_type in simulator_methods:
+ backend = AerSimulator(method=simulator_methods[simulator_type])
+ else:
+ backend = AerSimulator(method=simulator_type)
+
backend.shots = shots
return backend