New answers tagged

2

I would like to add general case for single qubit gate. Let us assume that our gate is described by unitary matrix $$ U = \begin{pmatrix} u_{11} & u_{12} \\ u_{21} & u_{22} \end{pmatrix} $$ Eigenvalues are roots of so-called characteristic equation $$ |U-\lambda I|=0 $$ In particular $$ \begin{vmatrix} u_{11} - \lambda & u_{12} \\ u_{21} &...


0

Unitary operator is: 1. Normal, hence invertible and diagonalizable. 2. Preserve inner product and trace. 3. Take othornomal basis to orthonormal basis. 4. Eigenvalues are of form $e^{i\theta}$. 5. Tensor product of unitary matrices is unitary. 6. $e^{-iH}$ is unitary if $H$ is Hermitian. Projective measurement (observables) is: 1. Hermitian, $H=H^\dagger$. ...


3

First you need eigenvalues; $$X=\begin{pmatrix} 0&1 \\ 1&0\end{pmatrix}$$ so you need to solve equation $$\begin{vmatrix}0-\lambda &1 \\ 1 &0-\lambda\end{vmatrix}=0$$ or $$\lambda^2-1=0$$ which gives eigenvalues $$\lambda_{1,2}=\pm 1$$ Since $X$ is Hermitian, eigenvalues are real. Now you can find eigenvectors; for example, for the first ...


0

For any unitary quantum transformation the following properties can be considered: Any quantum transformation is reversible. A unitary operator is linear by definition. A unitary operator preserves the norm or length of a state vector. It maps an orthonormal basis to another orthonormal basis If U1 and U2 are unitary operators on spaces V1 and V2 ...


4

The outcome is $-i\left| 11 \right\rangle $. Here is how I obtained it. $$ \left| 01 \right\rangle \xrightarrow{\text{X}} \left| 11 \right\rangle \xrightarrow{\text{Y}} -i\left| 10 \right\rangle \xrightarrow{\text{CNOT}} -i\left| 11 \right\rangle \xrightarrow{\text{SWAP}} -i\left| 11 \right\rangle $$ $X$ gate changes 0 to 1, and 1 to 0: $$ X \left| 0 \...


4

Just to expand on the detail of why writing out the columns works: Start by writing the action of the unitary: \begin{align*} U|0\rangle=\frac{1}{\sqrt{2}}|0\rangle+\frac{1+i}{2}|1\rangle \\ U|1\rangle=\frac{1-i}{2}|0\rangle-\frac{1}{\sqrt{2}}|1\rangle \end{align*} Before proceeding, it's always worth checking that both sides are correctly normalised. In ...


7

Firstly simply rewrite probability amplitudes of returned states as columns of a matrix: $$ U = \begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{1-i}{2} \\ \frac{1+i}{2} & -\frac{1}{\sqrt{2}} \end{pmatrix} $$ Now do some algebra $$ U = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & \frac{1-i}{\sqrt{2}} \\ \frac{1+i}{\sqrt{2}} & -1 \end{pmatrix} = \frac{1}{...


3

Consider some simpler cases, $(j,j+1)$ for general $j$. Then you can do you want with plugging in $j=i$, $j=i+1$, $j=i+3$ and $j=i+4$ and concatenating the circuits appropriately and then simplifying. So how to do $(j,j+1)$? That is conjugate to $(0,1)$, so just consider that for now. $(0,1)$ would be NOT but controlled on making sure all the higher places ...


2

A brute force solution :). You can also obtain CCH via qiskit's basic gates with help of get_controlled_circuit method. from qiskit import * from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit q_reg = QuantumRegister(3, 'q') qc_h = QuantumCircuit(q_reg) qc_ch = QuantumCircuit(q_reg) qc_cch = QuantumCircuit(q_reg) qc_h.h(q_reg[0]) ...


2

