Skip to content

Amazon Braket Backend

Trevor Grant edited this page Aug 16, 2024 · 1 revision

Amazon Braket Backend

This section covers the usage of the Amazon Braket backend in the QuMat library.

Initialization

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)  

Creating an Empty Circuit

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)  

Applying Gates

To apply different quantum gates, use the following functions:

NOT Gate

from qumat.amazon_braket_backend import apply_not_gate  
  
apply_not_gate(circuit, qubit_index=0)  

Hadamard Gate

from qumat.amazon_braket_backend import apply_hadamard_gate  
  
apply_hadamard_gate(circuit, qubit_index=0)  

CNOT Gate

from qumat.amazon_braket_backend import apply_cnot_gate  
  
apply_cnot_gate(circuit, control_qubit_index=0, target_qubit_index=1)  

Executing the Circuit

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)  

Limitations

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.")