-
Notifications
You must be signed in to change notification settings - Fork 1
Make squin identity sites an argument rather than an attribute #480
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
Changes from 2 commits
aece12a
e3e70a8
7dd8729
8ae0042
1413e1e
14fdc40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| from kirin import interp | ||
| from kirin.dialects import scf, func, ilist | ||
| from kirin import ir, interp | ||
| from kirin.dialects import py, scf, func, ilist | ||
| from kirin.dialects.scf.typeinfer import TypeInfer as ScfTypeInfer | ||
|
|
||
| from bloqade.squin import op, wire, noise | ||
|
|
@@ -88,6 +88,23 @@ def pauli_string( | |
| s = stmt.string | ||
| return (NumberSites(sites=len(s)),) | ||
|
|
||
| @interp.impl(op.stmts.Identity) | ||
| def identity( | ||
| self, interp: NSitesAnalysis, frame: interp.Frame, stmt: op.stmts.Identity | ||
| ): | ||
| sites = stmt.sites | ||
|
|
||
| if not isinstance(sites, ir.ResultValue): | ||
| return (interp.lattice.top(),) | ||
|
|
||
| if not isinstance(site_stmt := sites.stmt, py.Constant): | ||
| return (interp.lattice.top(),) | ||
|
|
||
| if not isinstance(value := site_stmt.value, ir.PyAttr): | ||
| return (interp.lattice.top(),) | ||
|
||
|
|
||
| return (NumberSites(sites=value.data),) | ||
|
|
||
|
|
||
| @ilist.dialect.register(key="op.nsites") | ||
| class IListMethods(interp.MethodTable): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.