You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ak...@apache.org on 2025/04/16 17:32:58 UTC

(mahout) branch main updated: Fixing simple_example.py

This is an automated email from the ASF dual-hosted git repository.

akm 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 2a667090d Fixing simple_example.py
2a667090d is described below

commit 2a667090d67cb3923f807f1ff5f090375afc802e
Author: Andrew Musselman <ak...@apache.org>
AuthorDate: Wed Apr 16 10:32:28 2025 -0700

    Fixing simple_example.py
---
 examples/simple_example.py | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/examples/simple_example.py b/examples/simple_example.py
index f2531ab10..bba7b166d 100644
--- a/examples/simple_example.py
+++ b/examples/simple_example.py
@@ -3,24 +3,19 @@ from qumat import QuMat
 
 # Create an instance of QuantumComputer with a specific backend configuration
 backend_config = {
-    'backend_name': 'qiskit_simulator',  # Replace with the actual backend you want to use
+    'backend_name': 'qiskit',  # Replace with the actual backend you want to use
     'backend_options': {
-        'simulator_type': 'qasm_simulator',
+        'simulator_type': 'aer_simulator',
         'shots': 1024  # Number of shots for measurement
     }
 }
 qumat = QuMat(backend_config)
 
 # Create a quantum circuit
-quantum_circuit = qumat.create_empty_circuit(num_qubits=2)
+qumat.create_empty_circuit(num_qubits=2)
 
 # Apply quantum gates to the circuit
-quantum_circuit.apply_hadamard_gate(qubit_index=0)
-quantum_circuit.apply_cnot_gate(control_qubit_index=0, target_qubit_index=1)
-quantum_circuit.apply_pauli_x_gate(qubit_index=0)
-
-# Measure the quantum circuit
-measurement_results = quantum_circuit.measure()
-
-# Display the measurement results
-print("Measurement Results:", measurement_results)
+qumat.apply_hadamard_gate(qubit_index=0)
+qumat.apply_cnot_gate(control_qubit_index=0, target_qubit_index=1)
+qumat.apply_pauli_x_gate(qubit_index=0)
+qumat.execute_circuit()