LSShadows
Documentation for LSShadows.
LSShadows.UnitaryCircuitLSShadows.classical_snapshot!LSShadows.construct_unitaryLSShadows.entanglement_featureLSShadows.entanglement_feature_pageLSShadows.entanglement_feature_vectorLSShadows.estimate_fidelityLSShadows.onsite_haar_circuitLSShadows.partial_tr_embedding!LSShadows.purityLSShadows.reconstruction_coefficientLSShadows.xzxcnot_circuitLSShadows.zzx_circuit
LSShadows.UnitaryCircuit — TypeRandomCircuit object. The choice of single-qubit and multi-qubit gates that conform a layer is passed as an argument.
Arguments
N::Int: Number of qubitsp::Int: Circuit depth
LSShadows.classical_snapshot! — Methodclassical_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 anArrayReg.threaded: Optional argument with default value offalse, which determines if the function should be run in a multi-threaded mode.
Returns
- None. The function updates the
M_inversematrix in-place.
LSShadows.construct_unitary — Methodconstruct_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:UnitaryCircuitobject
Optional arguments
val: By default equal toVal(:XZXCnot). Other options areVal(:ZZX)corresponding to the Floquet Ising Circuit andVal(:OnsiteHaar)for a local circuit composed of tensor products of Haar-random single qubit unitaries.
LSShadows.entanglement_feature — Methodentanglement_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.
LSShadows.entanglement_feature_page — Methodentanglement_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.
LSShadows.entanglement_feature_vector — Methodentanglement_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.
LSShadows.estimate_fidelity — Methodestimate_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 offalse, which determines if the function should be run in a multi-threaded mode.
Returns
- Fidelity estimate as a Float64.
LSShadows.onsite_haar_circuit — Methodonsite_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.
LSShadows.partial_tr_embedding! — Methodpartial_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_trmatrix in-place.
LSShadows.purity — Methodpurity(rho::DensityMatrix)Calculate the purity of a given density matrix rho. The purity is defined as the trace of the squared density matrix.
LSShadows.reconstruction_coefficient — Methodreconstruction_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.
LSShadows.xzxcnot_circuit — Methodxzxcnot_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
LSShadows.zzx_circuit — Methodzzx_circuit(f::UnitaryCircuit)Creates a zzx_circuit compossed of Rz-Rzz-Rx gates with parameter to be dispatched. Here periodic boundary conditions are used