Skip to content

Add state and restored to AllocOp#3017

Open
albi3ro wants to merge 3 commits into
mainfrom
alloc-state
Open

Add state and restored to AllocOp#3017
albi3ro wants to merge 3 commits into
mainfrom
alloc-state

Conversation

@albi3ro

@albi3ro albi3ro commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Context:

In qp.allocate, users can specify whether or not they need the new qubits to be in a zero state with state="zero" or state="any". They can also specify whether or not the qubits are returned to their initial state. This allows dynamically allocated qubits to be reused for another allocation after deallocation.

To be able to replace pennylane.estimator functionality, we need to be able to track the different types of wire allocations.

Description of the Change:

Just adds optional state and restored properties to AllocOp that default to state="zero" and restored=True.

Benefits:

We can start tracking the different types of wire allocations.

Possible Drawbacks:

Related GitHub Issues:

@dime10

dime10 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Adding these might require additional validation in other places (any current users of the alloc op essentially), because in general those mechanisms are not going to be aware of these attributes and won't know what to do with it (likely just ignoring it, otherwise failing). Neither is great, but especially a silent ignore would be bad since it will lead to incorrect results.

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.

2 participants