Circuits
Circuits are made up of instructions (operations to apply to the qubits – gates and noises) and result types (results). OpenQASM3 programs are parsed to circuits which are then run on the simulator.
BraketSimulator.Circuit — Type
CircuitA representation of a quantum circuit that contains the instructions to be performed on a quantum device and the requested result types.
See:
BraketSimulator.Operator — Type
OperatorAbstract type representing operations that can be applied to a Circuit. Subtypes include Gate, Noise, Observable.
BraketSimulator.QuantumOperator — Type
QuantumOperator < OperatorAbstract type representing quantum operations that can be applied to a Circuit. Subtypes include Gate and Noise.
BraketSimulator.FreeParameter — Type
FreeParameter
FreeParameter(name::Symbol) -> FreeParameterStruct representing a free parameter, which may be used to initialize to a parametrized Gate or Noise and then given a fixed value later by supplying a mapping to a Circuit.
BraketSimulator.Reset — Type
Reset() <: QuantumOperatorRepresents an active reset operation on targeted qubit. For now, this is a no-op.
BraketSimulator.Barrier — Type
Barrier() <: QuantumOperatorRepresents a barrier operation on targeted qubit. For now, this is a no-op.
BraketSimulator.Delay — Type
Delay(duration::Time) <: QuantumOperatorRepresents a delay operation for duration on targeted qubit. For now, this is a no-op.
BraketSimulator.Measure — Type
Measure(index) <: QuantumOperatorRepresents a measurement operation on targeted qubit, stored in the classical register at index.
BraketSimulator.Instruction — Type
Instruction
Instruction(o::Operator, target)Represents a single operation applied to a Circuit. Contains an operator, which may be any subtype of Operator, and a target set of qubits to which the operator is applied.
Examples
julia> Instruction(H(), 1)
Instruction{H}(H(1.0), QubitSet(1))
julia> Instruction(CNot(), [1, 4])
Instruction{CNot}(CNot(1.0), QubitSet(1, 4))BraketSimulator.QubitSet — Type
QubitSetAn OrderedSet-like object which represents the qubits a Circuit, Instruction, or Result acts on and their ordering.
Examples
julia> QubitSet([2, 1])
QubitSet with 2 elements:
2
1
julia> QubitSet()
QubitSet()
julia> QubitSet(QubitSet(5, 1))
QubitSet with 2 elements:
5
1BraketSimulator.qubit_count — Function
qubit_count(c::Circuit) -> IntReturns the number of qubits that c is defined on.
Examples
julia> c = Circuit();
julia> add_instruction!(c, Instruction(H(), 0));
julia> add_instruction!(c, Instruction(CNot(), [0, 1]));
julia> qubit_count(c)
2BraketSimulator.qubits — Function
qubits(c::Circuit) -> QubitSetReturns a QubitSet containing all qubits that c is defined on.
Examples
julia> c = Circuit();
julia> add_instruction!(c, Instruction(H(), 0));
julia> add_instruction!(c, Instruction(CNot(), [0, 1]));
julia> qubits(c)
QubitSet with 2 elements:
0
1BraketSimulator.basis_rotation_instructions! — Function
basis_rotation_instructions!(c::Circuit)Gets a list of basis rotation instructions and stores them in the circuit c. These basis rotation instructions are added if result types are requested for an observable other than Pauli-Z.
This only makes sense if all observables are simultaneously measurable; if not, this method will return an empty list.