Operators
MimiqCircuitsBase.Projector0 — Type
Projector0(a)One-qubit operator corresponding to a projection onto $|0\rangle$.
The corresponding matrix
\[\begin{pmatrix} a & 0\\ 0 & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling. Equivalent to DiagonalOp(a,0).
The parameter $a$ is optional and is set to 1 by default.
See also Projector1, DiagonalOp.
Examples
julia> Projector0()
P₀(1)
julia> Projector0(0.5)
P₀(0.5)
julia> push!(Circuit(), ExpectationValue(Projector0()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₀(1)⟩ @ q[1], z[1]MimiqCircuitsBase.Projector00 — Type
Projector00(a)Two-qubit operator corresponding to a projection onto $|00\rangle$.
The corresponding matrix
\[\begin{pmatrix} a & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also Projector01, Projector10, Projector11.
Examples
julia> Projector00()
P₀₀(1)
julia> Projector00(0.5)
P₀₀(0.5)
julia> push!(Circuit(), ExpectationValue(Projector00()), 1, 2, 1)
2-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₀₀(1)⟩ @ q[1:2], z[1]
MimiqCircuitsBase.Projector01 — Type
Projector01(a)Two-qubit operator corresponding to a projection onto $|01\rangle$.
The corresponding matrix
\[\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & a & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also Projector00, Projector10, Projector11.
Examples
julia> Projector01()
P₀₁(1)
julia> Projector01(0.5)
P₀₁(0.5)
julia> push!(Circuit(), ExpectationValue(Projector01()), 1, 2, 1)
2-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₀₁(1)⟩ @ q[1:2], z[1]
MimiqCircuitsBase.Projector1 — Type
Projector1(a)One-qubit operator corresponding to a projection onto $|1\rangle$.
The corresponding matrix
\[\begin{pmatrix} 0 & 0\\ 0 & a \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling. Equivalent to DiagonalOp(0,a).
The parameter $a$ is optional and is set to 1 by default.
See also Projector0, DiagonalOp.
Examples
julia> Projector1()
P₁(1)
julia> Projector1(0.5)
P₁(0.5)
julia> push!(Circuit(), ExpectationValue(Projector1()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₁(1)⟩ @ q[1], z[1]MimiqCircuitsBase.Projector10 — Type
Projector10(a)Two-qubit operator corresponding to a projection onto $|10\rangle$.
The corresponding matrix
\[\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & a & 0\\ 0 & 0 & 0 & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also Projector00, Projector01, Projector11.
Examples
julia> Projector10()
P₁₀(1)
julia> Projector10(0.5)
P₁₀(0.5)
julia> push!(Circuit(), ExpectationValue(Projector10()), 1, 2, 1)
2-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₁₀(1)⟩ @ q[1:2], z[1]
MimiqCircuitsBase.Projector11 — Type
Projector11(a)Two-qubit operator corresponding to a projection onto $|11\rangle$.
The corresponding matrix is
\[\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & a \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also Projector00, Projector01, Projector10.
Examples
julia> Projector11()
P₁₁(1)
julia> Projector11(0.5)
P₁₁(0.5)
julia> push!(Circuit(), ExpectationValue(Projector11()), 1, 2, 1)
2-qubit, 1-vars circuit with 1 instruction:
└── ⟨P₁₁(1)⟩ @ q[1:2], z[1]
MimiqCircuitsBase.ProjectorX0 — Type
ProjectorX0(a)One-qubit operator corresponding to a projection onto $|+\rangle$.
The corresponding matrix
\[\frac{a}{2} \begin{pmatrix} 1 & 1\\ 1 & 1 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also ProjectorX1.
Examples
julia> ProjectorX0()
PX₀(1)
julia> ProjectorX0(0.5)
PX₀(0.5)
julia> push!(Circuit(), ExpectationValue(ProjectorX0()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨PX₀(1)⟩ @ q[1], z[1]MimiqCircuitsBase.ProjectorX1 — Type
ProjectorX1(a)One-qubit operator corresponding to a projection onto $|-\rangle$.
The corresponding matrix
\[\frac{a}{2} \begin{pmatrix} 1 & -1\\ -1 & 1 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also ProjectorX0.
Examples
julia> ProjectorX1()
PX₁(1)
julia> ProjectorX1(0.5)
PX₁(0.5)
julia> push!(Circuit(), ExpectationValue(ProjectorX1()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨PX₁(1)⟩ @ q[1], z[1]MimiqCircuitsBase.ProjectorY0 — Type
ProjectorY0(a)One-qubit operator corresponding to a projection onto $|y+\rangle$.
The corresponding matrix
\[\frac{a}{2} \begin{pmatrix} 1 & -i\\ i & 1 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also ProjectorY1.
Examples
julia> ProjectorY0()
PY₀(1)
julia> ProjectorY0(0.5)
PY₀(0.5)
julia> push!(Circuit(), ExpectationValue(ProjectorY0()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨PY₀(1)⟩ @ q[1], z[1]MimiqCircuitsBase.ProjectorY1 — Type
ProjectorY1(a)One-qubit operator corresponding to a projection onto $|y-\rangle$.
The corresponding matrix
\[\frac{a}{2} \begin{pmatrix} 1 & i\\ -i & 1 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also ProjectorY0.
Examples
julia> ProjectorY1()
PY₁(1)
julia> ProjectorY1(0.5)
PY₁(0.5)
julia> push!(Circuit(), ExpectationValue(ProjectorY1()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨PY₁(1)⟩ @ q[1], z[1]MimiqCircuitsBase.ProjectorZ0 — Type
ProjectorZ0(a)See Projector0.
MimiqCircuitsBase.ProjectorZ1 — Type
ProjectorZ1(a)See Projector1.
MimiqCircuitsBase.ExpectationValue — Type
ExpectationValue(op)Operation to compute and store expectation value of an Operator in a z-register.
An expectation value for a pure state $| \psi \rangle$ is defined as
\[\langle O \rangle = \langle \psi | O | \psi \rangle\]
where $O$ is an operator. With respect to a density matrix $\rho$ it's given by
\[\langle O \rangle = \mathrm{Tr}(\rho O).\]
However, when using quantum trajectories to solve noisy circuits, the expectation value is computed with respect to the pure state of each trajectory.
The argument op can be any gate or non-unitary operator.
See also AbstractOperator, AbstractGate.
Examples
In push! the first argument corresponds to the qubit, and the second to the z-register
julia> ExpectationValue(GateX())
⟨X⟩
julia> c = push!(Circuit(), ExpectationValue(GateX()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨X⟩ @ q[1], z[1]
julia> c = push!(Circuit(), ExpectationValue(SigmaPlus()), 1, 2)
1-qubit, 2-vars circuit with 1 instruction:
└── ⟨SigmaPlus(1)⟩ @ q[1], z[2]
MimiqCircuitsBase.SigmaMinus — Type
SigmaMinus(a)One-qubit operator corresponding to $|0 \rangle\langle 1|$.
The corresponding matrix
\[\begin{pmatrix} 0 & a\\ 0 & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also SigmaPlus.
Examples
julia> SigmaMinus()
SigmaMinus(1)
julia> SigmaMinus(0.5)
SigmaMinus(0.5)
julia> push!(Circuit(), ExpectationValue(SigmaMinus()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨SigmaMinus(1)⟩ @ q[1], z[1]MimiqCircuitsBase.SigmaPlus — Type
SigmaPlus(a)One-qubit operator corresponding to $|1 \rangle\langle 0|$.
The corresponding matrix
\[\begin{pmatrix} 0 & 0\\ a & 0 \end{pmatrix}\]
is parametrized by $a$ to allow for phases/rescaling.
The parameter $a$ is optional and is set to 1 by default.
See also SigmaMinus.
Examples
julia> SigmaPlus()
SigmaPlus(1)
julia> SigmaPlus(0.5)
SigmaPlus(0.5)
julia> push!(Circuit(), ExpectationValue(SigmaPlus()), 1, 1)
1-qubit, 1-vars circuit with 1 instruction:
└── ⟨SigmaPlus(1)⟩ @ q[1], z[1]MimiqCircuitsBase.Delay — Type
Delay(t)1-qubit delay gate
This gate is equivalent to a GateID gate, except that it is parametrized by a time parameter t. The parameter does not affect the action of the gate. The only purpose of this gate is to act as a placeholder to indicate idle noise, in which case the parameter t can later be used to further specify the noise properties.
The gate can be created by calling Delay(t) where t is a number.
See also GateID.
Matrix representation
\[\operatorname{Delay}(t) = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\]
Examples
julia> c = push!(Circuit(), Delay(0.1), 1)
1-qubit circuit with 1 instruction:
└── Delay(0.1) @ q[1]
Decomposition
julia> decompose(Delay(0.2))
1-qubit circuit with 1 instruction:
└── Delay(0.2) @ q[1]
MimiqCircuitsBase.BondDim — Type
BondDim()Operation to get the bond dimension between two halves of the system and store in a z-register.
The bond dimension is only defined for a matrix-product state (MPS), which can be written as (with $i_1=i_{N+1}=1$)
\[|\psi \rangle = \sum_{s_1,s_2,\ldots=1}^2 \sum_{i_2}^{\chi_2} \sum_{i_3}^{\chi_3} \ldots \sum_{i_N}^{\chi_N} A^{(s_1)}_{i_1i_2} A^{(s_2)}_{i_2 i_3} A^{(s_3)}_{i_3 i_4} \ldots A^{(s_N)}_{i_{N}i_{N+1}} | s_1, s_2, s_3, \ldots, s_N \rangle .\]
Here, $\chi_k$ is the bond dimension, i.e. the dimension of the index $i_k$. The first and last bond dimensions are dummies, $chi_0=chi_N=1$. A bond dimension of 1 means there is no entanglement between the two halves of the system.
See also VonNeumannEntropy, SchmidtRank.
Examples
When pushing to a circuit, the qubit index $k$ that we give will get back the bond dimension $i_{k}$ in the above notation, i.e. the bond dimension between qubit $k-1$ and qubit $k$. For $k=1$ the bond dimension returned will always be 1.
julia> k = 5;
julia> c = push!(Circuit(), BondDim(), k, 1)
5-qubit, 1-vars circuit with 1 instruction:
└── BondDim @ q[5], z[1]
MimiqCircuitsBase.SchmidtRank — Type
SchmidtRank()Operation to get the Schmidt rank of a bipartition and store in a z-register.
A Schmidt decomposition for a bipartition into subsystems $A$ and $B$ is defined for a pure state as
\[|\psi\rangle = \sum_{i=1}^{r} s_i |\alpha_i\rangle \otimes |\beta_i\rangle,\]
where $|\alpha_i\rangle$ ($|\beta_i\rangle$) are orthonormal states acting on $A$ ($B$). The Schmidt rank is the number of terms $r$ in the sum. A product state gives $r=1$ and $r>1$ signals entanglement.
We only consider bipartitions where $A=\{1,\ldots,k-1\}$ and $B=\{k,\ldots,N\}$, for some $k$ and where $N$ is the total number of qubits.
In MPS, when the state is optimally compressed, the Schmidt rank should be equal to the bond dimension BondDim.
See also VonNeumannEntropy.
Examples
When pushing to a circuit, the qubit index $k$ takes the role of the above bipartition into $A$ and $B$. For $k=1$, $A$ is empty and the Schmidt rank will always return 1.
julia> k = 5;
julia> c = push!(Circuit(), SchmidtRank(), k, 1)
5-qubit, 1-vars circuit with 1 instruction:
└── SchmidtRank @ q[5], z[1]
MimiqCircuitsBase.VonNeumannEntropy — Type
VonNeumannEntropy()Operation to get the bipartite Von Neumann entanglement entropy and store in a z-register.
The entanglement entropy for a bipartition into subsystems $A$ and $B$ is defined for a pure state $\rho = | \psi \rangle\langle \psi |$ as
\[\mathcal{S}(\rho_A) = - \mathrm{Tr}(\rho_A \log_2 \rho_A) = - \mathrm{Tr}(\rho_B \log_2 \rho_B) = \mathcal{S}(\rho_A)\]
where $\rho_A = \mathrm{Tr}_B(\rho)$ is the reduced density matrix. A product state has $\mathcal{S}(\rho_A)=0$ and a maximally entangled state between $A$ and $B$ gives $\mathcal{S}(\rho_A)=1$.
We only consider bipartitions where $A=\{1,\ldots,k-1\}$ and $B=\{k,\ldots,N\}$, for some $k$ and where $N$ is the total number of qubits.
When the system is open (i.e. with noise) and we are using quantum trajectories, the entanglement entropy of each trajectory is returned during execution.
See also BondDim, SchmidtRank.
Examples
When pushing to a circuit, the qubit index $k$ takes the role of the above bipartition into $A$ and $B$. For $k=1$, $A$ is empty and the entanglement entropy will always return 0.
julia> k = 5;
julia> c = push!(Circuit(), VonNeumannEntropy(), k, 1)
5-qubit, 1-vars circuit with 1 instruction:
└── VonNeumannEntropy @ q[5], z[1]
<!– TODO: Delay and entanglement should be replaced to where they belong They were placed here for compliation purposes –>