Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/bloqade/squin/op/stmts.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@
)


class U3(PrimitiveOp):
traits = frozenset({ir.Pure(), lowering.FromPythonCall(), Unitary(), FixedSites(1)})
theta: ir.SSAValue = info.argument(types.Float)
phi: ir.SSAValue = info.argument(types.Float)
lam: ir.SSAValue = info.argument(types.Float)
result: ir.ResultValue = info.result(OpType)


@statement(dialect=dialect)
class PhaseOp(PrimitiveOp):
"""
Expand Down Expand Up @@ -138,6 +146,18 @@
pass


@statement(dialect=dialect)
class CliffordString(ConstantUnitary):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is a CliffordString supposed to represent? PauliString has specific uses like defining a multi-qubit operator for measurement, control, or phase rotation. I am not familiar with "Clifford string".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to represent a product of Clifford operators not just Pauli. But if this is confusing we don't need to have it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clifford include also CX, do we also want product of mixing 2Q and 1Q?

traits = frozenset({ir.Pure(), lowering.FromPythonCall(), Unitary(), HasSites()})
string: str = info.attribute()

def verify(self) -> None:
if not set("XYZHS").issuperset(self.string):
raise ValueError(

Check warning on line 156 in src/bloqade/squin/op/stmts.py

View check run for this annotation

Codecov / codecov/patch

src/bloqade/squin/op/stmts.py#L155-L156

Added lines #L155 - L156 were not covered by tests
f"Invalid Clifford string: {self.string}. Must be a combination of 'X', 'Y', 'Z', 'H', and 'S'."
)


@statement(dialect=dialect)
class X(PauliOp):
pass
Expand Down
7 changes: 7 additions & 0 deletions src/bloqade/squin/qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ class Apply(ir.Statement):
qubits: ir.SSAValue = info.argument(ilist.IListType[QubitType])


@statement(dialect=dialect)
class Broadcast(ir.Statement):
traits = frozenset({lowering.FromPythonCall()})
operator: ir.SSAValue = info.argument(OpType)
qubits: ir.SSAValue = info.argument(ilist.IListType[QubitType])


@statement(dialect=dialect)
class Measure(ir.Statement):
traits = frozenset({lowering.FromPythonCall()})
Expand Down