# Tag Info

0

(Disclaimer: I don't know what's going on "under the hood" in Qiskit's initialize, my answer is based on Q# part of the question, but I suspect it's something similar.) The state of a quantum system is not something that can be directly initialized to the necessary state (quantum computing would've been a lot easier if it was possible!) Instead we ...

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 ...

0

In general, you need to use modular exponentiation algorithm. In Qiskit tutorial, I guess they saw some pattern to for that specific case to implement operator $U$. Yet you can use the following idea to create operator $U$. Let's suppose that $a=11$ and $N=21$. u is the matrix that corresponds to operator $U$. By using u, you should be able to create a gate. ...

1

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

0

Aer simulators will support what you're looking for very soon: https://github.com/Qiskit/qiskit-aer/pull/834

0

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 ...

0

may be you can define a function like below from qiskit import QuantumCircuit def qubitinitialize(n,n_init): #n = number of qubits #n_init = initial state of each qubit qc = QuantumCircuit(n) for i in n_init: if i == 1: qc.x(i) return(qc) This function will return a circuit with initial state as you provide in n_init n = 4 #...

0

Qiskit assumes that initially each qubitt is set to the $|0\rangle$ state. So if you have $n$ qubits, the initial state is $|00..0\rangle$. If you want to flip the state of some specific qubits, you have to apply an $X$ gate to each of those specific qubits. For example, the following code sets the $|11\rangle$ state: qr = QuantumRegister(2) cr = ...

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....

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 = ...

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

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.

0

I shall explain taking the case of a = 2. The process is the same for any other value of a you have mentioned. So to factor N = 15, you need the gates $U^4$, $U^2$ and $U^1$ gates. Where U performs the following operation $U|y\rangle = |yamodN\rangle$ $U^2|y\rangle = |ya^2modN\rangle$ $U^4|y\rangle = |ya^4modN\rangle$ We first apply $U^4$ then $U^2$ ...

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 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....

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 ...

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. ...

0

I think you can also use the method of composite gates which might be easier to implement. The idea is that you create a circuit with gates and then turn it into an instruction by using the to_instruction() method. Once you've done this, you can consider this instruction as a predefined gate and add it to your new circuit by using the append() method. Let me ...

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 ...

0

There is a Graph State circuit available on IBM Qiskit. Graph state preparation circuits are Clifford circuits, and thus easy to simulate classically. However, by adding a layer of measurements in a product basis at the end, there is evidence that the circuit becomes hard to simulate. The circuit prepares a graph state with the given adjacency matrix. Given ...

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()

0

There are practical examples in Qiskit on how to use common probability distributions with uncertainty models. Let us refer to the following example from Qiskit-AQUA (Algorithms for QUantum computing Applications) on using amplitude estimation algorithm to evaluate a fixed income asset with uncertain interest rates. import numpy as np from qiskit import ...

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.

-3

In my development Anaconda environment, I faced similar issues related to setup, I too observed alike issues asking by peoples in big open forums, I suggested the below approach where they respond back it's working for them. There are many causes related too Setup.py but I would suggest you the common approach to resolve. It usually comes when your Anaconda ...

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:

0

You only defined the gate, but not you haven't added the according method to the circuit. Add the following to the QuantumCircuit class: def l(self, qubit): # adjust this import to the location of your gate from .library.standard_gates.l import LGate return self.append(LGate(), [qubit], []) See for instance here how it works for ...

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.

0

You're getting the 403 because ibmq_16_melbourne is currently offline for maintenance. You can checkout the status of each backend on the IBM Quantum Experience website, or do backend.status().operational. Furthermore, you can get the least busy operational backend with something like from qiskit.providers.ibmq import least_busy backend = least_busy(provider....

1

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

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 ...

0

Qubits are initialized at 0 so would you be wanting to flip certain qubits to 1? I’m tempted to just apply x gates to obtain the necessary bits. For example: |ψ⟩=...+|1010101⟩+... from qiskit import QuantumCircuit qc = QuantumCircuit(7) qc.x([0, 2, 4, 6]) I hope I understood your question :)

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!

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! :)

0

As it is said in the comment of your question, a good reason for this may be that for larger molecules it will have to take more time to solve the problem. If you want to see your job status or monitor it, you can try to use the method job.status() (see details here) or try the job monitor, you can see if it fails or if it runs with those.

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....

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 ...

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 ...

Top 50 recent answers are included