frontend.clock package
- class frontend.clock.ClockAdiabaticProgram(num_data: int, num_clock: int, H_init: HamExpr, H_final: HamExpr, total_time: float, time_steps: int)
Bases:
AdiabaticProgram- Parameters:
num_data (int) – The number of data qubits.
num_clock (int) – The number of clock qubits.
... – refer to the parent class
- compile()
Compile the language expression of the Hamiltonians.
- Returns:
The compiled Hamiltonians.
- Return type:
tuple[sp.spmatrix, sp.spmatrix]
- class frontend.clock.ClockFrontend(locality: Literal['3', '5'])
Bases:
FrontendImplement clock translation from Section 3 and 4 from this paper: https://arxiv.org/abs/quant-ph/0405098.
- Parameters:
locality (Literal["3", "5"]) – The locality of the generated Hamiltonian.
- gen_H_clock(n: int, L: int) HamExpr
H_clock, at the bottom of page 10. Adding energy to any two consective clock qubits that are “01”.
- Parameters:
n (int) – number of data qubits.
L (int) – number of clock qubits.
- Returns:
Hamiltonian that ensures legal clock states.
- Return type:
- gen_H_clockinit(n: int, L: int) HamExpr
H_clockinit, at the top of page 11. Adding energy to 1st clock qubit when it is “1”.
- Parameters:
n (int) – number of data qubits.
L (int) – number of clock qubits.
- Returns:
Hamiltonian that ensures that the 1st clock qubit is “0”.
- Return type:
- gen_H_input(n: int, L: int) HamExpr
H_input, at the top of page 11. Adding energy to any data qubit that is “1” while the 1st clock qubit is “0”.
- Parameters:
n (int) – number of data qubits.
L (int) – number of clock qubits.
- Returns:
Hamiltonian that ensures that the input is all “0” when the 1st clock qubit as “0”.
- Return type:
- gen_H_l_sum(n: int, L: int, Us: list[spmatrix]) HamExpr
Sum of H_l, at the middle of page 11. Encoding unitary to corresponding clock state.
- Parameters:
n (int) – number of computational qubits.
L (int) – number of gates.
Us (list[sp.spmatrix]) – List of unitaries.
- Returns:
Hamlitonian that checks that the propagation of the unitaries.
- Return type:
- gen_H_l_sum_part_check_clock(n: int, L: int) HamExpr
Partial sum of H_l, at the middle of page 11. Adding energy to each forward and backward clock state.
- Parameters:
n (int) – number of computational qubits.
L (int) – number of gates.
- Returns:
Hamlitonian that checks the propagation of the clock part.
- Return type:
- gen_H_l_sum_part_unitary(L: int, Us: list[spmatrix]) HamExpr
Partial sum of H_l, at the middle of page 11. Reducing energy of each associated clock state with the unitaries.
- Parameters:
n (int) – number of computational qubits.
L (int) – number of gates.
Us (list[sp.spmatrix]) – List of unitaries.
- Returns:
Hamlitonian that checks that the propagation of the unitaries.
- Return type:
- unitaries_to_program(Us: list[spmatrix]) ClockAdiabaticProgram
Translate a list of unitaries into an adiabatic program.
- Parameters:
Us (list[sp.spmatrix]) – list of unitaries.
- Returns:
The adiabatic program.
- Return type: