Hot answers tagged

7

ibmq_qasm_simulator performs the simulation on a classic computer on that resides on the cloud, whereas qasm_simulator does it locally on your computer and consumes your CPU.


7

You can also check their equivalence using Operator, a class from the Qiskit's quantum_info module as follows. from qiskit import * from qiskit.quantum_info import Operator import numpy as np Build and convert each circuit to an operator.( used your name convention for the circuits ) The code below builds and converts the first circuit qrz to op1 qrz = ...


4

Yes, they should be. You can check their statevector to confirm that they indeed generate the same state. First, you can generate some arbitrary initial state and use the following two methods to show that they generate the same statevector. For instance: init_circ = QuantumCircuit(3) init_circ.ry(2.5,0) init_circ.ry(1.2, 1) init_circ.ry(0.5, 2) print(...


4

You can take only the keys of the returned dictionary: measurements = set(counts.keys()) print(measurements) If you want only one random key, you can just take the first one in the set: random_key = next(iter(a)) or store all the keys in a list and take a random one from here: from random import randint measurements_list = list(measurements) random_key = ...


4

Looking at the documentation for qiskit.result.Result.get_counts(), this doesn't seem to be a native option. A good alternative to this is the following: counts.get('1', 0) Which will return 0 if the key '1' is not present in the counts dictionary. You can loop through all possible $\{0, 1\}^n$ states and create a new dictionary with all the padded counts ...


4

Yes. In general, a trivial construction of controlled-$U$, given a circuit for $U$ is to make every circuit element controlled off the control qubit. However, this introduces more overhead than necessary. If you have a part of your circuit that looks like $VWV^\dagger$, it is only necessary to make the $W$ controlled because the $VV^\dagger$ cancel in the ...


4

tl;dr Indeed, if at any point one would need to compute and store $2^n\times2^n$ unitary of the circuit in memory that would be infeasible and render the quantum computation obsolete (it may still be useful for benchmarking NISQ computers though). Transpilation mostly works either with individual 1- and 2-qubit gates or with the whole circuit but not as a ...


3

Yes, but it has more to do with extracting data from the result and not so much with job manager. Method 1, use the circuit index. If your circuits are always in the z, x, y order, then you can do something like memory_z = [] memory_x = [] memory_y = [] for i in range(len(all_circuits)): mem = results.get_memory(i) if i % 3 == 0: memory_z....


3

In general, measurement errors do not change on timescales as fast as you are implying here. The data for the readouts is populated once a day or so, and is quite good over that time frame. There are internal health checks that get run, but this is my no means frequent or "live" in the sense that you are probably looking for here. So, in short, ...


2

Partial answer After discussing this with someone and going back through the API documentation on dynamical decoupling, it was clear on how these numbers were chosen. They corresponds to the gate duration time on the specific device in use. Which makes sense as why the specified durations in the questions are different. I didn't read the documentation ...


2

As you say, the difference is in the global phase. Let me explain using the first of your examples, $$ \left[\begin{array}{cc} \frac{1-i}{2} & \frac{1+i}{2} \end{array}\right]. $$ Mathematically, this is the same as $$ \left[\begin{array}{cc} \frac{e^{-i\pi/4}}{\sqrt{2}} & \frac{e^{i\pi/4}}{\sqrt{2}} \end{array}\right]=\left[\begin{array}{cc} e^{-i\...


2

The maximum optimization level (level 3) is noise-aware. That means that considers the noise reported by the backend to allocate qubits and tries to maximise fidelity. As a consequence, transpiling for different backends might end up with different allocations. From the level 3 passmanager documentation (emphasis mine): Level 3 pass manager: heavy ...


2

This is due to how the $\mathbf{A}$ matrix was defined; from that same tutorial page we have: $$\tag{1} \mathbf{A} = \sum_{n} c_n A_n $$ where each $A_n$ is unitary and $c_n$ is complex (and in the original VQLS paper they further impose $\lVert {\mathbf{A}}\rVert<1$ and bounded condition number) but $\mathbf{A}$ is never required to be unitary. Therefore,...


2

As you are asking specifically for the evaluation of the energy only, I will be brief. I will assume that you have a init_state (a quantum circuit) that produces the the Hartree-Fock wavefunction or any other wavefunction you like to test. I could not find a Qiskit function that provides the energy expectation value of a given wavefunction, given some ...


2

In order to understand why this does not work, let us consider the circuit you've created with two measurement qubits: Running this circuit using the following code: backend = Aer.get_backend('aer_simulator') job = execute(mycircuit, backend) result = job.result() result.get_counts() yielded for me: {'11': 499, '01': 525} If we write down the state you ...


2

The recovery operator $R_{xz}$ is the same one as you would apply when doing quantum state teleporation $R'^\dagger_{xz}$ will be some combination of Clifford gates and Pauli gates, the latter classically conditioned on the Bell basis measurement outcome. I think that a single qubit ($n=1$) will be sufficient to demonstrate whats going on here. Let the ...


2

Well, let the quadratic equation be in the form $$x^2+2bx+c=0 $$ You can write any quadratic equation in this form by dividing with the principle coefficient. Therefore, what you are trying is to design a unitary map $U$ such that, $$U\left(\begin{array}{c} b \\ c \end{array}\right)= \left(\begin{array}{c} -b+\sqrt{b^2-c^2} \\ -b-\sqrt{b^2-c^2} \end{array}\...


2

It depends on your local environment and local configuration. By default if you're running on Linux with Python < 3.9 or macOS with Python < 3.8 then passing mutiple circuit's to transpile() will run in multiple process locally. This is done using Python's ProcessPoolExecutor to launch parallel processes and call transpile on each circuit in the input ...


1

Large datasets will not necessarily reduce the performance of an quantum kernel SVM (a Support Vector Machine trained classically using a kernel function evaluated on a quantum computer). You should actually expect the opposite: Training on larger datasets will reduce the generalization error and improve classifier (test) performance provided that you are ...


1

One of the pre-coded cells in the lab has the command backend. If you execute the cell with the command backend after running the command import qiskit.tools.jupyter, the widget will be opened for the backend. The widget shows the chosen backend information graphically and one of the tabs is called error map showing the qubit connectivity with all kinds of ...


1

Can you try running this code and posting a screenshot? runtime_backends = provider.backends(input_allowed='runtime') print(f"Backends that support Qiskit Runtime: {runtime_backends}") Afaik, qiskit-runtime is not available on quantum backends in the open free to access tiers. The only backend I know of that works for qiskit-runtime as of the time ...


1

The Qiskit units are unitless and require the drive Hamiltonian provided by the backend to link the program into a simulatable format. Keep in mind the Hamiltonian unit's are angular frequencies. Real hardware often has transfer functions and non-linearities that are not captured by the simplistic Hamiltonian that is returned, unless you account for these in ...


1

In a similar way to how the global phase difference of a state makes no physical difference, neither does amplitude of a state. We normalise states to have unit magnitude for mathematical convenience in the same way we don't carry around an $e^{i\phi}$ factor for arbitrary $\phi$ with all our states. This is because having unit vectors means we don't need to ...


1

The state you obtain is the following one: $$\frac12\left(|00\rangle+|01\rangle+i|10\rangle+i|11\rangle\right)$$ instead of: $$\frac12\left(|00\rangle+i|01\rangle+|10\rangle+i|11\rangle\right)$$ You can see that the difference between these two states is the fact the the $\frac\pi2$ phase (that is, the $i$ factor) is placed on the states that have their ...


1

First, make sure to sync your IBMQ account. You can add in your IBMQ API token: Once you do this, you can click on the hardware tab and see that your IBM Q account has linked to here. Now you can create and run your circuit as the template given to your by StrangeWork: import strangeworks.qiskit import qiskit qc = qiskit.QuantumCircuit(2, 2) qc.h(0) qc....


1

You can also obtain the states at any point during circuit construction using Statevector, the class from Qiskit's quantum_info module as follows. First, import the Statevector class, from qiskit.quantum_info import Statevector And for your example, the code below will produce all the intermediate states that you want. qc = QuantumCircuit(2) st0 = ...


1

If you don't want to write your own function to do this then one way to do this is through qiskit pauli_measurement. For example: from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit.quantum_info import Pauli from qiskit.aqua.operators.legacy import pauli_measurement qr = QuantumRegister(4) cr = ClassicalRegister(4) qc = ...


1

Qiskit has already a tutorial on protein folding using Qiskit Nature: Qiskit Nature tutorials - protein folding


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