From e3eac1379883b22528573acb577efdcb2019f41a Mon Sep 17 00:00:00 2001 From: Phillip Weinberg Date: Tue, 12 Nov 2024 16:12:01 -0500 Subject: [PATCH] adding back test for location ir. --- src/bloqade/compiler/codegen/python/emulator_ir.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/bloqade/compiler/codegen/python/emulator_ir.py b/src/bloqade/compiler/codegen/python/emulator_ir.py index 914e8daa9..f250a671e 100644 --- a/src/bloqade/compiler/codegen/python/emulator_ir.py +++ b/src/bloqade/compiler/codegen/python/emulator_ir.py @@ -369,6 +369,12 @@ def visit_field_ScaledLocations( self, node: field.ScaledLocations ) -> Dict[int, Decimal]: target_atoms = {} + for location in node.value.keys(): + if location.value >= self.n_sites or location.value < 0: + raise ValueError( + f"Location {location.value} is out of bounds for register with " + f"{self.n_sites} sites." + ) for new_index, original_index in enumerate(self.original_index): value = node.value.get(field.Location(original_index))