-
Notifications
You must be signed in to change notification settings - Fork 945
Amazon Braket Backend
Trevor Grant edited this page Aug 16, 2024
·
1 revision
This section covers the usage of the Amazon Braket backend in the QuMat library.
To initialize the Amazon Braket backend, use the initialize_backend
function. This function accepts a backend_config
dictionary.
from qumat.amazon_braket_backend import initialize_backend
backend_config = {
'backend_options': {
'simulator_type': 'default'
}
}
backend = initialize_backend(backend_config)
To create an empty circuit, use the create_empty_circuit
function
from qumat.amazon_braket_backend import create_empty_circuit
circuit = create_empty_circuit(num_qubits=2)
To apply different quantum gates, use the following functions:
from qumat.amazon_braket_backend import apply_not_gate
apply_not_gate(circuit, qubit_index=0)
from qumat.amazon_braket_backend import apply_hadamard_gate
apply_hadamard_gate(circuit, qubit_index=0)
from qumat.amazon_braket_backend import apply_cnot_gate
apply_cnot_gate(circuit, control_qubit_index=0, target_qubit_index=1)
To execute the circuit, use the execute_circuit function.
from qumat.amazon_braket_backend import execute_circuit
result = execute_circuit(circuit, backend, backend_config)
print(result)
Currently, the function get_final_state_vector is not implemented for the Amazon Braket backend.
def get_final_state_vector(circuit, backend, backend_config):
raise NotImplementedError("Final state vector calculation is not currently supported with Amazon Braket.")