pyquil.quantum_processor package¶
Models and functions for working with quantum processors.
- class pyquil.quantum_processor.AbstractQuantumProcessor[source]¶
Bases:
ABC
Interface describing the qubits, topology, and compiler representation of an arbitrary quantum processor.
- abstract qubit_topology() Graph [source]¶
Return a NetworkX graph that represents the connectivity of qubits in this quantum_processor.
- abstract qubits() list[int] [source]¶
Sort the qubits in the quantum_processor topology into a list.
- abstract to_compiler_isa() CompilerISA [source]¶
Construct an ISA suitable for targeting by compilation.
This will raise an exception if the requested ISA is not supported by the quantum_processor.
- class pyquil.quantum_processor.CompilerQuantumProcessor(isa: CompilerISA)[source]¶
Bases:
AbstractQuantumProcessor
An AbstractQuantumProcessor initialized with a user constructed
CompilerISA
.Initialize a CompilerQuantumProcessor with a given
CompilerISA
.- qubit_topology() Graph [source]¶
Return a NetworkX graph that represents the connectivity of qubits in this quantum_processor.
- to_compiler_isa() CompilerISA [source]¶
Return the CompilerISA that this quantum_processor is initialized with.
- class pyquil.quantum_processor.NxQuantumProcessor(topology: Graph, gates_1q: list[str] | None = None, gates_2q: list[str] | None = None)[source]¶
Bases:
AbstractQuantumProcessor
An AbstractQuantumProcessor initialized with a user constructed NetworkX graph topology.
Notably, this class is able to serialize a
CompilerISA
based on the graph topology and the configured 1Q and 2Q gates.Initialize a new NxQuantumProcessor.
- Parameters:
topology – The graph topology of the quantum_processor.
gates_1q – A list of 1Q gate names supported by all qubits in the quantum_processor.
gates_2q – A list of 2Q gate names supported all edges in the quantum_processor.
- qubit_topology() Graph [source]¶
Return the NetworkX graph that represents the connectivity of qubits in this quantum_processor.
- to_compiler_isa() CompilerISA [source]¶
Generate a
CompilerISA
object based on the NetworkX graph,gates_1q
, andgates_2q
.May raise
GraphGateError
if the specified gates are not supported.
- class pyquil.quantum_processor.QCSQuantumProcessor(quantum_processor_id: str, isa: InstructionSetArchitecture, noise_model: NoiseModel | None = None)[source]¶
Bases:
AbstractQuantumProcessor
An AbstractQuantumProcessor initialized with an
InstructionSetArchitecture
returned from the QCS API.Notably, this class is able to serialize a
CompilerISA
based on the architecture instructions.Initialize a new QCSQuantumProcessor.
- Parameters:
quantum_processor_id – The id of the quantum processor.
isa – The QCS API
InstructionSetArchitecture
.noise_model – An optional
NoiseModel
for configuring a noisy quantum_processor on theQVM
.
- noise_model: NoiseModel | None¶
- quantum_processor_id: str¶
- to_compiler_isa() CompilerISA [source]¶
Return a CompilerISA representation of the quantum_processor’s InstructionSetArchitecture.
- pyquil.quantum_processor.get_qcs_quantum_processor(quantum_processor_id: str, client_configuration: QCSClient | None = None, timeout: float = 10.0) QCSQuantumProcessor [source]¶
Retrieve an instruction set architecture for the specified QPU ID and initialize a
QCSQuantumProcessor
with it.- Parameters:
quantum_processor_id – QCS ID for the quantum processor.
timeout – Time limit for request, in seconds.
client_configuration – Optional client configuration. If none is provided, a default one will be loaded.
- Returns:
A
QCSQuantumProcessor
with the requested ISA.
Subpackages¶
- pyquil.quantum_processor.transformers package
GraphGateError
QCSISAParseError
compiler_isa_to_graph()
graph_to_compiler_isa()
qcs_isa_to_compiler_isa()
qcs_isa_to_graph()
- Submodules