# Tag Info

0

The code for finding the expectation value for the $Z \otimes Z \otimes ... \otimes Z = Z^{\otimes n}$ operator after having the counts from Qiskit's get_counts() function. Here expectation_zn is the $\langle \psi | Z^{\otimes n} | \psi \rangle$. expectation_zn = 0 for key in counts: sign = -1 if key.count('1') % 2 == 0: sign = 1 try: ...

0

If you really want to simulate measurement, that's how I would do it. A function that finds probability amplitude associated to each eigenstate. import numpy as np import itertools from qutip import basis, tensor, snot def prepareMeasurement(N, psi): # all the spin configurations confs = list(itertools.product([0, 1], repeat=N)) # probability ...

2

I would just like to share a code for testing a phase measurement on IBM Q: OPENQASM 2.0; include "qelib1.inc"; qreg q[1]; creg c[1]; //measuring theta in //(|0> + |1>*exp(i*theta)) h q[0]; //(|0> + |1>) t q[0]; //(|0> + |1>*exp(i*pi/4)) //s q[0]; //(|0> + |1>*exp(i*pi/2)) //u1 (pi/8) q[0]; //(|0> + |1>*exp(i*pi/8)) h q[0]; ...

2

Answer to the second question: Here is the circuit for measuring in $M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle \right) \right\}$ basis. I assume here that $\theta_k$ is given: circuit.u1(theta_k, q[0]) # q[0] is one of the qubits circuit.h(q[0]) circuit.measure(q[0], c[0]) #c[0] is a ...

1

There's one more way: Create two identical qubits on the Bloch sphere (this is start with 0 and apply the same random rotational gate). Then, apply a CNOT gate followed by a Hadamard gate to the first qubit to perform a measurement in the Bell basis. You will measure 00, 01, 10 (which are equivalent to the 3 symmetric Bell states) with equal probability ...

0

1) This equation is at best confusing, and at worst perhaps even straight-up wrong. Firstly, they use a different edge contraction notation as in the equations description and secondly, as you observe, they appear to have a Z operator acting upon qubit $v^{\prime\prime}$ which is no longer a vertex of the edge-contracted state. Perhaps the Z-operators on ...

1

What you're talking about is called a "projection". The projection onto basis state $|\psi\rangle$ is given by: $P_{\psi} = |\psi\rangle\langle\psi|$. Any measurement operator $M$, such as $Z$ can be written as the sum over projectors, weighted by their respective eigenvalues, such that $M = \sum_i \lambda_i P_i$ where $\lambda_i$ is the real-valued ...

1

I contacted @fran-cabrera from the IBMQ team and he could reproduce the bug! The problem is with the visualization of the transpiled circuit, not the execution (the result should be correct). The team is working on solving it and they expect to deploy a fix at the end of the week. I ran you example in Qiskit and it seems to work IBMQ.load_account() ...

3

Currently IBM Q does not support IF statement on real quantum processor. The IF can be used on simulator only. However, there is a theorem stating that quantum gates controlled by classical register can be replaced by those controlled by qubits before measurement. So, you can simply replace the statement measure q[1] -> c[1]; if (c == 1) x q[2]; by cx ...

0

If we have prepared an arbitrary anzats/trial two-qubit state: $$\psi = a |00\rangle + b |01\rangle+ c |10\rangle+ d |11\rangle$$ And we want to calculate the expectation value of individual Pauli terms of this Hamiltonian that is the two qubit case of the used one in the VQE Cirq example:  \langle H \rangle = \alpha_1 \langle Z_1 Z_2 \rangle + \alpha_2 ...

Top 50 recent answers are included