pyquil.quantum_processor.transformers package¶
Various transformers for quantum processor ISA representations.
- exception pyquil.quantum_processor.transformers.GraphGateError[source]¶
Bases:
ValueErrorSignals an error when creating a
CompilerISAfrom annx.Graph.This may raise as a consequence of unsupported gates.
- exception pyquil.quantum_processor.transformers.QCSISAParseError[source]¶
Bases:
ValueErrorSignals an error when creating a
CompilerISAdue 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.Graphbased 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
CompilerISAobject from a NetworkX graph and list of 1Q and 2Q gates.May raise
GraphGateErrorif 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
InstructionSetArchitectureinto aCompilerISA.
- pyquil.quantum_processor.transformers.qcs_isa_to_graph(isa: InstructionSetArchitecture) Graph[source]¶
Convert a QCS Instruction Set Architecture to a NetworkX graph.