pyquil.quantum_processor.transformers package¶
Various transformers for quantum processor ISA representations.
- exception pyquil.quantum_processor.transformers.GraphGateError[source]¶
Bases:
ValueError
Signals an error when creating a
CompilerISA
from annx.Graph
.This may raise as a consequence of unsupported gates.
- exception pyquil.quantum_processor.transformers.QCSISAParseError[source]¶
Bases:
ValueError
Signals an error when creating a
CompilerISA
due to the operators in the QCSInstructionSetArchitecture
.This may raise as a consequence of unsupported gates as well as missing nodes or edges.
- pyquil.quantum_processor.transformers.compiler_isa_to_graph(compiler_isa: CompilerISA) Graph [source]¶
Generate an
nx.Graph
based on the qubits and edges of anyCompilerISA
.
- pyquil.quantum_processor.transformers.graph_to_compiler_isa(graph: Graph, gates_1q: list[str] | None = None, gates_2q: list[str] | None = None) CompilerISA [source]¶
Generate an
CompilerISA
object from a NetworkX graph and list of 1Q and 2Q gates.May raise
GraphGateError
if the specified gates are not supported.- Parameters:
graph – The graph topology of the quantum_processor.
gates_1q – A list of 1Q gate names to be made available for all qubits in the quantum_processor. Defaults to
DEFAULT_1Q_GATES
.gates_2q – A list of 2Q gate names to be made available for all edges in the quantum_processor. Defaults to
DEFAULT_2Q_GATES
.
- pyquil.quantum_processor.transformers.qcs_isa_to_compiler_isa(isa: InstructionSetArchitecture) CompilerISA [source]¶
Transform a QCS
InstructionSetArchitecture
into aCompilerISA
.
- pyquil.quantum_processor.transformers.qcs_isa_to_graph(isa: InstructionSetArchitecture) Graph [source]¶
Convert a QCS Instruction Set Architecture to a NetworkX graph.