Skip to content
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

feat!: Use inout for pytket circuits #500

Merged
merged 38 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3c3f157
feat!: Support implicit modules for all decorators and turn builtins …
mark-koch Sep 11, 2024
fcf6984
Lints
mark-koch Sep 11, 2024
359c1fc
Fix test
mark-koch Sep 11, 2024
2b21a44
Fix more tests
mark-koch Sep 11, 2024
d25dab1
Fix test
mark-koch Sep 12, 2024
6f6a564
Merge remote-tracking branch 'origin/main' into feat/implicit-decorators
mark-koch Sep 12, 2024
faa5b64
feat!: Add functions to quantum module and make quantum_functional in…
mark-koch Sep 13, 2024
d99d694
Fix tket tests
mark-koch Sep 13, 2024
f5cff19
Merge remote-tracking branch 'origin/main' into feat/quantum-module
mark-koch Sep 13, 2024
6d869e4
Merge remote-tracking branch 'origin/feat/quantum-module' into feat/i…
mark-koch Sep 13, 2024
37162f9
Fix tests
mark-koch Sep 13, 2024
9287b39
Fmt
mark-koch Sep 13, 2024
f24183d
Fix test
mark-koch Sep 13, 2024
f9aaaa9
fix: Fix implicit imports in notebooks
mark-koch Sep 13, 2024
b65f837
feat: Only lower definitions to Hugr if they are used
mark-koch Sep 13, 2024
ee4cdd9
feat!: Use inout for pytket circuits
mark-koch Sep 15, 2024
133888f
tweak comment
acl-cqc Sep 16, 2024
3f04c01
quantum.py import only no_type_check from typing
acl-cqc Sep 16, 2024
fc29e84
fix: Fix implicit imports in notebooks (#495)
mark-koch Sep 16, 2024
2f70db7
Merge remote-tracking branch 'origin/main' into HEAD
acl-cqc Sep 16, 2024
17b5647
Merge 'origin/main' including 'feat/quantum-module' into HEAD
acl-cqc Sep 16, 2024
d4532ac
Add @overloads to help document _with_optional_module; use Decorator …
acl-cqc Sep 16, 2024
e3c4453
fix overloads, oops, and type-ignore, heh
acl-cqc Sep 16, 2024
15e5c48
Pull stuff out of loop in _get_python_caller
acl-cqc Sep 16, 2024
bafadfe
assert discarded buffer is empty
acl-cqc Sep 16, 2024
8f75828
make assert mypy-ok
acl-cqc Sep 16, 2024
6265442
Merge commit 'fc29e84070c2b6e01d76eada14bd41f581dae483' into fix/note…
acl-cqc Sep 16, 2024
a2579a2
Merge remote-tracking branch 'origin/feat/implicit-decorators' into f…
acl-cqc Sep 16, 2024
9944f07
Merge commit 'cc8a424ad9a8b8c3c5a3b5cc700ccdb7a5ff8fa9' into fix/note…
acl-cqc Sep 16, 2024
51e7f9b
Merge branch 'fix/notebook-imports' into feat/lower-used
acl-cqc Sep 16, 2024
c2b7489
Remove required by requesting compilation
acl-cqc Sep 16, 2024
860c552
comment re. adding to worklist
acl-cqc Sep 16, 2024
a0ce98c
fmt
acl-cqc Sep 16, 2024
d18b805
rm _compile_defs
acl-cqc Sep 16, 2024
a9ca64e
remove unused Definition.compile
doug-q Sep 17, 2024
232571c
lint
doug-q Sep 17, 2024
fbc6030
Merge remote-tracking branch 'origin/main' into HEAD
acl-cqc Sep 17, 2024
7512257
Merge (feat/lower-used == PR#496 on main) into HEAD
acl-cqc Sep 17, 2024
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
6 changes: 2 additions & 4 deletions guppylang/checker/expr_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,10 +1124,8 @@ def python_value_to_guppy_type(v: Any, node: ast.expr, globals: Globals) -> Type
[], globals
)
return FunctionType(
[FuncInput(qubit, InputFlags.NoFlags)] * v.n_qubits,
row_to_type(
[qubit] * v.n_qubits + [bool_type()] * v.n_bits
),
[FuncInput(qubit, InputFlags.Inout)] * v.n_qubits,
row_to_type([bool_type()] * v.n_bits),
)
except ImportError:
raise GuppyError(
Expand Down
5 changes: 2 additions & 3 deletions guppylang/compiler/expr_compiler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ast
import json
from collections.abc import Iterable, Iterator, Sequence
from contextlib import contextmanager
from typing import Any, TypeGuard, TypeVar
Expand All @@ -8,7 +7,7 @@
import hugr.std.float
import hugr.std.int
import hugr.std.logic
from hugr import Wire, ops
from hugr import Hugr, Wire, ops
from hugr import tys as ht
from hugr import val as hv
from hugr.build.cond_loop import Conditional
Expand Down Expand Up @@ -564,7 +563,7 @@ def python_value_to_hugr(v: Any, exp_ty: Type) -> hv.Value | None:
Tk2Circuit,
)

circ = json.loads(Tk2Circuit(v).to_hugr_json()) # type: ignore[attr-defined, unused-ignore]
circ = Hugr.load_json(Tk2Circuit(v).to_hugr_json()) # type: ignore[attr-defined, unused-ignore]
return hv.Function(circ)
except ImportError:
pass
Expand Down
Loading