Skip to content

CLS-8612: Move res allocation in Qmod tutorial part 2 - #1658

Open
Lior-Preminger wants to merge 1 commit into
mainfrom
CLS-8612-move-allocation-in-qmod-tutorial-part-2-13
Open

Lior-Preminger wants to merge 1 commit into
mainfrom
CLS-8612-move-allocation-in-qmod-tutorial-part-2-13

Conversation

@Lior-Preminger

Copy link
Copy Markdown
Collaborator

Ticket

[CLS-8612] Move allocation in Qmod tutorial part 2 (#13)

What

In Qmod_tutorial_part2.ipynb, the Exercise 10a and 10b solutions allocate res (allocate(5, res)) at the very start of main. This reserves those 5 qubits throughout the aux |= x < 0.5 comparison, inflating the circuit width in the new synthesis flow.

The allocation is moved to just before the control block (right after aux |= x < 0.5). Since res is only first used inside the control block, this is semantically equivalent, but it now lets the synthesizer reuse res's qubits as auxiliaries for the comparison.

The old synthesis flow performed topological ordering and moved this allocation automatically; the new flow does not, so the notebook does it explicitly.

DoD

  • width = 11 in the new flow ✅ (allocation moved so res qubits are freed for the comparison)

🤖 Generated with Claude Code

…art 2

In the Exercise 10 solutions, `allocate(5, res)` was called at the very
start of `main`, keeping those 5 qubits reserved during the
`aux |= x < 0.5` comparison. Moving the allocation to just before the
`control` block lets the synthesizer use res's qubits as auxiliaries for
the comparison. The old flow moved this automatically via topological
ordering; the new flow does not, so it is done explicitly here.

This brings the new-flow width down to 11.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant