qsearch.post_processing
¶
This module defines PostProcessor, a class used to modify circuits after they have been synthesized.
Several implementations are provided.
- qsearch.post_processing.BasicSingleQubitReduction_PostProcessor¶
Attempts to remove single-qubit gates without sacrificing the quality of the solution in terms of eval_func
- qsearch.post_processing.ParameterTuning_PostProcessor¶
Attempts to reduce eval_func simply by re-running the solver with stronger parameters.
- qsearch.post_processing.LEAPReoptimizing_PostProcessor¶
Reduces the length of circuits produced using LEAP by re-running segments of the circuit.
Module Contents¶
Classes¶
This class is used to modify circuits that have already been synthesized. |
|
Attempts to reduce the number of single-qubit gates in a circuit by sequentially removing a gate, attempting to use a Solver on it, and keeping that gate removed if successful. |
|
Attempts to reduce the eval_func value of the circuit simply by tuning the parameters better using stronger Solver parameters. |
|
A PostProcessor that re-optimizes LeapCompiler-compiled circuits via search. |
- class qsearch.post_processing.PostProcessor(options=opt.Options())¶
This class is used to modify circuits that have already been synthesized.
- post_process_circuit(self, result, options=None)¶
Processes the circuit dictionary and returns a new one.
- Parameters
result – A dictionary containing a synthesized circuit. Expect it to contain “structure” and “parameters”, but it may contain more, depending on what previous PostProcessors were run and on the compiler.
- Returns
A dictionary containing any updates that should be made to the circuit dictionary, such as new values for “structure” or “parameters” or arbitrary other data.
- Return type
dict
- class qsearch.post_processing.BasicSingleQubitReduction_PostProcessor(options=opt.Options())¶
Bases:
PostProcessor
Attempts to reduce the number of single-qubit gates in a circuit by sequentially removing a gate, attempting to use a Solver on it, and keeping that gate removed if successful.
- post_process_circuit(self, result, options=None)¶
Processes the circuit dictionary and returns a new one.
- Parameters
result – A dictionary containing a synthesized circuit. Expect it to contain “structure” and “parameters”, but it may contain more, depending on what previous PostProcessors were run and on the compiler.
- Returns
A dictionary containing any updates that should be made to the circuit dictionary, such as new values for “structure” or “parameters” or arbitrary other data.
- Return type
dict
- class qsearch.post_processing.ParameterTuning_PostProcessor(options=opt.Options())¶
Bases:
PostProcessor
Attempts to reduce the eval_func value of the circuit simply by tuning the parameters better using stronger Solver parameters.
- post_process_circuit(self, result, options=None)¶
Processes the circuit dictionary and returns a new one.
- Parameters
result – A dictionary containing a synthesized circuit. Expect it to contain “structure” and “parameters”, but it may contain more, depending on what previous PostProcessors were run and on the compiler.
- Returns
A dictionary containing any updates that should be made to the circuit dictionary, such as new values for “structure” or “parameters” or arbitrary other data.
- Return type
dict
- class qsearch.post_processing.LEAPReoptimizing_PostProcessor(options=Options())¶
Bases:
qsearch.compiler.Compiler
,PostProcessor
A PostProcessor that re-optimizes LeapCompiler-compiled circuits via search.
This PostProcessor puts “holes” in the circuit where LEAP fixed prefixes and runs qsearch on those holes to reduce the total number of gates.
- post_process_circuit(self, result, options=None)¶
Re-optimize a LEAP circuit. Pass “depth” to indicate the size to re-synthesize. It is recommended to call like: project.post_process(post_processing.LEAPReoptimizing_PostProcessor(), solver=multistart_solvers.MultiStart_Solver(8), parallelizer=parallelizers.ProcessPoolParallelizer, depth=7)
- compile(self, options=Options())¶
Backwards compatible interface since this is technically a Compiler.
You should use LEAPReoptimizing_PostProcessor.post_process_circuit with the Project post_processing API.