Hot answers tagged

4

The function that handles this is transpile(), which could be found in qiskit.compiler. When you call transpile(circuit, backend) it goes through the compilation process for the input circuit based on the backend you provide. It returns a new circuit that will be valid to run on the provided backend. You can then view this new circuit just like you would ...


4

Simply it is the distance (similarity measure) between two quantum states, for example the fidelity between $|0\rangle$ and $|1\rangle$ is less than the fidelity between $|0\rangle$ and $\frac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big)$. or you can say it is the cosine of the smallest angle between two states, also called the cosine similarity


3

A density matrix $\rho$ on two qubits has 16 complex amplitudes (although not all are free variables due to constraints from normalization and Hermeticity), so the City plot is showing those amplitudes as well. The $|00\rangle\langle 11|$ and $|11\rangle\langle 00|$ amplitudes shown are not going to directly impact your measurement if you were to measure in ...


3

There is a way, though it is pretty hacky. Going off of the code you provided: qc.initialize(desired_vector, [q[0],q[1]]).gates_to_uncompute().draw() qc.decompose().decompose().decompose().decompose().draw() The first line will provide gates that uncompute intialize. However it will only show up as Multiplex gates. The second line is what decomposes the ...


3

The Q-Object not valid error you received is caused by the amount of shots you set. The max shots allowed is 8192. Since the amount of shots you set (16384) is greater than the max amount of shots allowed, you get that error. The TranspilerError is caused by the second format for layout. When I tested your code with the second layout, I received this error ...


2

Unfortunately this is not currently possible on the IBM devices. What you should really do is only have four classical channels and send your first two measurements to the first two classical channels, and the second two measurements to the second two classical channels. You then only execute the circuit once. However, you can try this and it still won't ...


2

Yes, compile is deprecated in favor of transpile and assemble. For your code, using these two new functions would look something like this: # Add to your import statements from qiskit.compiler import transpile, assemble # After creating qc_list backend = Aer.get_backend('qasm_simulator') transpiled_circs = transpile(qc_list, backend=backend) qobjs = ...


2

AHusain's answer is absolutely correct, but perhaps lacks some detail. The circuit that you want to implement is Basically, the key is to realise that you want to apply phase $e^{i\alpha}$ to the basis elements $|00\rangle$ and $|11\rangle$, and $e^{-i\alpha}$ otherwise. In other words, you care about the parity of the two bits. If you can compute that ...


2

You can't edit using python in the circuit composer. You can edit the OpenQASM which can be found on the left-hand side of the composer. If you would like to use Qiskit, this is also available through the Q Experience, you need to click on the Jupyter Notebooks. Here you can create circuits of your own, or modify the given examples.


2

The 403 error is a http error - Forbidden. It's comming from the server that is giving you access to the quantum computer, not from the quantum computer its self. If you are using IBM Q Experience you shuld check out the FAQ page. Regarding to credits it states: A User has a maximum of 15 credits, and these credits are replenished upon the greater of 24 ...


1

In the first circuit you only use 2 measurement gates on the first and second qubits. This means that the amount of outputs will behave similarly to a circuit that has only 2 qubits. If we were to list out all possible outputs, it would look like this: 0000, 0001, 0010, 0011. This is because the third and fourth qubits will always be 0, so you only have 2 ...


1

The devices are imperfect and also are periodically recalibrated. Any textual examples characterizing decoherence will probably never match exactly what you encounter in running the same code live.


1

This is occurring because you declare your definition rule on two registers, but the way nodes are added to the DAG, only one register will be added. It is defined over both the QuantumRegister "q" you define in the method, and also the register passed in to self.params. To fix this therefore you need to update your definition to work on only one register. ...


1

Answering based off of the extra clarity from your comments: Wanting to calculate the decimal value of all cr as opposed to the binary This can be done by using the Python built in function int(). This function will return the integer value of the input in base 10 (decimal). So you can retrieve the counts from the job by calling job.result().get_counts(<...


1

It might be worth mentioning the physical motivation for these definitions and the concept of fidelity itself. Unlike the classical computers we all know and love, quantum computers are fundamentally analog machines. what that means practically is that the gates you apply when you run code on a real quantum computer are going to be parameterized by a real ...


1

For pure states is the square of the overlap $|\langle \psi_1 | \psi_2 \rangle |^2$, for mixed state is the evaluation of the density matrix $\langle \psi_1 | \rho_1 |\psi_1 \rangle$


1

When you measure, you choose a bit where the result should go. If you measure to the same bit multiple times, then the results of all but the last will not be recorded. To get the results you want, you'll need to declare more bits. For example, you could use a couple of two-bit classical registers: one for the first pair of bits, and the other for the ...


1

Quantum algorithms provide a computational speedup by orchestrating constructive and destructive interference of the amplitudes. It is as if there must be a "minus" sign somewhere in the matrices - otherwise we merely work in the classical world, and would not see a computational speedup. Let's consider the following gates as controlled Pauli matrices: \...


1

The file editor only uploads, downloads and displays .ipynb files. However, you can create additional files using notebooks. To see that they are there, you can use the sys package. You won't be able to import from local .py files, but you can open them as a text file and do something like eval their contents as a workaround.


1

Simply implement the gate $$ \left(\begin{array}{cc} 1 & 0 \\ 0 & e^{i\theta} \end{array}\right) $$ on the control qubit.


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