-
Notifications
You must be signed in to change notification settings - Fork 2
/
trotter_based_methods.py
43 lines (25 loc) · 1.19 KB
/
trotter_based_methods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import numpy as np
class Trotter_based_methods:
def __init__(self, tools):
self.tools = tools
# qDrift and Trotterization
def calc_qdrift_resources(self, epsilons, p_fail, lambda_value):
epsilon_QPE = epsilons[0]
epsilon_HS = epsilons[1]
epsilon_S = epsilons[2]
deltaE = 2*epsilon_QPE
eps_tot = epsilon_HS
n = (np.pi*lambda_value/deltaE)**2 *(1/eps_tot) * ((1+p_fail)/p_fail)**2 #eq 42 in the original paper
epsilon_SS = epsilon_S/(2*n) # The 2 is due to the control
rot_cost_factor = self.tools.c_pauli_rotation_synthesis(epsilon_SS)
return rot_cost_factor*n
def calc_rand_ham_resources(self, epsilons, p_fail, Lambda_value, Gamma):
epsilon_QPE = epsilons[0]
epsilon_HS = epsilons[1]
epsilon_S = epsilons[2]
deltaE = 2*epsilon_QPE
eps_tot = epsilon_HS
n = 8*Gamma**2 *(np.pi*Lambda_value/(2*deltaE))**(3/2) * (1/eps_tot) * ((1+p_fail)/p_fail)**(3/2) #eq 54 in the original paper
epsilon_SS = epsilon_S/(2*n) # The 2 is due to the control
rot_cost_factor = self.tools.c_pauli_rotation_synthesis(epsilon_SS)
return rot_cost_factor*n