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: 19 additions & 1 deletion src/bloqade/pyqrack/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,28 @@
isOpenCL: bool


def _validate_pyqrack_options(options: PyQrackOptions) -> None:
if options["isBinaryDecisionTree"] and options["isStabilizerHybrid"]:
raise ValueError(

Check warning on line 31 in src/bloqade/pyqrack/base.py

View check run for this annotation

Codecov / codecov/patch

src/bloqade/pyqrack/base.py#L31

Added line #L31 was not covered by tests
"Cannot use both isBinaryDecisionTree and isStabilizerHybrid at the same time."
)
elif options["isTensorNetwork"] and options["isBinaryDecisionTree"]:
raise ValueError(

Check warning on line 35 in src/bloqade/pyqrack/base.py

View check run for this annotation

Codecov / codecov/patch

src/bloqade/pyqrack/base.py#L35

Added line #L35 was not covered by tests
"Cannot use both isTensorNetwork and isBinaryDecisionTree at the same time."
)
elif options["isTensorNetwork"] and options["isStabilizerHybrid"]:
raise ValueError(

Check warning on line 39 in src/bloqade/pyqrack/base.py

View check run for this annotation

Codecov / codecov/patch

src/bloqade/pyqrack/base.py#L39

Added line #L39 was not covered by tests
"Cannot use both isTensorNetwork and isStabilizerHybrid at the same time."
)


def _default_pyqrack_args() -> PyQrackOptions:
return PyQrackOptions(
qubitCount=-1,
isTensorNetwork=False,
isSchmidtDecomposeMulti=True,
isSchmidtDecompose=True,
isStabilizerHybrid=True,
isStabilizerHybrid=False,
isBinaryDecisionTree=True,
isPaged=True,
isCpuGpuHybrid=True,
Expand All @@ -45,6 +60,9 @@
pyqrack_options: PyQrackOptions = field(default_factory=_default_pyqrack_args)
sim_reg: "QrackSimulator" = field(init=False)

def __post_init__(self):
_validate_pyqrack_options(self.pyqrack_options)

@abc.abstractmethod
def allocate(self, n_qubits: int) -> tuple[int, ...]:
"""Allocate `n_qubits` qubits and return their ids."""
Expand Down
4 changes: 3 additions & 1 deletion test/pyqrack/test_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def multiple_registers():

return q1

target = PyQrack(6)
target = PyQrack(
6, pyqrack_options={"isBinaryDecisionTree": False, "isStabilizerHybrid": True}
)
q1 = target.run(multiple_registers)

assert isinstance(q1, ilist.IList)
Expand Down