Hot answers tagged

5

It's not a bug, if you don't give concrete names to the registers then Qiskit will number them increasingly. If you want them to have the same name, you can do that like from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister qr = QuantumRegister(2, 'q') cr = ClassicalRegister(2, 'c') circuit = QuantumCircuit(qr, cr) circuit.draw()


4

Here is a circuit that can create the desired state (similar ideas were discussed in this answer), if all mentioned measurements yield $|0\rangle$ state: or in a more compact form (the circuits are constructed via quirk). The first three qubits are ancillary qubits and the rest are the qubits where $|0_L\rangle$ will be created if after the measurements all ...


3

Yes, if we have fixed backend, number of qubits, and noise model (e.g., Basic device noise model in https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.html#qiskit.providers.aer.noise.NoiseModel), we would have a fixed calibration matrix. I think the advantage is that once we have this calibration matrix, we can use it to perform ...


3

I tried to run your code with the same backend as you, ibmq_ourense, and also got the same kind of bad results. Although, I also tried on other backends, first the ibmq_qasm_simulator and I got the exact expectation value, so I assume there is no bug on your code since it is right with the ideal machine. I also tried with ibmq_vigo, which has a better ...


3

As mentionned by Michele, with qiskit Aqua algorithms you can easily implement Grover or BV. Here below an example of BV algorithm. Note that the number of qubits is directly related to the size of the hidden number (and so the size of the Oracle). You can easily create Oracle from a thruthtable or logical expression. from qiskit import * import matplotlib....


2

I think in this case you can split the experiments into multiple jobs. The idea is that you split measurement calibration circuits generated by complete_meas_cal into a number of batches, execute the first batch and use the corresponding results to initialize a measurement correction fitter with CompleteMeasFitter. Then you can use the CompleteMeasFitter....


2

This link was shared in the Qiskit Global Summer School Discord channel. https://join.slack.com/t/qiskit/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv~A I hope this works for you!


2

To remove the last gate you can do qc.data.pop(). Example: qc = QuantumCircuit(1) qc.h(0) qc.draw('text') output: ┌───┐ q_0: ┤ H ├ └───┘ Then: qc.data.pop() qc.draw('text') output: q_0:


2

Yes it is possible! However you need to make some small changes to the circuit. In the paper An Experimental Study of Shor's Factoring Algorithm on IBM Q They have factored 12,21 and 35 using something called the Kitaev approach. In Shor's algorithm, you perform the QFT in such a manner that the entire answer is given to you at once. However if you instead ...


2

I would suggest you use the code from the tutorial about quantum state tomography, adapting it to a real device of your choice. You can find the updated tutorial here Caveat: as state tomography requires 3^n circuits, you will need probably to find a method of batch processing of these circuits if they exceed the job circuit limit of your real device. See ...


2

c_if must be used on an entire ClassicalRegister. However, it is still possible to use it on a single classical bit. You would need to create a ClassicalRegister of size 1, and attach that to your circuit. This would be the register that you input into the c_if call. from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister c1 = ...


2

The Qiskit documentation is included in the Qiskit Github repositories, so if you clone the Qiskit repositories locally, you'll have full access to the documentation offline. Alternatively, you could use something like HTTrack to download and access the documentation website offline. The Qiskit textbook is probably the best resource for learning Qiskit. ...


1

"what are the advantages and disadvantages in the determination of the calibration matrix each time that we do an experiment and mitigate its error?" Advantage: The noise matrix will be a more accurate description of the current noise situation. My understanding is that each day, the qubtis are cooled from 300K all the way down to about 15mK, and ...


1

Well try doing this as it worked for me IBMQ.save_account("your_API_id", overwrite=True) provider = IBMQ.load_account() provider.backends()


1

You can also create a Statevector, that can be directly initialized as follows: from qiskit.quantum_info import Statevector sv = Statevector.from_label('11') You can use sv.evolve(qc) to apply an operator/circuit to the state, where qc is the operator/circuit. sv.data gives you the numpy array, containing the actual implementation of the state. Check this ...


1

@Cryoris answer is perfectly valid, but a more "Pythonic" way of doing this is with the help of the with keyword: import warnings with warnings.catch_warnings(): warnings.filterwarnings("ignore", category=DeprecationWarning) # Run VQE here, respect the identation. # /!\ At this level of identation, warnings are no longer ignored....


1

You can add the following before running the VQE to suppress the deprecation warning import warnings warnings.filterwarnings('ignore', category=DeprecationWarning) # run VQE here That turns all the deprecation warnings off, if you want to turn them on again you can add warnings.filterwarnings('always', category=DeprecationWarning) I don't think there is a ...


1

Several quantum circuit representations for common distributions are given in uncertainty models. For generic probability distributions, you can train a quantum circuit representation using quantum generative adversarial networks. For a respective tutorial, please see here.


1

Consider https://ibm.co/joinqiskitslack the Slack link, it's always updated to a working invitation link.


1

I believe there are several developments about this on Qiskit to make the use of Pulse easier. Try to check the PR or the issues regarding Pulse, maybe you'll find what you are looking for. I also found an issue about a QASM 3.0, I think this will interest you! :)


1

I have found the solution! The problem is that each time you use the transpile function, it generates a different transpiled circuit and the order of the outcome is not necessary the same as the order of the input, so you have to use swap gates to obtain the correct one. In order to always obtain the same circuit you have to fit the seed_transpiler (as with ...


1

All your real parts and imaginary parts are interchanged. Have you used complex(1,0) instead of complex(0,1) or something similar? Without the code one can only guess. Hope you can resolve it.


1

This Qiskit tutorial does what I think you're looking for; with the cnx() function. It uses this paper to decompose the CNOT gate without ancilla qubits. Let me know, if this helps you.


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