-
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
Initial register management implementation #176
Merged
rturrado
merged 16 commits into
develop
from
167-initial-register-management-implementation
May 8, 2024
Merged
Initial register management implementation #176
rturrado
merged 16 commits into
develop
from
167-initial-register-management-implementation
May 8, 2024
Conversation
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
…ter-management-implementation # Conflicts: # pyproject.toml
A circuit has a register manager. A register manager holds: - a (virtual) qubit and bit register size and names, - a mapping. A mapping is a dictionary from a (virtual) qubit register to a physical qubit register. Mapping correctness is a class invariant. I.e., it is checked during the construction of the mapping. Remove relabel code. Qubits always hold their (virtual) qubit index. A circuit, through its register manager, holds the current mapping. Writers can get the physical qubit index for a given qubit through the register manager. Remove IR's number of qubits and qubit register name. This information is accessed through the circuit's register manager.
…ation # Conflicts: # opensquirrel/mapper/general_mapper.py # opensquirrel/mapper/simple_mappers.py # opensquirrel/utils/check_passes/check_mapper.py
TODO: check get_matrix_after_qubit_remapping. - Can this code be updated to use the new Mapping class? - Check qubit_remapper, _QubitReIndexer.
juanboschero
previously approved these changes
May 2, 2024
TODO: check get_matrix_after_qubit_remapping. - Can this code be updated to use the new Mapping class? - Check qubit_remapper, _QubitReIndexer.
TODO: check get_matrix_after_qubit_remapping. - Can this code be updated to use the new Mapping class? - Check qubit_remapper, _QubitReIndexer.
juanboschero
previously approved these changes
May 2, 2024
Rename check_valid_replacement to check_gate_replacement. Rename get_matrix_after_qubit_remapping to get_circuit_matrix(get_reindexed_circuit()) Rename qubit_mappings to qubit_indices. Change qubit_reindexer to work with indices instead of qubits.
Update _QubitReindexer to be usable with a whole circuit. Update Circuit.map to perform reindexation according to mapper.get_mapping(). Fix Measure.accept.
juanboschero
requested changes
May 6, 2024
circuit.map always remaps the IR. Add test_qubit_remapper.py. Add test_qubit_reindexer.py.
…ation # Conflicts: # opensquirrel/circuit_builder.py # opensquirrel/exporter/quantify_scheduler_exporter.py # test/exporter/test_quantify_scheduler_exporter.py # test/test_circuit_builder.py # test/test_integration.py # test/test_writer.py
juanboschero
requested changes
May 8, 2024
…isitor methods. Removed _QubitReindexer.comment method.
juanboschero
approved these changes
May 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add
RegisterManager
classA circuit has a register manager.
A register manager only holds, for the moment, a (virtual) qubit and bit register size and names.
The bit register size is set to that of the qubit register.
Add
Mapping
classA mapping is a dictionary from a (virtual) qubit register to a physical qubit register.
Mapping correctness is a class invariant. I.e., it is checked during the construction of the mapping.
Change
relabel
code into_QubitRemapper
_QubitRemapper
implementsSquirrelIRVisitor
to update the qubit indices according to aMapping
.Update
circuit.map
Remove
maq_qubits
free function and renamecircuit.map_qubits
tocircuit.map
(to be consistent withcircuit.decompose
and so on).A mapper is created with a valid mapping and then returns its mapping through
get_mapping()
.circuit.map
invokesremap_ir
with a givenmapper.get_mapping()
, andremap_ir
uses anSquirrelIRVisitor
to update the qubit indices.Remove
SquirrelIR
's number of qubits and qubit register nameThis information is accessed through the circuit's register manager.
Move
_QubitReindexer
code toreindexer/qubit_reindexer.py
.Rename
check_valid_replacement
tocheck_gate_replacement
.Rename
get_matrix_after_qubit_remapping
toget_circuit_matrix(get_reindexed_circuit())
.Rename
qubit_mappings
toqubit_indices
.Add tests for
_QubitReindexer
and_QubitRemapper
.Rename
parser/libqasm/libqasm_ir_creator.py
toparser/libqasm/parser.py
.