-
Notifications
You must be signed in to change notification settings - Fork 34
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
Return more info about circuit separation during partitioning #304
base: main
Are you sure you want to change the base?
Changes from all commits
7cc31b0
859f107
af02d47
4b832bb
a98cddc
4f0d2d0
44e65a8
7555463
61bbf19
9a405ce
207b55b
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 |
---|---|---|
|
@@ -72,7 +72,7 @@ def reconstruct_expectation_values( | |
for label, subobservable in observables.items(): | ||
if any(obs.phase != 0 for obs in subobservable): | ||
raise ValueError("An input observable has a phase not equal to 1.") | ||
subobservables_by_subsystem = observables | ||
subobservables_by_subsystem = observables # type: ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is a false positive from mypy. The variable is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://mypy.readthedocs.io/en/stable/generics.html#variance-of-generic-types explains why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, since this is technically correct, this means we have "correct" type hints with respect to |
||
expvals = np.zeros(len(list(observables.values())[0])) | ||
|
||
subsystem_observables = { | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
upgrade: | ||
- | | ||
Introduction of `~circuit_knitting.cutting.CutInfo` class, which contains the decomposition and gate index information for a single cut. | ||
|
||
Removed the ``bases`` field from the :class:`~circuit_knitting.cutting.PartitionedCuttingProblem` class in favor of a ``cuts`` field. Users may now extract the :class:`~circuit_knitting.cutting.qpd.QPDBasis` instances from the ``basis`` field of each `~circuit_knitting.cutting.CutInfo` instance in ``cuts``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,10 @@ def test_v0_2_cutting_width_workflow(): | |
circuit = EfficientSU2(4, entanglement="linear", reps=2).decompose() | ||
circuit.assign_parameters([0.8] * len(circuit.parameters), inplace=True) | ||
observables = PauliList(["ZZII", "IZZI", "IIZZ", "XIXI", "ZIZZ", "IXIX"]) | ||
subcircuits, bases, subobservables = partition_problem( | ||
subcircuits, cuts, subobservables = partition_problem( | ||
circuit=circuit, partition_labels="AABB", observables=observables | ||
) | ||
bases = [cut_info.basis for cut_info in cuts] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is a breaking change, users now need to get each basis from the |
||
assert np.prod([basis.overhead for basis in bases]) == pytest.approx(81) | ||
|
||
samplers = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to support these for wire cutting, but they are not well-handled as of this PR, so this ValueError is appropriate. We can remove it for the wire cutting PR, if necessary