Summarization based on discussion with user met927: Transpiled circuit form depends on used backend - it is different for simulator and real quantum processor: On simulator, the $\mathrm{CH}$ gate is transpiled to the circuit shown above On real quantum processor, the gate is implemented with two $\mathrm{U2}$ gates and $\mathrm{CNOT}$ (i.e. like in the ...


3

A general controlled unitary Let $CU$ denote the 'controlled' version of the $n$-qubit unitary $U$: \begin{equation} CU = |0\rangle\langle0|\otimes I_{t} + |1\rangle\langle1|\otimes U_{t}, \end{equation} where the operation acts on a Hilbert space $\mathcal{H}_{c}\otimes \mathcal{H}_{t}$, with $c$ denoting the control qubit and $t$ denoting the target ...


4

Assuming you've got Toffoli and single-qubit rotations, you can implement the following: This basically works because if either of the controls is not $|1\rangle$, the Toffoli does nothing and the two single-qubit unitaries cancel each other. Whereas, if both controls are $|1\rangle$, then the net gate on the target qubit is $$ (\cos\frac{\pi}{8}I+i\sin\...


0

I just copied and pasted your code above, and that is the output I get from the print() statement. What version of qiskit do you have? from qiskit import qiskit_version print(qiskit_version)


0

What does the print(qc.qasm()) yield for you? Here is what I get: OPENQASM 2.0; include "qelib1.inc"; qreg q2[2]; Controlled-Evolution^1 q2[0],q2[1];


0

It seems that this is not a problem/bug. In case the global phase gate $P$ is applied in non-controlled form, final matrix for two qubits ($P$ is acting on second qubit) is \begin{equation} I \otimes P = \begin{pmatrix} P & O \\ O & P \\ \end{pmatrix} =\mathrm{e}^{i\phi}I \end{equation} So, $P$ acts as global phase gate and the phase $\mathrm{e}^{i\...


1

Intraphoton entanglement uses the degrees of freedom from one photon only to create entanglement. So, here either polarization and linear momentum or polarization and angular momentum can be used to create entanglement. Interphoton entanglement is the entanglement created between 2 spatially separated photons. So, naturally latter is less stable than former. ...


1

Based on paper Five Two-Bit Quantum Gates are Sucient to Implement the Quantum Fredkin Gate provided by Norbert Schuch, I realized that there is a more efficient implementation in terms of number of gates. Here is a result: Matrix of CNOT acting on $|q_1\rangle$ controlled by $|q_2\rangle$ is \begin{equation} CNOT_{2}= \begin{pmatrix} 1 & 0 & 0 &...


3

On hardware, the number of moments is the relevant metric. That is why cirq focuses on that. To compute circuit depth in cirq, create a new circuit using just the operations. It defaults to packing them as tightly as possible, so the number of moments will be the depth. depth = len(cirq.Circuit(my_circuit.all_operations()))


5

Prepare a qubit in state $|\psi\rangle=\mathrm{cos}\frac{\theta}{2}|0\rangle+\mathrm{e}^{i\phi}\mathrm{sin}\frac{\theta}{2}|1\rangle$, given the angles $\psi$ and $\theta$. Let's start with a qubit in the $|0\rangle$ state, as is customary for Q#. You can use one of the general library operations to prepare the state, such as PrepareArbitraryState. Or you ...


0

I think the code example closest to what you're looking for is task 1.4 of the Teleportation kata which gives the learner three qubits (the message qubit and the pair of qubits that Alice and Bob will entangle and share before teleportation) and asks them to transform the Bob's qubit into the message state. You'll notice that the test for this task doesn't ...


2

The more elegant approach is to view $R_z(\phi)$ as a linear transformation acting on the basis $\{|0\rangle, |1\rangle\}$. $|0\rangle$ is mapped to $e^{i\phi/2}|0\rangle$ and $|1\rangle$ is mapped to $e^{-i\phi/2}|1\rangle$ by the transformation. As, $|+\rangle = \frac{1}{\sqrt 2}(|0\rangle +|1\rangle)$ it'd be mapped to $R_z(\phi)|+\rangle = \frac{1}{\sqrt ...


Top 50 recent answers are included