-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cleanup PR #69
Open
JonhasSC
wants to merge
11
commits into
dev
Choose a base branch
from
enhancements/cleanup
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cleanup PR #69
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b87f3fe
new pyLIQTR version
JonhasSC d294571
qchem script cleanup
JonhasSC 29486d9
cleaned up value_per_t_gate and added analytical use case for gsee
JonhasSC 440e394
made change to allow unique file name when performing a sweep
JonhasSC 702812f
responded to issue of improper gate synth accuracy. pyLIQTR handles i…
JonhasSC eb6e2d1
allow trotter to use use_analytical
JonhasSC 68e780e
fix typo
JonhasSC f6f4bce
Updated pylint badge
github-actions[bot] 37ef0d7
doing 1e-10 rther than string
JonhasSC fa5bf28
accidentally scaling num_qubits
JonhasSC 4310ba7
Updated pylint badge
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pyLIQTR == 1.3.0 | ||
pyLIQTR == 1.3.4 | ||
matplotlib | ||
networkx | ||
numpy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,19 @@ | |
from dataclasses import dataclass, field, asdict | ||
|
||
import pandas as pd | ||
|
||
import logging as log | ||
import matplotlib.pyplot as plt | ||
|
||
import cirq | ||
|
||
from pyLIQTR.utils.printing import openqasm | ||
from pyLIQTR.utils.utils import count_T_gates | ||
import pyLIQTR.utils.resource_analysis as pyLRA | ||
import pyLIQTR.utils.global_ancilla_manager as gam | ||
from pyLIQTR.utils.resource_analysis import estimate_resources | ||
from pyLIQTR.utils.circuit_decomposition import circuit_decompose_multi | ||
from pyLIQTR.gate_decomp.cirq_transforms import clifford_plus_t_direct_transform | ||
|
||
|
||
@dataclass | ||
class EstimateMetaData: | ||
id: str | ||
|
@@ -28,6 +29,7 @@ class EstimateMetaData: | |
is_extrapolated: bool=field(default=False, kw_only=True) | ||
gate_synth_accuracy: int | float = field(default=10,kw_only=True) | ||
value_per_circuit: float | None=field(default=None, kw_only=True) | ||
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. are we keeping this as value_per_circuit, or just changing to value? |
||
value_per_t_gate: float | None=field(default=None,kw_only=True) | ||
repetitions_per_application: int | None=field(default=None, kw_only=True) | ||
|
||
@dataclass | ||
|
@@ -390,24 +392,34 @@ def grab_circuit_resources(circuit: cirq.AbstractCircuit, | |
write_circuits=write_circuits, | ||
) | ||
else: | ||
logical_estimates = estimate_resources( | ||
circuit_element=circuit, | ||
rotation_gate_precision=gate_synth_accuracy | ||
) | ||
if gate_synth_accuracy > 1: | ||
log.warning('gate_synth_accuracy is greater than 1. Converting it to 1e-{gate_synth_accuracy}') | ||
gate_synth_accuracy = pow(10, -gate_synth_accuracy) | ||
|
||
logical_estimates = pyLRA.estimate_resources( | ||
circuit, | ||
rotation_gate_precision=gate_synth_accuracy, | ||
profile=False | ||
) | ||
estimates = {'Logical_Abstract':{ | ||
'num_qubits': logical_estimates['LogicalQubits'], | ||
't_count': logical_estimates['T'], | ||
'clifford_count': logical_estimates['Clifford'], | ||
'gate_count': logical_estimates['T'] + logical_estimates['Clifford'], | ||
'subcircuit_occurences': 1, | ||
'subcircuit_info': {} | ||
}} | ||
header = estimates['Logical_Abstract'] | ||
if is_extrapolated: | ||
for resource in header: | ||
header[resource] = scale_resource(header[resource], nsteps, bits_precision) | ||
header['subcircuit_occurences'] = 1 | ||
header['num_qubits'] = logical_estimates['LogicalQubits'] | ||
|
||
header['subcircuit_info'] = {} | ||
|
||
#calculate and insert value_per_t_gate | ||
if metadata != None: | ||
estimates['value_per_t_gate'] = 0 | ||
header = estimates['Logical_Abstract'] | ||
if (metadata.value_per_circuit != None) and (metadata.repetitions_per_application != None): | ||
estimates['value_per_t_gate'] = metadata.value_per_circuit/(estimates.get('Logical_Abstract').get('t_count') * metadata.repetitions_per_application) | ||
metadata.value_per_t_gate = metadata.value_per_circuit/header['t_count'] | ||
|
||
outfile = f'{outdir}{fname}_re.json' | ||
gen_json(estimates, outfile, metadata) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Here, I did some testing with using Trotter for Dynamics, if use_analytical = False, but given both value and reps, the value_per_t_gate is recorded as null. Is this the correct usage?