New answers tagged

0

I will try to provide you with some hints how to implement your unitary operation. Let's firstly rewrite it as $U_d = \mathrm{exp}(-i\Theta(t)\sigma_x)$ or $U_d = \mathrm{exp}(-i\Theta(t)X)$ (i.e. I replaced the notation $\sigma_x$ for Pauli $X$ gate by symbol $X$). This means that $U_d$ is in fact $x$ rotation given by formula $$ Rx(\theta)= \mathrm{exp}\...


1

Yes, there is a simple general formula for the unitary $U$ that maps orthonormal basis $|u_1\rangle, |u_2\rangle, \dots, |u_n\rangle$ to orthonormal basis $|v_1\rangle, |v_2\rangle, \dots, |v_n\rangle$ $$ U = |v_1\rangle\langle u_1|+|v_2\rangle\langle u_2|+\dots+|v_n\rangle\langle u_n|=\sum_{i=1}^n|v_i\rangle\langle u_i|. $$ It is easy to check that $U$ is ...


0

Based on the idea given by @Tristan Nemoz, you can do something like this in Qiskit code: from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit from numpy import pi qreg_q = QuantumRegister(1, 'q') creg_c = ClassicalRegister(1, 'c') circuit = QuantumCircuit(qreg_q, creg_c) circuit.h(qreg_q[0]) circuit.measure(qreg_q[0], creg_c[0]) circuit.h(...


2

I also suggest Xanadu's Pennylane (https://pennylane.ai/). Examples/tutorials: https://pennylane.ai/qml/demonstrations.html


1

D-Wave is the main provider of quantum annealers for the last 20 years. The company just announced its expansion into gate-based quantum systems (making it the only provider of both types at the time of this writing). https://www.dwavesys.com/company/newsroom/press-release/let-s-get-practical-d-wave-details-product-expansion-cross-platform-roadmap/ Quantum ...


5

For general initial states, i.e., not fully separable, the paper Synthesis of Quantum Logic Circuits gives the Quantum Shannon Decomposition (QSD) algorithm that has a gate count of $\frac{23}{48}4^n-\frac{3}{2}2^n+\frac{4}{3}$ where $n$ is the number of qubits (look at table 1 of the linked paper).


7

The running time of creating any fully separable pure initial state is $O(1)$. This includes the standard $|0\rangle^{\otimes n}$ or something like $|+\rangle^{\otimes n}$, which is the uniform superposition of all basis states. That's because this is just single-qubit preparation performed in parallel.


0

i think you need 9 qubit for the processing!! read this https://qiskit.org/textbook/ch-applications/image-processing-frqi-neqr.html


0

One can start with operator flow's tutorial of qiskit which can be found on this website. The Hamiltonian can be easily found. But since it's not a unitary matrix, the qiskit functions won't be able to build its corresponding circuit.


5

The matrix $$ M = \frac{1}{\sqrt{2}}\begin{bmatrix}-i & 1\\-1 & i\end{bmatrix} $$ resembles $$ X/2 = \frac{1}{\sqrt{2}}\begin{bmatrix}1 & -i\\-i & 1\end{bmatrix}\tag1 $$ where we follow the notation $\pm X/2$ for the $\pm\frac{\pi}{2}$ rotation around the $X$ axis as used in the table B.6 on page 101 in Julian Kelly's PhD thesis. We can make ...


3

For surface codes, the syndrome measurements collapse the errors into either being $X$ or $Z$ errors. All Clifford gates have easy-to-compute commutation relations with $X$ and $Z$ gates. So the idea is not to actually correct the errors, since that would require more quantum operations which are difficult and error-prone, but to simply track the errors and ...


1

Qiskit defines the $RX$ gate as follows: $$ RX(\theta) = \exp\left(-i \frac{\theta}{2} X\right) = \begin{pmatrix} \cos{\frac{\theta}{2}} & -i\sin{\frac{\theta}{2}} \\ -i\sin{\frac{\theta}{2}} & \cos{\frac{\theta}{2}} \end{pmatrix} $$ Thus, setting $\theta = \pi$, would give us: $$ RX(\pi) = \...


3

There is Qiskit Optimization application module entirely suitable for solving optimization problems as it can be noticed from the name. This module is based on Qiskit and provides high level interfaces to optimization define problems and solve them via various quantum algorithms. The module is written in python. Take a look at the module page and tutorials: ...


0

As CX gate is a two-qubit gate, therefore, the size of the matrix which represents the two-qubit gate is 4x4. That's the reason why you have to use a tensor product with two error_gate1 (2x2) to create the error gate for CX gate. For the noise model, you should create the error for all types of gates that you are using in your circuit. Moreover, usually, two-...


3

Check Qiskit documentation Summary of Quantum Operations under Arbitrary initialization. The function initialize does what you need (function documentation here). Example: from qiskit import QuantumCircuit import math desired_vector = [1/math.sqrt(2),-1/math.sqrt(2)] qc = QuantumCircuit(1) #circuit with 1 qubit qc.initialize(desired_vector, [0]) #0 in ...


3

The decomposition they give is the following: $$ R_z(\theta) = R_x\left(\pi / 2\right) R_y(\theta) R_x\left(-\pi / 2\right) $$ Therefore, the Qiskit code would look like: from qiskit import QuantumCircuit from qiskit.quantum_info import Operator import numpy as np theta = np.pi / 4 qc = QuantumCircuit(1) qc.rx(-np.pi / 2, 0) qc.ry(theta, 0) qc.rx(np.pi / 2,...


3

Note: this is not a qiskit answer. I have no idea if qiskit provides specific methods. Firstly, you can only do this if $|b\rangle$ has length 1. If not, you need to rescale it. Let me assume that the vector has $2^n$ elements (if it's not a power of 2, you can pad it with extra 0s). For simplicity, I'm going to assume that $|b\rangle$ is real. Then, what I'...


1

You have the initial state $|000\rangle$. The first Hadamard gate on qubit zero sends the register to $\frac{1}{\sqrt{2}}\left(|000\rangle + |100\rangle\right)$. Then, the $\text{CX}$ controlled on qubit zero and target on qubit one takes the state to $\frac{1}{\sqrt{2}}\left(|000\rangle + |110\rangle\right)$. And the next $\text{CX}$ between qubit zero and ...


1

As mentioned by @user47787 This is yet another case of floating-point representation error at the machine level. This behaviour is language agnostic and has nothing to do with Python or Numpy or Qiskit. Related Reads: A very old post on stackoverflow discussing this issue - Is Floating Point Math broken ? Python docs describing the same - Floating Point ...


3

There's a few bugs in your code as well as a slight misunderstanding about the guarantees of the protocol. First to clarify some details: The protocol you implement samples $U \in \text{Cl}(2)^{\otimes 2}$ (not the same as $U\in \text{Cl}(2^2)$!) and then applies these operators pre-measurement. Up to global phase this is equivalent to performing local ...


1

As you've noticed, global phase is a problem here. One option that you could pursue (I'm not claiming it's a good option) is to use a two-qubit encoding. Let's say you want to encode a vector $u\in\mathbb{C}^2$ (you asked about real, which is obviously a simplifying case) $$ u=\left[\begin{array}{c} ae^{i\theta_1} \\ be^{i\theta_2} \end{array}\right] $$ ...


6

The two pages you link are using opposite conventions, the first defines \begin{align} R_z(\theta) &:= \exp(i \theta Z /2)\\ &= \cos (\theta/2) + i \sin (\theta/2)Z\\ &= \begin{pmatrix} \exp(i \theta /2) & 0 \\ 0 & \exp(-i \theta /2) \end{pmatrix} \end{align} The second page implies the definition \begin{align} R_z(\theta) &:= \exp(-...


0

It is meaningful to apply Quantum Error Correction (QEC) on post-measurement result with respect to the advance knowledge about physical behavior of qubits and quantum gates on QPU chip. Applying QEC on qubits while they are actively manipulated by a quantum algorithm (though quantum gates) will intentionally disturb the computation.


2

Although it is not explained up to that point in the Qiskit textbook, the quantum toss is in reality applying the Hadamard gate, denoted $H$. In matrix form, this operator looks like: $$ H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} $$ Now, we express the basis states in column form as follows: $$ \begin{gather} |0\rangle = \...


1

I think what you could do is measure the bits, and then possibly flip the answer based on whether a drawn random number is less than the error rate associated with the outcome, i.e the error rates of measuring 0 but really given a 1, and measuring 1 but really given a 0. However, doing this on actual HW is a bit more tricky. Namely all of the logic needs ...


Top 50 recent answers are included