qcs_sdk.compiler.quilc

class CompilerOpts:

A set of options that determine the behavior of compiling programs with quilc

def default():

Create a new instance of CompilerOpts with default values.

class CompilationResult:

The result of compiling a Quil program to native quil with quilc

native_quil_metadata

Metadata about the compiled program

program

The compiled program

class NativeQuilMetadata:

Metadata about a program compiled to native quil.

class TargetDevice:

Description of a device to compile for.

def from_isa(isa):

Create a [TargetDevice] based on an [InstructionSetArchitecture].

Errors

Returns a [QuilcError] if the [InstructionSetArchitecture] cannot be converted into a format that Quilc understands.

def from_json(value):

Create a [TargetDevice] from a JSON string.

Errors

Returns a [QuilcError] if the JSON is malformed.

class PauliTerm:

Pauli Term

symbols

Ordered factors of the Pauli term.

indices

Qubit indices onto which the factors of the Pauli term are applied.

class ConjugateByCliffordRequest:

Request to conjugate a Pauli Term by a Clifford element.

clifford

Clifford element.

pauli

Pauli Term to conjugate.

class ConjugatePauliByCliffordRequest:

The "outer" request shape for a conjugate_pauli_by_clifford request.

args
class ConjugatePauliByCliffordResponse:

Conjugate Pauli by Clifford response.

phase

Encoded global phase factor on the emitted Pauli.

pauli

Description of the encoded Pauli.

class RandomizedBenchmarkingRequest:

Request to generate a randomized benchmarking sequence.

qubits

Number of qubits involved in the benchmarking sequence.

gateset

List of Quil programs, each describing a Clifford.

depth

Depth of the benchmarking sequence.

seed

PRNG seed. Set this to guarantee repeatable results.

interleaver

Fixed Clifford, specified as a Quil string, to interleave through an RB sequence.

class GenerateRandomizedBenchmarkingSequenceResponse:

Randomly generated benchmarking sequence response.

sequence

List of Cliffords, each expressed as a list of generator indices.

class QuilcClient:

Client used to communicate with Quilc.

def new_libquil():
def new_rpcq(endpoint):

Construct a QuilcClient that uses RPCQ to communicate with Quilc.

DEFAULT_COMPILER_TIMEOUT = 30.0
class QuilcError(qcs_sdk.QcsSdkError):

Errors encountered compiling a Quil program.

def compile_program(quil, target, client, options=None):

Compile a quil program for a target device.

Parameters
  • quil: The Quil program to compile.
  • target: Architectural description of device to compile for.
  • client: Client used to send compilation requests to Quilc.
  • options: Optional compiler options. If None, default values are used.
Raises
  • QuilcError: If compilation fails.
def compile_program_async(quil, target, client, options=None):

Compile a quil program for a target device.

Parameters
  • quil: The Quil program to compile.
  • target: Architectural description of device to compile for.
  • client: Client used to send compilation requests to Quilc.
  • options: Optional compiler options. If None, default values are used.
Raises
  • QuilcError: If compilation fails.
def get_version_info(client):

Fetch the version information from the running Quilc service.

Parameters
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc.
def get_version_info_async(client):

Fetch the version information from the running Quilc service.

Parameters
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc.
def conjugate_pauli_by_clifford(request, client):

Given a circuit that consists only of elements of the Clifford group, return its action on a PauliTerm. In particular, for Clifford C, and Pauli P, this returns the PauliTerm representing CPC^{\dagger}.

Parameters
  • request: Pauli Term conjugation request.
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc or if the request is malformed.
def conjugate_pauli_by_clifford_async(request, client):

Given a circuit that consists only of elements of the Clifford group, return its action on a PauliTerm. In particular, for Clifford C, and Pauli P, this returns the PauliTerm representing CPC^{\dagger}.

Parameters
  • request: Pauli Term conjugation request.
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc or if the request is malformed.
def generate_randomized_benchmarking_sequence(request, client):

Construct a randomized benchmarking experiment on the given qubits, decomposing into gateset. If interleaver is not provided, the returned sequence will have the form

    C_1 C_2 ... C_(depth-1) C_inv ,

where each C is a Clifford element drawn from gateset, C_{< depth} are randomly selected, and C_inv is selected so that the entire sequence composes to the identity. If an interleaver G (which must be a Clifford, and which will be decomposed into the native gateset) is provided, then the sequence instead takes the form

    C_1 G C_2 G ... C_(depth-1) G C_inv .
Parameters
  • request: Randomized benchmarking request.
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc or if the request is malformed.
def generate_randomized_benchmarking_sequence_async(request, client):

Construct a randomized benchmarking experiment on the given qubits, decomposing into gateset. If interleaver is not provided, the returned sequence will have the form

    C_1 C_2 ... C_(depth-1) C_inv ,

where each C is a Clifford element drawn from gateset, C_{< depth} are randomly selected, and C_inv is selected so that the entire sequence composes to the identity. If an interleaver G (which must be a Clifford, and which will be decomposed into the native gateset) is provided, then the sequence instead takes the form

    C_1 G C_2 G ... C_(depth-1) G C_inv .
Parameters
  • request: Randomized benchmarking request.
  • client: Client used to send compilation requests to Quilc.
Raises
  • QuilcError: If there is a failure connecting to Quilc or if the request is malformed.