Hot answers tagged

4

Your states differ in global phase only, hence they are indistinguishable (or in other words they are equivalent). Therefore you do not need to apply gate $-I$. Note that the global phase is $\pi$ as $-1 = \mathrm{e}^{i\pi}$ However, in case the state is produced by controlled gate, global phase cannot be neglected. In that case you can implement ...


4

You want to implement $$ e^{i3\pi/4}e^{iX\pi/4}. $$ I would rewrite this as $$ e^{i3\pi/4}He^{iZ\pi/4}H. $$ This is the same as $$ -HS^\dagger H $$ in standard gate terminology. If you're only implementing the gate $e^{iAt}$, then you can neglect the global phase and just implement $HS^\dagger H$. Both of these gates are readily implemented in qiskit as sdg ...


4

There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The QuantumCircuit.squ method takes a unitary 2x2 matrix $U$ and a qubit and computes the decomposition $$ U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma) $$ This is a common decomposition, you can find a proof here https://arxiv.org/pdf/quant-ph/...


3

In Qiskit, the bits are reversed order from most textbook definitions. That is to say the zeroth qubit is the farthest to the right in a bitstring or tensor product.


3

1) In this step, you connect a teleported qubit with entangled qubits between Alice and Bob. This means, Bob now has an "access" to the teleported qubit. 2) Here you get some information about the teleported qubit and "partially colapse" Bob's qubit according to a state of the teleported qubit. 3) In this last step you bring information about the ...


2

The first matrix is generally seen in books, as you consider computational basis in the order $|0\rangle$, $|1\rangle$, $|2\rangle$, $|3\rangle$ or in bitstrings $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$. So basically, you think as $| q_0, q_1\rangle$. This is called little-endian convention. But in Qiskit, they use the inverse, aka big-endian ...


2

Here the subscripts are of the form $1i$, where $i$ is the label of the subsystem (recall that you are using two qubits for this $\left|\psi\right>_0=\left|00\right>_{1}$). So any product of subscripts can be written as $\left|q_0\right>_{10}\left|q_1\right>_{11}=\left|q_0q_1\right>_{1}$ with $q_0,q_1\in\{0,1\}$ in this convention, which makes ...


2

The objective of the portfolio optimization problem is to trade off expected return ($\mu^T x$) with the risk taken ($x^T \Sigma $x). This could be achieved by introducing a constraint on the risk, e.g. $x^T \Sigma x \leq R$, for an acceptable risk level $R$ and then maximize the return under this constraint. However, this is not a QUBO, i.e., it cannot be ...


2

I think this is enough $e^{iAt}= e^{i(1.5I)t} e^{i(0.5X)t}$ for constructing the circuit. From rx and u3: $$R_x(-t) = e^{i(0.5X)t} \qquad R_x(\theta) = u3(\theta, -\pi/2, \pi/2)$$ The $e^{i(1.5I)t}$ is a global phase gate that can be implemented via the following circuit for q[0] qubit. Here is the whole circuit for the $e^{iAt}$: # Rx part circuit.u3(-t, -...


2

The Qiskit backends (quantum devices or simulators) work only when you explicitly invoke them, usually with execute. The code in your snippet does not call qiskit, and runs on a traditional machine.


1

The Ising model is a formulation of your problem. Variables are variables $s_i$ that can take +1/-1 values. $$ \begin{equation} \text{E}_{ising}(s) = \sum_{i=1}^N h_i s_i + \sum_{i=1}^N \sum_{j=i+1}^N J_{i,j} s_i s_j \end{equation} $$ For a quantum form, we use spin operators $\sigma^z$, giving you an Ising Hamiltonian, whose eigenvalues correspond to the ...


1

As Martin Vesley has mentioned in his answer, there are some error correction techniques that require additional qubits and gates resources, and how we know the resources of nowadays QCs are limited, and that's why those techniques are not so useful today. But in 2017 new error correction techniques were proposed that don't require additional gates/qubits. ...


1

I'm not sure what had caused the problem but I was able to solve it and most likely know what the problem was. Consider these two lines from my code above: job_exp = execute(qc, backend = backend, shots = 8192) exp_result = job_exp.result() Problem with the above lines is that we are not waiting for the actual quantum device to compute and send over the ...


1

EDIT: I believe this is solved in @IEIrodov's answer below. I'm not sure what's causing the issue, but based on similar issues on the qiskit slack channel, I don't think it's something you're doing. As a workaround, try running: exp_result = job_exp.result() exp_measurement_result = exp_result.get_counts() print(exp_measurement_result) plot_histogram(...


1

There is more information towards the end of the tutorial here but essentially how you do this is you run both circuits on the state_vector simulator and then you can use the function state_fidelity to work out the fidelity between the two states. The code to do this should look something like this from qiskit.quantum_info import state_fidelity # set up ...


1

If that is all you want to do then SciPy is really the way to go. Indeed, qiskit just wraps that functionality when requesting a classical answer. In SciPy you can use scipy.linalg.eig. You can find examples of using this function in the documentation.


1

What I have obtained by running 4 times the same code on "qasm_simulator": {'00': 4656, '01': 1613, '10': 185, '11': 1642} {'00': 4564, '01': 1735, '10': 179, '11': 1618} {'00': 4581, '01': 1646, '10': 184, '11': 1685} {'00': 4602, '01': 1684, '10': 181, '11': 1629} Here we don't have noise, but still, the results are different. So, one can expect some ...


Only top voted, non community-wiki answers of a minimum length are eligible