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

Add circuit cutting API references to Sphinx build #57

Merged
merged 1 commit into from
Nov 9, 2022
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
8 changes: 8 additions & 0 deletions circuit_knitting_toolbox/circuit_cutting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@
.. autosummary::
:toctree: ../stubs/
:nosignatures:

wire_cutting.run_subcircuit_instances
wire_cutting.generate_summation_terms
wire_cutting.build
wire_cutting.verify
wire_cutting.cut_circuit_wires
wire_cutting.evaluate_subcircuits
wire_cutting.reconstruct_full_distribution
"""
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def cut_circuit_wires(
- max_subcircuit_size (int, optional): max number of gates in a subcircuit
- verbose (bool, optional): flag for printing output of cutting
Returns:
- (Dict[str, Any]): A dictionary containing information on the cuts,
including the subcircuits themselves (key: 'subcircuits')
(Dict[str, Any]): A dictionary containing information on the cuts,
including the subcircuits themselves (key: 'subcircuits')
Raises:
- ValueError: if the input method does not match the other provided arguments
"""
Expand Down Expand Up @@ -94,8 +94,8 @@ def evaluate_subcircuits(
- options (Union[Options, Sequence[Options]]): Options to use on each backend
- backend_names (Union[str, Sequence[str]]): The name(s) of the backend(s) to be used
Returns:
- (Dict): the dictionary containing the results from running
each of the subcircuits
(Dict): the dictionary containing the results from running
each of the subcircuits
"""
# Put backend_names and options in lists to ensure it is unambiguous how to sync them
backends_list: Sequence[str] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ def generate_summation_terms(

Final CutQC reconstruction result = Sum(summation_terms).

summation_terms (list) : [summation_term_0, summation_term_1, ...] --> 4^#cuts elements.
summation_terms (list): [summation_term_0, summation_term_1, ...] --> 4^#cuts elements.

summation_term[subcircuit_idx] = subcircuit_entry_idx.
E.g. summation_term = {0:0,1:13,2:7} = Kron(subcircuit_0_entry_0, subcircuit_1_entry_13, subcircuit_2_entry_7).
| summation_term[subcircuit_idx] = subcircuit_entry_idx.
| E.g. summation_term = {0:0,1:13,2:7} = Kron(subcircuit_0_entry_0, subcircuit_1_entry_13, subcircuit_2_entry_7).

subcircuit_entries[subcircuit_idx][init_label,meas_label] = subcircuit_entry_idx, kronecker_term.
kronecker_term (list): (coefficient, subcircuit_instance_idx).
Add coefficient*subcircuit_instance to subcircuit_entry.
| subcircuit_entries[subcircuit_idx][init_label,meas_label] = subcircuit_entry_idx, kronecker_term.
| kronecker_term (list): (coefficient, subcircuit_instance_idx).
| Add coefficient*subcircuit_instance to subcircuit_entry.

subcircuit_instances[subcircuit_idx][init,meas] = subcircuit_instance_idx.

Expand All @@ -253,6 +253,9 @@ def generate_summation_terms(
- num_cuts (int): the number of cuts

Returns:
a tuple
containing:

- (dict): dictionary containing information on the summation terms
- (dict): dictionary containing the subcircuits entry information
- (dict): dictionary containing subcircuit instances
Expand Down Expand Up @@ -398,8 +401,11 @@ def build(
- num_threads (int): the number of threads to use for multithreading

Returns:
a tuple
containing:

- (NDArray): the reconstructed probability distribution of the full
circuit
circuit
- (list): the ordering of the distribution
- (dict): the computational post-processing overhead
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ def verify(
execution of the subcircuits

Returns:
- (dict): a dictionary containing a variety of distributional difference metrics for the
ground truth and reconstructed distributions
- (Sequence[float]): the true probability distribution of the full circuit
a tuple
containing:

- a dictionary containing a variety of distributional difference
metrics for the ground truth and reconstructed distributions; and,
- the true probability distribution of the full circuit
"""
ground_truth = _evaluate_circuit(circuit=full_circuit)
metrics = {}
Expand Down