Gate Chain and Gate Connection¶
-
class
arline_quantum.gate_chain.gate_chain.
AstInterpreter
(gate_chain, hardware_from_qasm)¶ Bases:
object
Interprets an OpenQASM by expanding subroutines and unrolling loops
-
class
arline_quantum.gate_chain.gate_chain.
GateChain
(quantum_hardware)¶ Bases:
object
Gate Chain Class
Parameters: quantum_hardware – Quantum hardware configuration
Variables: -
add_gate
(gate, connections, force_connection=False)¶ Place gate to circuit
Parameters: Raises: NoQubitConnectionError – when there is no connection between qubits
-
add_gate_left
(gate, connections, force_connection=False)¶ Place gate to left end of the circuit
Parameters: Raises: NoQubitConnectionError – when there is no connection between qubits
-
add_subchain
(subchain)¶
-
calculate_cost
()¶
-
calculate_noise
()¶
-
copy
()¶
-
delete_gate
(gate_number)¶
-
delete_subchain
(subchain)¶
-
find_subchain
(subchain)¶
-
static
from_qasm
(input_file, quantum_hardware=None)¶
-
static
from_qasm_list_of_lines
(lines, quantum_hardware=None)¶
-
static
from_qasm_string
(qasm_data, quantum_hardware=None, file_name=None)¶
-
get_depth
()¶
-
get_depth_qubit
()¶
-
get_gate_count
()¶
-
get_gates_by_qubit
(n)¶
-
get_num_gates
()¶
-
get_num_gates_by_gate_type
(gate, gate_num=None)¶
-
get_num_gates_by_qubit
(n)¶
-
insert_gate
(gate, connections, position, force_connection=False)¶ Place gate at a given position
Parameters: Raises: NoQubitConnectionError – when there is no connection between qubits
-
load_chain
(file)¶
-
matrix
¶ Calculate unitary matrix corresponding to the gate chain. Supports lazy matrix calculation, the call of self.matrix will result in recalculation of cashed unitary U = self._matrix. In order to update the cashed unitary after new gates were added to the gate chain we first evaluate the unitary of the appended gates U_new_gates. Then the resulting cashed unitary is the product U_new_gates * U or U * U_new_gates depending on wheather the new gates were appended to the beggining or end of the gate chain.
-
print
()¶
-
save_chain
(file)¶
-
save_to_qasm
(output_dir, qreg_name='q')¶
-
static
string_to_angle
(string)¶ Convert string into angle
-
to_qasm
(qreg_name='q')¶
-