-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
enhancementNew feature or requestNew feature or requestllm-assistedUsed LLMs to fine tune issue description.Used LLMs to fine tune issue description.transformationRelated to qasm program transformationRelated to qasm program transformation
Description
Feature Description
Implement a.merge() method with automatic unrolling and register consolidation.
- Purpose:
Merge twoQasmModuleobjects into a single module, handling all register consolidation and unrolling transparently. - Consolidation & Unrolling:
- All register consolidation and unrolling is performed automatically during the merge.
- Uses the existing
.unroll(device_qubits)method to ensure both modules are unrolled and consolidated before merging.
- User Experience:
- The user only needs to call
.merge()on one module, passing the other as an argument. - No manual unrolling or consolidation is required.
- The user only needs to call
- Output:
- Returns a new, merged module (preferred for immutability).
- All qubit and classical registers are consolidated into
__PYQASM_QUBITS__and__PYQASM_CLASSICAL__.
Implementation (Optional)
- Unroll and Consolidate Both Modules:
- Call
.unroll(device_qubits=...)on both modules before merging. - If
device_qubitsis not specified, use a default large enough to hold all qubits. - This ensures all registers are consolidated and unrolled.
- Call
- Merge Gates and Operation History:
- Append gates from the second module after the first.
- Combine operation history lists.
- Consolidate the Merged Module (Optional, but Safe):
- If the merge could introduce new registers (unlikely if both are already consolidated), perform a final consolidation.
- This step is mostly redundant but ensures robustness.
- Return the New Module:
- Return a new
QasmModulewith the merged content.
- Return a new
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestllm-assistedUsed LLMs to fine tune issue description.Used LLMs to fine tune issue description.transformationRelated to qasm program transformationRelated to qasm program transformation