LSShadows

Documentation for LSShadows.

LSShadows.UnitaryCircuitType

RandomCircuit object. The choice of single-qubit and multi-qubit gates that conform a layer is passed as an argument.

Arguments

  • N::Int: Number of qubits
  • p::Int: Circuit depth
source
LSShadows.classical_snapshot!Method
classical_snapshot!(M_inverse::Array{ComplexF64, 2}, partial_tr::Array{ComplexF64, 2}, reconst_coefficient::Vector{Float64}, ρ_unknown::ArrayReg; threaded=false)

Construct the classical snapshot of an unknown quantum state ρ_unknown. For this, given the reconstruction coefficient it returns $\sum_A r_A \sigma_A$ where r_A is the $A$-th component of the reconstruction coefficient and $\sigma_A$ is the embeded reduced density matrix of the state $\sigma$ on region $A$.

Arguments

  • M_inverse: Pre-allocated matrix to store the result.
  • partial_tr: Pre-allocated matrix to store the partial trace embedding.
  • reconst_coefficient: Vector of Float64 representing the reconstruction coefficients.
  • ρ_unknown: Unknown quantum state as an ArrayReg.
  • threaded: Optional argument with default value of false, which determines if the function should be run in a multi-threaded mode.

Returns

  • None. The function updates the M_inverse matrix in-place.
source
LSShadows.construct_unitaryMethod
construct_unitary(f::UnitaryCircuit; val=Val(:XZXCnot))

Returns the unitary operator representing the N-qubit and depth p unitary circuit with the choice of layer given by the parameter type

Arguments

  • f::RandomCircuit: UnitaryCircuit object

Optional arguments

  • val: By default equal to Val(:XZXCnot). Other options are Val(:ZZX) corresponding to the Floquet Ising Circuit and Val(:OnsiteHaar) for a local circuit composed of tensor products of Haar-random single qubit unitaries.
source
LSShadows.entanglement_featureMethod
entanglement_feature(ψ::ArrayReg, r)

Calculate the entanglement feature for a given quantum state ψ and the register r. If the length of r is 0 or equal to the number of qubits in ψ, return 1.0. Otherwise, compute the purity of the density matrix for the specified register.

source
LSShadows.entanglement_feature_pageMethod
entanglement_feature_page(n::Int, rA::Vector{Int64})

Calculate the entanglement feature associated with an n-qubit Haar random state. rA corresponds to the qubits to be kept.

source
LSShadows.entanglement_feature_vectorMethod
entanglement_feature_vector(ψ::ArrayReg, reg::Vector{Vector{Int64}})

Compute the entanglement feature vector for a given quantum state ψ and a vector of registers reg. The entanglement feature vector is a vector containing the entanglement features for each register in reg.

source
LSShadows.estimate_fidelityMethod
estimate_fidelity(rho::ArrayReg, rA::Vector{Float64}, ensemble::Vector; threaded=false)

Estimate the fidelity between a given quantum state rho and an the reconstructed state.

Arguments

  • rho: Quantum state as an ArrayReg.
  • rA: Vector of Float64 representing the reconstruction coefficients.
  • ensemble: Vector of quantum states.
  • threaded: Optional argument with default value of false, which determines if the function should be run in a multi-threaded mode.

Returns

  • Fidelity estimate as a Float64.
source
LSShadows.onsite_haar_circuitMethod
onsite_haar_circuit(f::UnitaryCircuit)

Create an OnsiteHaar circuit, that is $U = \otimes_{i=1}^N u_i$ where the single qubit unitaries $u_i$ are drawn from the Haar distribution.

source
LSShadows.partial_tr_embedding!Method
partial_tr_embedding!(partial_tr::Array{ComplexF64, 2}, ψ0::ArrayReg, reg::Vector{Int64})

Compute the reduced density matrix $\rho_A$ of a given quantum state ψ0 in the region reg. After that, it embeds the reduced density matrix back into the full hilbert space by constructing

\[\rho_A \otimes \mathbb{I}/d_{\bar{A}}\]

The results are stored in a pre-allocated array partial_tr.

Arguments

  • partial_tr: Pre-allocated matrix to store the result.
  • ψ0: Quantum state as an ArrayReg.
  • reg: Vector of Int64 representing the qubits to keep.

Returns

  • None. The function updates the partial_tr matrix in-place.
source
LSShadows.purityMethod
purity(rho::DensityMatrix)

Calculate the purity of a given density matrix rho. The purity is defined as the trace of the squared density matrix.

source
LSShadows.reconstruction_coefficientMethod
reconstruction_coefficient(WEσ::Vector{Float64}; d=2)

Calculate the reconstruction coefficient for a given vector of entanglement features WEσ.

Arguments

  • WEσ: Vector of entanglement features.
  • d: Optional argument with default value of 2, representing the dimension of the underlying quantum system.

Returns

  • Reconstruction coefficient as a vector of Float64.
source
LSShadows.xzxcnot_circuitMethod
xzxcnot_circuit(f::UnitaryCircuit)

Create an XZXCnot circuit compossed of Rx-Rz-Rx-Cnot gates with parameter to be dispatched. Here periodic boundary conditions are used

source
LSShadows.zzx_circuitMethod
zzx_circuit(f::UnitaryCircuit)

Creates a zzx_circuit compossed of Rz-Rzz-Rx gates with parameter to be dispatched. Here periodic boundary conditions are used

source