Quasar.jl internals

Here we document some of the internal types useful for developers and those extending Quasar.jl with custom gate sets and pragmas.

Quasar.CircuitInstructionType
CircuitInstruction

A NamedTuple representing a circuit instruction (a gate, a noise operation, a timing operation). Fields are:

  • type::String - the name of the operation (e.g. rx)
  • arguments::Vector{InstructionArgument} - arguments, if any, to the operation (e.g. π for an angled gate)
  • targets::Vector{Int} - qubit targets for the operation, including control qubits, if any
  • controls::Vector{Pair{Int, Int}} - control qubits and bit-values for the operation, so that a ctrl @ x 0, 2; could have controls = [0=>1] and negctrl @ x 0, 2; could have controls = [0=>0].
  • exponent::Float64 - exponent to which the operation is raised, if any

CircuitInstructions can be used with a package like StructTypes.jl to build the actual types of your package from these NamedTuples.

source
Quasar.CircuitResultType
CircuitResult

A NamedTuple representing a circuit result (e.g. an expectation value). Fields are:

  • type::Symbol - the name of the result type (e.g. :variance)
  • operator::Vector{Union{String, Matrix{ComplexF64}}} - the operator to measure, if applicable
  • targets::Vector{Int} - qubit targets for the result
  • states::Vector{String} - vector of bitstrings to measure the amplitudes of, if the result type is an :amplitude

CircuitResults can be used with a package like StructTypes.jl to build the actual result objects of your package from these NamedTuples.

source