Skip to content

Commit

Permalink
Merge pull request #43 from isi-usc-edu/max-radin/lre-fixed-overlap
Browse files Browse the repository at this point in the history
Fixing bug when using constant overlaps
  • Loading branch information
bellonzi authored Dec 10, 2024
2 parents b91e81c + 72729e0 commit accd5f1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/compute_all_LREs_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def get_lqre(
overlaps = {
row["task_uuid"]: row["overlap"] for index, row in overlap_df.iterrows()
}
else:
overlaps = defaultdict(lambda: config["algorithm_parameters"]["overlap"])

solution_data: list[dict[str, Any]] = []
results: dict[str, Any] = {}

for task in problem_instance["tasks"]:
if not overlaps.get(task["task_uuid"]):
if not config["algorithm_parameters"].get("overlap") and not overlaps.get(
task["task_uuid"]
):
logging.info(
f"Skipping task {task['task_uuid']} because no overlap was provided."
)
Expand Down Expand Up @@ -116,7 +116,7 @@ def get_lqre(
)

num_orbitals = fci["H1"].shape[0]
if num_orbitals >= config["algorithm_parameters"]["max_orbitals"]:
if num_orbitals > config["algorithm_parameters"]["max_orbitals"]:
logging.info(
f"Skipping Logical Resource Estimate because number of orbitals ({num_orbitals}) exceeds maximum specified in config ({config['algorithm_parameters']['max_orbitals']})."
)
Expand All @@ -128,6 +128,11 @@ def get_lqre(
error_tolerance = task["requirements"]["accuracy"]
failure_tolerance = 1 - task["requirements"]["probability_of_success"]

overlap = (
config["algorithm_parameters"].get("overlap")
if config["algorithm_parameters"].get("overlap")
else overlaps.get(task["task_uuid"])
)
circuit_generation_start_time = datetime.datetime.now()
(
circuit,
Expand All @@ -137,7 +142,7 @@ def get_lqre(
fci=fci,
error_tolerance=error_tolerance,
failure_tolerance=failure_tolerance,
square_overlap=overlaps[task["task_uuid"]] ** 2,
square_overlap=overlap**2,
df_threshold=config["algorithm_parameters"]["df_threshold"],
)
circuit_generation_end_time = datetime.datetime.now()
Expand Down

0 comments on commit accd5f1

Please sign in to comment.