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.InstructionArgument
— TypeInstructionArgument
Union type of Symbol
, Dates.Period
, Real
, Matrix{ComplexF64}
which represents a possible argument to a CircuitInstruction
.
Quasar.CircuitInstruction
— TypeCircuitInstruction
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 anycontrols::Vector{Pair{Int, Int}}
- control qubits and bit-values for the operation, so that actrl @ x 0, 2;
could havecontrols = [0=>1]
andnegctrl @ x 0, 2;
could havecontrols = [0=>0]
.exponent::Float64
- exponent to which the operation is raised, if any
CircuitInstruction
s can be used with a package like StructTypes.jl
to build the actual types of your package from these NamedTuple
s.
Quasar.CircuitResult
— TypeCircuitResult
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 applicabletargets::Vector{Int}
- qubit targets for the resultstates::Vector{String}
- vector of bitstrings to measure the amplitudes of, if the result type is an:amplitude
CircuitResult
s can be used with a package like StructTypes.jl
to build the actual result objects of your package from these NamedTuple
s.