BraketSimulator.DensityMatrixSimulator
— TypeDensityMatrixSimulator{T, S<:AbstractMatrix{T}} <: AbstractSimulator
Simulator representing evolution of a density matrix of type S
, with element type T
. Density matrix simulators should be used to simulate circuits with noise.
BraketSimulator.DensityMatrixSimulator
— MethodDensityMatrixSimulator([::T], qubit_count::Int, shots::Int) -> DensityMatrixSimulator{T, Matrix{T}}
Create a DensityMatrixSimulator
with 2^qubit_count x 2^qubit_count
elements and shots
shots to be measured. The default element type is ComplexF64
.
BraketSimulator.StateVectorSimulator
— TypeStateVectorSimulator{T, S<:AbstractVector{T}} <: AbstractSimulator
Simulator representing a pure state evolution of a statevector of type S
, with element type T
. State vector simulators should be used to simulate circuits without noise.
BraketSimulator.StateVectorSimulator
— MethodStateVectorSimulator([::T], qubit_count::Int, shots::Int) -> StateVectorSimulator{T, Vector{T}}
Create a StateVectorSimulator
with 2^qubit_count
elements and shots
shots to be measured. The default element type is ComplexF64
.
Braket.properties
— Methodproperties(svs::DensityMatrixSimulator) -> GateModelSimulatorDeviceCapabilities
Query the properties and capabilities of a DensityMatrixSimulator
, including which gates and result types are supported and the minimum and maximum shot and qubit counts.
Braket.properties
— Methodproperties(svs::StateVectorSimulator) -> GateModelSimulatorDeviceCapabilities
Query the properties and capabilities of a StateVectorSimulator
, including which gates and result types are supported and the minimum and maximum shot and qubit counts.
Braket.simulate
— Methodsimulate(simulator::AbstractSimulator, circuit_ir; shots::Int = 0, kwargs...) -> GateModelTaskResult
Simulate the evolution of a statevector or density matrix using the passed in simulator
. The instructions to apply (gates and noise channels) and measurements to make are encoded in circuit_ir
. Supported IR formats are OpenQASMProgram
(OpenQASM3) and Program
(JAQCD). Returns a GateModelTaskResult
containing the individual shot measurements (if shots > 0
), final calculated results, circuit IR, and metadata about the task.
BraketSimulator.evolve!
— Methodevolve!(dms::DensityMatrixSimulator{T, S<:AbstractMatrix{T}}, operations::Vector{Instruction}) -> DensityMatrixSimulator{T, S}
Apply each operation of operations
in-place to the density matrix contained in dms
.
Effectively, perform the operation:
$\hat{\rho} \to \hat{A}^\dag \hat{\rho} \hat{A}$
for each operation $\hat{A}$ in operations
.
BraketSimulator.evolve!
— Methodevolve!(svs::StateVectorSimulator{T, S<:AbstractVector{T}}, operations::Vector{Instruction}) -> StateVectorSimulator{T, S}
Apply each operation of operations
in-place to the state vector contained in svs
.
Effectively, perform the operation:
$\left| \psi \right\rangle \to \hat{A} \left| \psi \right\rangle$
for each operation $\hat{A}$ in operations
.
BraketSimulator.expectation
— Methodexpectation(dms::DensityMatrixSimulator, observable::Observables.Observable, targets::Int...) -> Float64
Compute the exact (shots=0
) expectation value of observable
applied to targets
given the evolved density matrix in dms
. In other words, compute
$\mathrm{Tr}\left(\hat{O}\hat{\rho}\right)$.
BraketSimulator.expectation
— Methodexpectation(svs::StateVectorSimulator, observable::Observables.Observable, targets::Int...) -> Float64
Compute the exact (shots=0
) expectation value of observable
applied to targets
given the evolved state vector in svs
. In other words, compute
$\langle \psi | \hat{O} | \psi \rangle$.
BraketSimulator.probabilities
— Methodprobabilities(svs::StateVectorSimulator) -> Vector{Float64}
Compute the observation probabilities of all amplitudes in the state vector in svs
.