Circuit Intermediate Representation (bqskit.ir)

The BQSKit Circuit structure is a 2-d array of operations. A circuit is indexed first by cycles and second by qudits. The cycle index determines when operations are executed, and the qudit index determines which qudits an operation operates on.

Every component of the IR is also a function from a vector of real numbers to a unitary matrix. This is to facilitate circuit instantiation, a core primitive in quantum synthesis.

Core Classes

Circuit(num_qudits[, radixes])

A Circuit is a quantum program composed of operation objects.

Gate()

Gate Base Class.

Operation(gate, location[, params])

An Operation groups together a gate, its parameters and location.

Circuit Indexing and Helpers

CycleInterval(lower_or_tuple[, upper])

The CycleInterval class.

CircuitIterator(circuit[, start, end, ...])

A CircuitIterator iterates through a circuit in a simulation order.

CircuitLocation(location)

The CircuitLocation class.

CircuitPoint(cycle_or_tuple[, qudit])

A cycle and qudit index pair used to index a circuit.

CircuitRegion(intervals)

The CircuitRegion class.

CircuitStructure(circuit)

Stores compressed positions of gates in a circuit as a hashable type.

Type Aliases

IntervalLike

alias of Union[Tuple[int, int], CycleInterval]

CircuitLocationLike

alias of Union[int, Sequence[int], CircuitLocation]

CircuitPointLike

alias of Union[Tuple[int, int], CircuitPoint]

CircuitRegionLike

alias of Union[Mapping[int, Union[Tuple[int, int], CycleInterval]], CircuitRegion]

Gate Library

BQSKit Gates (bqskit.ir.gates)

Constant Gates

BGate

The 2 qubit B gate.

CCXGate

The toffoli gate, equal to an X gate with two controls.

ToffoliGate

alias of CCXGate

CHGate

The controlled-Hadamard gate.

ClockGate

The one-qudit clock (Z) gate.

CPIGate

The two-qutrit CPI gate.

CSGate

The Controlled-S gate.

CSUMGate

The two-qudit Conditional-SUM gate.

CTGate

The Controlled-T gate.

CNOTGate

The Controlled-Not or Controlled-X gate.

CXGate

alias of CNOTGate

CYGate

The Controlled-Y gate.

CZGate

The Controlled-Z gate.

HGate

The one-qudit Hadamard gate.

IdentityGate

An Identity (No-OP) Gate.

ISwapGate

The two qubit swap and phase iSWAP gate.

IToffoliGate

The IToffoliGate gate, equal to an iX gate with two controls.

PDGate

The one-qudit P[i] gate.

PermutationGate

A Permutation Gate.

MargolusGate

alias of RCCXGate

RC3XGate

The relative phase c3x gate.

RCCXGate

The relative phase ccx gate.

SGate

The single-qubit S gate.

SdgGate

The single-qubit S Dagger gate.

ShiftGate

The one-qudit shift (X) gate.

SqrtCNOTGate

The Square root Controlled-X gate.

SqrtISwapGate

The square root two qubit swap and phase iSWAP gate.

SubSwapGate

The two-qudit subspace SWAP gate.

SwapGate

The two-qudit swap gate.

SqrtXGate

The Sqrt(X) gate.

SXGate

alias of SqrtXGate

SycamoreGate

The SycamoreGate gate.

TGate

The single-qubit T gate.

TdgGate

The single-qubit T Dagger gate.

ConstantUnitaryGate

An arbitrary constant unitary operator.

XGate

The Pauli X gate.

XXGate

The Ising XX coupling gate.

YGate

The Pauli Y gate.

YYGate

The Ising YY coupling gate.

ZGate

The Pauli Z gate.

ZZGate

The Ising ZZ coupling gate.

Parameterized Gates

CCPGate

A gate representing a controlled controlled phase rotation.

CKMGate

The Cabibbo-Kobayashi-Maskawa single qutrit gate.

CKMdgGate

The Cabibbo-Kobayashi-Maskawa dagger single qutrit gate.

CPGate

A gate representing a controlled phase rotation.

ArbitraryCPhaseGate

A gate representing an arbitrary qudit controlled phase rotation.

CRXGate

A gate representing a controlled X rotation.

CRYGate

A gate representing a controlled Y rotation.

CRZGate

A gate representing a controlled Z rotation.

CUGate

A gate representing an arbitrary controlled rotation.

FSIMGate

Google's FSIM Gate.

PauliGate

A gate representing an arbitrary rotation.

PhasedXZGate

A gate representing an Google's PhasedXZGate.

RSU3Gate

Rotation by SU3 generator for a single qutrit gate.

RXGate

A gate representing an arbitrary rotation around the X axis.

RXXGate

A gate representing an arbitrary rotation around the XX axis.

RYGate

A gate representing an arbitrary rotation around the Y axis.

RYYGate

A gate representing an arbitrary rotation around the YY axis.

RZGate

A gate representing an arbitrary rotation around the Z axis.

RZZGate

A gate representing an arbitrary rotation around the ZZ axis.

U1Gate

The U1 single qubit gate.

U1qGate

The Quantinuum U1q single qubit gate.

U1qPi2Gate

A composed gate which fixes some parameters of another gate.

U1qPiGate

A composed gate which fixes some parameters of another gate.

U2Gate

The U2 single qubit gate.

U3Gate

The U3 single qubit gate.

U8Gate

The U8 single qutrit gate.

VariableUnitaryGate

A Variable n-qudit unitary operator.

Composed Gates

ControlledGate

An arbitrary controlled gate.

DaggerGate

An arbitrary inverted gate.

EmbeddedGate

An embedding of a gate into a higher-dimensional qudit gate.

FrozenParameterGate

A composed gate which fixes some parameters of another gate.

TaggedGate

The TaggedGate Class.

VariableLocationGate

Gate that can multiplex multiple placements of another gate.

Special Gates

CircuitGate

The CircuitGate class.

MeasurementPlaceholder

Pseudogate to hold measurement information.

Reset

Pseudogate to reset/initialize the qudit to |0>.

BarrierPlaceholder

Pseudogate to force break partitioning algorithms.

Gate Base Classes

ComposedGate

A gate composed of other gates.

QubitGate

A gate that only acts on qubits.

QutritGate

A gate that only acts on qutrits.

QuditGate

A gate that acts on qudits, all with the same level.

ConstantGate

A gate that does not change during circuit instantiation.

GeneralGate

An abstract base class for gates that parameterize any unitary.