-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata flags #61
base: dev
Are you sure you want to change the base?
Metadata flags #61
Changes from all commits
65a9c9a
78a1e1c
c70fc74
09ec42e
b34e7ae
3ccc8a4
c479317
a92f6ff
a542f9b
e789e1a
28ebadc
4034414
87843e7
482e069
3f2f51e
9137290
ea86984
ff75ff3
0d68f75
4f9dfc5
c69c316
629ca0a
799a3fd
a2a4da8
6560c79
a390642
53ba80c
11c0bfe
5c0c7b9
39d238e
0e8f986
4e763a1
08c1b1f
df863c0
b2b6df8
94fc9bb
2b04a8f
c6d2ec1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
from pyLIQTR.PhaseEstimation.pe import PhaseEstimation | ||
from networkx import get_node_attributes, draw, draw_networkx_edge_labels | ||
from qca.utils.algo_utils import gsee_resource_estimation | ||
from qca.utils.utils import circuit_estimate, EstimateMetaData | ||
from qca.utils.utils import circuit_estimate, GSEEMetaData | ||
from qca.utils.hamiltonian_utils import generate_two_orbital_nx, nx_to_two_orbital_hamiltonian | ||
|
||
def main(args): | ||
|
@@ -25,25 +25,23 @@ def main(args): | |
value = args.value | ||
repetitions = args.repetitions | ||
circuit_write = args.circuit_write | ||
is_extrapolated= args.extrapolate | ||
|
||
ham = of.fermi_hubbard(lattice_size, lattice_size, tunneling=tunneling, coulomb=coulomb, periodic=False) #returns an aperiodic fermionic hamiltonian | ||
|
||
trotter_order = 2 | ||
trotter_steps = 1 #Using one trotter step for a strict lower bound with this method | ||
|
||
#this scales the circuit depth proportional to 2 ^ bits_precision | ||
bits_precision = estimate_bits_precision(error_precision) | ||
|
||
E_min = -len(ham.terms) * max(abs(tunneling), abs(coulomb)) | ||
E_max = 0 | ||
omega = E_max-E_min | ||
t = 2*np.pi/omega | ||
phase_offset = E_max*t | ||
evolution_time = 2*np.pi/omega | ||
phase_offset = E_max*evolution_time | ||
|
||
gsee_args = { | ||
'trotterize' : True, | ||
'mol_ham' : ham, | ||
'ev_time' : t, | ||
'ev_time' : evolution_time, | ||
'trot_ord' : trotter_order, | ||
'trot_num' : 1 #handling adjustment in resource estimate to save time - scales circuit depth linearly. | ||
} | ||
|
@@ -52,29 +50,35 @@ def main(args): | |
init_state = [0] * lattice_size * lattice_size * 2 #TODO: use Fock state from Hartree-Fock as initial state | ||
|
||
print('starting') | ||
metadata = EstimateMetaData( | ||
metadata = GSEEMetaData( | ||
id=time.time_ns(), | ||
name=name, | ||
category='scientific', | ||
size=f'{lattice_size}x{lattice_size}', | ||
task='Ground State Energy Estimation', | ||
value_per_circuit=value, | ||
repetitions_per_application=repetitions, | ||
implementations=f'GSEE, evolution_time={t}, bits_precision={bits_precision}, trotter_order={trotter_order}', | ||
|
||
evolution_time=evolution_time, | ||
trotter_order=trotter_order, | ||
is_extrapolated=is_extrapolated, | ||
bits_precision=bits_precision, | ||
nsteps=trotter_steps, | ||
) | ||
|
||
print('Estimating one_band') | ||
t0 = time.perf_counter() | ||
estimate = gsee_resource_estimation( | ||
outdir=directory, | ||
numsteps=trotter_steps, | ||
nsteps=trotter_steps, | ||
gsee_args=gsee_args, | ||
init_state=init_state, | ||
precision_order=1, | ||
phase_offset=phase_offset, | ||
bits_precision=bits_precision, | ||
circuit_name=name, | ||
metadata=metadata, | ||
is_extrapolated=is_extrapolated, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see previous comment |
||
write_circuits=args.circuit_write) | ||
t1 = time.perf_counter() | ||
print(f'Time to estimate one_band: {t1-t0}') | ||
|
@@ -96,6 +100,7 @@ def parse_arguments(): | |
parser.add_argument('-v', '--value', type=float, default=0, help='value of the total application') | ||
parser.add_argument('-r', '--repetitions', type=int, default=1, help='repetitions needed to achieve value of computatation (not runs of this script)') | ||
parser.add_argument('-c', '--circuit_write', default=False, action='store_true') | ||
parser.add_argument('-x', '--extrapolate', default=False, action='store_true') | ||
return parser | ||
|
||
if __name__ == "__main__": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
from pyLIQTR.PhaseEstimation.pe import PhaseEstimation | ||
from networkx import get_node_attributes, draw, draw_networkx_edge_labels | ||
from qca.utils.algo_utils import gsee_resource_estimation | ||
from qca.utils.utils import circuit_estimate, EstimateMetaData | ||
from qca.utils.utils import circuit_estimate, GSEEMetaData | ||
from qca.utils.hamiltonian_utils import generate_three_orbital_nx, nx_to_three_orbital_hamiltonian | ||
|
||
## Three band | ||
|
@@ -35,6 +35,7 @@ def main(args): | |
repetitions = args.repetitions | ||
directory = args.directory | ||
name = args.name | ||
is_extrapolated = args.extrapolate | ||
|
||
bits_precision = estimate_bits_precision(args.error_precision) | ||
g = generate_three_orbital_nx(lattice_size,lattice_size) | ||
|
@@ -45,44 +46,50 @@ def main(args): | |
E_min = -len(ham.terms) * max(abs(t1), abs(t2), abs(t3), abs(t4), abs(mu)) | ||
E_max = 0 | ||
omega = E_max-E_min | ||
t = 2*np.pi/omega | ||
phase_offset = E_max*t | ||
evolution_time = 2*np.pi/omega | ||
phase_offset = E_max*evolution_time | ||
|
||
init_state = [0] * n_qubits | ||
|
||
gsee_args = { | ||
'trotterize' : True, | ||
'mol_ham' : ham, | ||
'ev_time' : t, | ||
'ev_time' : evolution_time, | ||
'trot_ord' : trotter_order, | ||
'trot_num' : 1 #Accounted for in a scaling argument later | ||
} | ||
|
||
|
||
print('starting') | ||
|
||
metadata = EstimateMetaData( | ||
metadata = GSEEMetaData( | ||
id=time.time_ns(), | ||
name=name, | ||
category='scientific', | ||
size=f'{lattice_size}x{lattice_size}', | ||
task='Ground State Energy Estimation', | ||
value_per_circuit=value, | ||
repetitions_per_application=repetitions, | ||
implementations=f'GSEE, evolution_time={t}, bits_precision={bits_precision}, trotter_order={trotter_order}', | ||
|
||
evolution_time=evolution_time, | ||
trotter_order=trotter_order, | ||
is_extrapolated=is_extrapolated, | ||
bits_precision=bits_precision, | ||
nsteps=trotter_steps, | ||
) | ||
|
||
print('Estimating Circuit Resources') | ||
t0 = time.perf_counter() | ||
estimate = gsee_resource_estimation( | ||
outdir=directory, | ||
numsteps=trotter_steps, | ||
nsteps=trotter_steps, | ||
gsee_args=gsee_args, | ||
init_state=init_state, | ||
precision_order=1, | ||
phase_offset=phase_offset, | ||
bits_precision=bits_precision, | ||
circuit_name=name, | ||
is_extrapolated = is_extrapolated, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see previous comment |
||
metadata=metadata, | ||
write_circuits=args.circuit_write) | ||
t1 = time.perf_counter() | ||
|
@@ -114,6 +121,7 @@ def parse_arguments(): | |
parser.add_argument('-v', '--value', type=float, default=0, help='value of the total application') | ||
parser.add_argument('-r', '--repetitions', type=int, default=1, help='repetitions needed to achieve value of computatation (not runs of this script)') | ||
parser.add_argument('-c', '--circuit_write', default=False, action='store_true') | ||
parser.add_argument('-x', '--extrapolate', default=False, action='store_true') | ||
return parser | ||
|
||
if __name__ == "__main__": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
from pyLIQTR.PhaseEstimation.pe import PhaseEstimation | ||
from networkx import get_node_attributes, draw, draw_networkx_edge_labels | ||
from qca.utils.algo_utils import gsee_resource_estimation | ||
from qca.utils.utils import circuit_estimate, EstimateMetaData | ||
from qca.utils.utils import circuit_estimate, GSEEMetaData | ||
from qca.utils.hamiltonian_utils import generate_two_orbital_nx, nx_to_two_orbital_hamiltonian | ||
|
||
## Two band | ||
|
@@ -30,6 +30,7 @@ def main(args): | |
repetitions = args.repetitions | ||
directory = args.directory | ||
name = args.name | ||
is_extrapolated=args.extrapolate | ||
|
||
bits_precision = estimate_bits_precision(args.error_precision) | ||
g = generate_two_orbital_nx(lattice_size,lattice_size) | ||
|
@@ -40,44 +41,50 @@ def main(args): | |
E_min = -len(ham.terms) * max(abs(t1), abs(t2), abs(t3), abs(t4), abs(mu)) | ||
E_max = 0 | ||
omega = E_max-E_min | ||
t = 2*np.pi/omega | ||
phase_offset = E_max*t | ||
evolution_time = 2*np.pi/omega | ||
phase_offset = E_max*evolution_time | ||
|
||
init_state = [0] * n_qubits | ||
|
||
gsee_args = { | ||
'trotterize' : True, | ||
'mol_ham' : ham, | ||
'ev_time' : t, | ||
'ev_time' : evolution_time, | ||
'trot_ord' : trotter_order, | ||
'trot_num' : 1 #Accounted for in a scaling argument later | ||
} | ||
|
||
|
||
print('starting') | ||
|
||
metadata = EstimateMetaData( | ||
metadata = GSEEMetaData( | ||
id=time.time_ns(), | ||
name=name, | ||
category='scientific', | ||
size=f'{lattice_size}x{lattice_size}', | ||
task='Ground State Energy Estimation', | ||
value_per_circuit=value, | ||
repetitions_per_application=repetitions, | ||
implementations=f'GSEE, evolution_time={t}, bits_precision={bits_precision}, trotter_order={trotter_order}', | ||
|
||
evolution_time=evolution_time, | ||
trotter_order=trotter_order, | ||
is_extrapolated=is_extrapolated, | ||
bits_precision=bits_precision, | ||
nsteps=trotter_steps, | ||
) | ||
|
||
print('Estimating Circuit Resources') | ||
t0 = time.perf_counter() | ||
estimate = gsee_resource_estimation( | ||
outdir=directory, | ||
numsteps=trotter_steps, | ||
nsteps=trotter_steps, | ||
gsee_args=gsee_args, | ||
init_state=init_state, | ||
precision_order=1, | ||
phase_offset=phase_offset, | ||
bits_precision=bits_precision, | ||
circuit_name=name, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove unused parameter is_extrapolated in this call as well |
||
is_extrapolated=is_extrapolated, | ||
metadata=metadata, | ||
write_circuits=args.circuit_write) | ||
t1 = time.perf_counter() | ||
|
@@ -104,6 +111,7 @@ def parse_arguments(): | |
parser.add_argument('-v', '--value', type=float, default=0, help='value of the total application') | ||
parser.add_argument('-r', '--repetitions', type=int, default=1, help='repetitions needed to achieve value of computatation (not runs of this script)') | ||
parser.add_argument('-c', '--circuit_write', default=False, action='store_true') | ||
parser.add_argument('-x', '--extrapolate', default=False, action='store_true') | ||
return parser | ||
|
||
if __name__ == "__main__": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this comment?