pyquil.external.rpcq module

Models and functions that support the use of the quilc rpcq server.

class pyquil.external.rpcq.CompilerISA(qubits: dict[str, ~pyquil.external.rpcq.Qubit] = <factory>, edges: dict[str, ~pyquil.external.rpcq.Edge] = <factory>)[source]

Bases: object

CompilerISA class for representing the instruction set architecture of a quantum processor.

dict(by_alias=False)[source]

Return a dictionary representation of the CompilerISA.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

edges: dict[str, Edge]
classmethod parse_file(filename: str)[source]

Parse a JSON file into a CompilerISA object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into a CompilerISA object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

qubits: dict[str, Qubit]
class pyquil.external.rpcq.Edge(ids: list[int], dead: bool | None = False, gates: list[~pyquil.external.rpcq.GateInfo] = <factory>)[source]

Bases: object

Edge class for representing a connection between two qubits.

dead: bool | None = False
dict()[source]

Return a dictionary representation of the Edge.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

gates: list[GateInfo]
ids: list[int]
classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into an Edge object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

class pyquil.external.rpcq.GateInfo(operator: str | None = None, duration: float | None = None, fidelity: float | None = None, parameters: list[float | str] = <factory>, arguments: list[int | str] = <factory>, operator_type: ~typing.Literal['gate'] = 'gate')[source]

Bases: Operator

GateInfo class for representing a quantum gate operation.

arguments: list[int | str]
dict()[source]

Return a dictionary representation of the GateInfo.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

operator_type: Literal['gate'] = 'gate'
parameters: list[float | str]
classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into a GateInfo object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

class pyquil.external.rpcq.MeasureInfo(operator: str | None = None, duration: float | None = None, fidelity: float | None = None, qubit: int | str | None = None, target: int | str | None = None, operator_type: Literal['measure'] = 'measure')[source]

Bases: Operator

MeasureInfo class for representing a measurement operation.

dict()[source]

Return a dictionary representation of the MeasureInfo.

Deprecated since version 4.7: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

operator_type: Literal['measure'] = 'measure'
classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into a MeasureInfo object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

qubit: int | str | None = None
target: int | str | None = None
class pyquil.external.rpcq.Operator(operator: str | None = None, duration: float | None = None, fidelity: float | None = None)[source]

Bases: object

Operator class for representing a quantum gate or measurement.

dict()[source]

Return a dictionary representation of the Operator.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

duration: float | None = None
fidelity: float | None = None
operator: str | None = None
classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into an Operator object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

class pyquil.external.rpcq.Qubit(id: int, dead: bool | None = False, gates: list[~pyquil.external.rpcq.GateInfo | ~pyquil.external.rpcq.MeasureInfo] = <factory>)[source]

Bases: object

Qubit class for representing a qubit in a quantum processor.

dead: bool | None = False
dict()[source]

Return a dictionary representation of the Qubit.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

gates: list[GateInfo | MeasureInfo]
id: int
classmethod parse_obj(dictionary: dict)[source]

Parse a dictionary into a Qubit object.

Deprecated since version 4.6.2: No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.

class pyquil.external.rpcq.Supported1QGate[source]

Bases: object

Supported 1Q gates.

I = 'I'
MEASURE = 'MEASURE'
RX = 'RX'
RZ = 'RZ'
WILDCARD = 'WILDCARD'
class pyquil.external.rpcq.Supported2QGate[source]

Bases: object

Supported 2Q gates.

CPHASE = 'CPHASE'
CZ = 'CZ'
ISWAP = 'ISWAP'
WILDCARD = 'WILDCARD'
XY = 'XY'
pyquil.external.rpcq.add_edge(quantum_processor: CompilerISA, qubit1: int, qubit2: int) Edge[source]

Add an Edge between two qubit IDs.

pyquil.external.rpcq.add_qubit(quantum_processor: CompilerISA, node_id: int) Qubit[source]

Add a qubit to the quantum processor ISA.

pyquil.external.rpcq.compiler_isa_to_target_quantum_processor(compiler_isa: CompilerISA) TargetDevice[source]

Convert a CompilerISA object to a TargetQuantumProcessor object.

pyquil.external.rpcq.get_edge(quantum_processor: CompilerISA, qubit1: int, qubit2: int) Edge | None[source]

Get an Edge between two qubit IDs.

pyquil.external.rpcq.get_qubit(quantum_processor: CompilerISA, node_id: int) Qubit | None[source]

Get a qubit from the quantum processor ISA.

pyquil.external.rpcq.make_edge_id(qubit1: int, qubit2: int) str[source]

Make an edge ID from two qubit IDs.