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.CircuitType
Circuit

A representation of a quantum circuit that contains the instructions to be performed on a quantum device and the requested result types.

See:

  • Gates for all of the supported gates.
  • Noises for all of the supported noise operations.
  • Results for all of the supported result types.
source
BraketSimulator.FreeParameterType
FreeParameter
FreeParameter(name::Symbol) -> FreeParameter

Struct 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.

source
BraketSimulator.MeasureType
Measure(index) <: QuantumOperator

Represents a measurement operation on targeted qubit, stored in the classical register at index.

source
BraketSimulator.InstructionType
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, Qubit(4)])
Instruction{CNot}(CNot(1.0), QubitSet(1, 4))
source
BraketSimulator.QubitSetType
QubitSet

An OrderedSet-like object which represents the qubits a Circuit, Instruction, or Result acts on and their ordering. Elements may be Ints or Qubits.

Examples

julia> QubitSet(1, Qubit(0))
QubitSet with 2 elements:
  1
  Qubit(0)

julia> QubitSet([2, 1])
QubitSet with 2 elements:
  2
  1

julia> QubitSet()
QubitSet()

julia> QubitSet(QubitSet(5, 1))
QubitSet with 2 elements:
  5
  1
source
BraketSimulator.QubitType
Qubit <: Integer

Wrapper struct representing a qubit.

Examples

julia> q = Qubit(0)
Qubit(0)

julia> q == 0
true
source
BraketSimulator.qubit_countFunction
qubit_count(c::Circuit) -> Int

Returns 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)
2
source
BraketSimulator.qubitsFunction
qubits(c::Circuit) -> QubitSet

Returns 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
  1
source
BraketSimulator.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.

source