# Tag Info

0

i did the hamiltonian simulation with minus sign, but in QPE, I don't have to consider it

4

The number of qubits is part of the backend configuration: FakeManhattan().configuration().n_qubits 65 If you need to filter the list of mocked backends based on the amount of qubits: from qiskit.test.mock import FakeProvider provider = FakeProvider() [ b.name() for b in provider.backends() if b.configuration().n_qubits > 20] ['fake_cambridge', '...

6

The IBM circuit composer used to be also known as IBM Quantum Experience, or IQX for short. For those historical reasons, the name of the style is iqx: from qiskit import * circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.t(1) circuit.draw('mpl', style='iqx') Compare with the composer look:

0

I found the answer on my own. In case someone has a similar problem: You can use the standard measure() function in the quantum circuit. When you assemble you can specify meas_level=1 which returns the raw measured data without running it through a classifier. Then you can build your own classifier.

5

That’s possible, just do circuit.draw('mpl', style='iqx')

2

I think you underestimated how long your circuit really is.... When running your circuit on the hardware, it has to be transpile into the set of gates that is known to the hardware. For IBM machines, these are $\{ CX, ID, RZ, SX, X \}$ . Furthermore, there is a constraint on the qubit layout of the hardware as well. Not all qubits are connected. Thus there ...

1

On the Qiskit slack there have been others who have the same issue connecting to Quantum Lab. A 503 Service Unavailable Error may be due to service maintenance or being overloaded. You may have to just wait for the server to return.

5

If you have an ideal quantum circuit, you can easily get its superoperator representation using qiskit.quantum_info.SuperOp as follows, qc = QuantumCircuit(1) qc.x(0) super_op = SuperOp(qc) array_to_latex(super_op) The output will be $$\left[\begin{matrix} 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 1 & 0 ... 0 Programmatically, you have to do the following: from qiskit import IBMQ IBMQ.load_account() provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main') print(provider.backends()) 1 Yes, you can do that without a problem. They only control the total number of experiments or jobs that you have submitted simultaneously. As long as the total number of submitted jobs (currently 5) are met with your account, regardless of the specifications from where they are submitted, it is ok. Good luck! 4 You can do this as follow: Specify your circuit then transpile it to the backend of interst. transpile_circuit = transpile(circuit, backend) Convert this to DAG (Directed Acylic Graph) dag_circuit = circuit_to_dag(transpile_circuit) count all the operation in the longest path: dag_circuit.count_ops_longest_path() Explicit example: Says you have the ... 0 Your description sounds like the notion of depth. You can get the depth of a circuit in Qiskit with the depth method: https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#qiskit.circuit.QuantumCircuit.depth circuit.depth() 3 This is just a quirk of how complex numbers are implemented in Python/Numpy, etc. At the end of the day, these are represented as floating-point numbers within the target simulator. These are then transformed via various mathematical operations to implement the simulation and this eventually leads to an accumulation of round off error. For all intents and ... 1 I think the widget is supposed to only show you the initialization and Oracle part of the circuit and not actually implement the measurement process into it. Thus, that is why you don't see the measurement step. However, it is quite simple to write a function for perform the Bernstein-Vazirani algorithm. You can just use the script below: import numpy as np ... 5 Good question! Short answer: No. It is true for search problems with only one solution but does not hold for search problems with more than one solution. For the long answer, I will need to define some terms (I'll try to use most of the same notation as in the Qiskit tutorial). Suppose we wish to search through N elements, and that the search problem has ... 1 According to the docs of scipy and qiskit, the first uses primitive root \omega = e^{-\frac{2\pi i}{n}} and the second uses \omega = e^{\frac{2\pi i}{n}}. This implies that one matrix is complex conjugate of the other (which is the same as inverse). 4 For n > 2 qubit gates the Qiskit transpiler uses column-by-column decomposition (see: https://arxiv.org/pdf/1501.06911.pdf). Source: https://www.youtube.com/watch?v=O2WcZS4yO1Q (comment section) 0 Analogy to numbers in binary format: number 2 = b10 (2 bits) number 6 = b110 (added 1 bit , and it is the highest bit) If 6 is represented as an array: arr=[0,1,1], that is what we would expect but it is the opposite order as binary representation. For qubits, the register is created the same way. Mathematicians could explain nomenclature better but in bra-... 5 Suppose \langle\phi|\psi\rangle = re^{i\theta}. As you have noticed, if we have access to multiple copies of the state, then we can measure r using the SWAP test. Now, consider the state |\psi'\rangle = e^{-i\theta}|\psi\rangle and note that$$ \langle\phi|\psi'\rangle = e^{-i\theta}\langle\phi|\psi\rangle = e^{-i\theta}re^{i\theta} = r. $$Since |\... 2 The reason for your second result is because unitary synthesis is not part of the SolovayKitaevDecomposition pass. Actually, you can combine your attempts to get the desired result. This is the first stage (you first snippet), it will synthesise your circuit in terms of u* and cx: from qiskit import QuantumCircuit from qiskit.quantum_info import Operator ... 3 The first thing I will mention is that the target state you specified,$$|\psi\rangle = 50.40|0\rangle + 35.80|1\rangle$$is not a valid quantum state, because the probabilities do not add up to one.$$|50.40|^2 + |35.80|^2 = 3821.80 \neq 1 $$However, we can normalize your equation,$$|\psi\rangle = \frac{50.40}{\sqrt{3821.80}}|0\rangle + \frac{35.80}{\sqrt{...

4

You can definitely run this on a real quantum computer! In your snippet above you mixed circuits and operators. A circuit is only used for the ansatz of your ground state, not for representing the operators. The website you provided talks about the Hamiltonian in terms of the Pauli X and Z matrices; $\hat\sigma^x$ and $\hat\sigma^z$. If you want to compute ...

2

The reason for your error is that you are running on a backend that does not support CH. The function execute works because it runs transpile before, adapting the basis. However, if I understand the spirit of your question, you can quickly get the unitary of any circuit using kaleidoscope, a very nice 3rd-party Qiskit extension. It can be installed with pip ...

3

As it is written in the error message, it is here because the CH gate is not in the basis gates of UnitarySimulator, therefore the backend doesn't understand it and can't do anything with it ; check this line of code : 'ch' in UnitarySimulator().configuration().basis_gates It returns False. Now I believe it has the error with the run method and not the ...

0

Thanks for the comments. If I use python 3.7.3 (3.8 won't work) + qiskit 0.23.5, I can get fidelity = 1.

-1

no you can't. you take the exam on an app that closes all other applications when launched.

1

2

Number of states marked isn't a strict correspondence with number of CZ gates: your new oracle still marks two states, but, rather than $\left|101\right>$ and $\left|110\right>$, it marks $\left|101\right>$ and $\left|111\right>$. To see this, remember a $Z$ gate flips the sign of a $\left|1\right>$: if the $Z$ gate is applied to a 1 and the ...

1

To use the GaussianForcesDirver in Qiskit, you either need an output file generated by Gaussian (such as this .log file from the tutorial). Or you need an installation (and hence also a license) of Gaussian, as stated in the Qiskit documentation here: The drivers in the chemistry module obtain their information from classical ab-initio programs or libraries....

0

From a more fault-tolerant perspective, https://arxiv.org/abs/2101.10279 also tackles this problem. Disclaimer: I am one of the authors :)

5

You can specify the target basis for instance using transpile: from qiskit import transpile target_basis = ['rx', 'ry', 'rz', 'h', 'cx'] decomposed = transpile(circuit, basis_gates=target_basis, optimization_level=0) # 0 for no optimization, 3 is max Note that the target basis should be complete (e.g. rz h ...

0

Have a look at this recently published paper presenting a protein folding quantum algorithm. This work was done using Qiskit and the algorithm will soon be published as part of the new Qiskit Nature package.

1

Measurements in a VQE (also in Qiskit) are performed as projective measurements. Have a look here for a related question in Physics SE. Citing from Nielsen and Chuang's book "Quantum Computation and Quantum Information": A projective measurement is described by an observable, $M$, a Hermitian operator on the state space of the system being ...

0


0

I believe these links can help solve your problem: https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.VQE.html https://qiskit.org/documentation/apidoc/qiskit.aqua.operators.expectations.html https://qiskit.org/documentation/tutorials/noise/1_hamiltonian_and_gate_characterization.html

2

No symbolic computation software with quantum circuits built in The asker has clarified in this comment that they want a symbolic computation software in which the user does not "have to manually define circuits in terms of matrix multiplications", and the question says that the software cannot "force you to encode the matrix of each gate ...

1

After checking, this issue was introduced in the last qiskit-terra release. The textbook should be fixed to adjust the get_counts, as already reported here. In any case, the workaround for now is removing self._circuit from result = job.result().get_counts(self._circuit) (in QuantumCircuit.run method). class QuantumCircuit: ... def run(self, thetas):...

3

The important point to understand is that you lose the superposition and obtain a classical mixture of states $|0\rangle$ and $|1\rangle$ on the first qubit. If you look at the circuit diagram below: Before applying the reset you're in a Bell state (green). As you apply the reset, you effectively remove the qubit from the system, you can think of it as ...

4

I can think of several ways to work with that many qubits. First, via the simulators of Aer, by using the matrix product state simulation method for example. The main idea is to write the statevector so that, as written in the tutorial, "the size of the overall structure remains ‘small’ for circuits that do not have ‘many’ two-qubit gates. This allows ...

3

Although the documentation says that the entanglement_blocks parameter can be specified via the name of a gate or the gate type itself, not all gates can be used this way. You can check the code to get the list of supported gate names. Since "pass by name" is not supported for iSWAP, you can use the gate type: ansatz = TwoLocal(num_spin_orbitals, ['...

2

According to this link, IBM does not implement Reset instruction as a swap gate between the target qubit and a new ancilla qubit in the $|0⟩$ state. It is implemented as a not-gate conditioned on the measurement outcome of the qubit Which means your circuit is equivalent to the following circuit: This should explain the results you have obtained.

4

I think it is something Qiskit used to have but got lost in a refactoring. I'm adding it back here https://github.com/Qiskit/qiskit-terra/pull/6184 (with a regression test so it does not happen again) and it will probably be released in the next qiskit-terra patch version (0.17.1). Here is your example (including displaytext): from qiskit import ...

0

Short answer, 'no'. Long answer: I think a lot of mystery about quantum mechanics has the possibility to disappear when we do simulations, like the ones you are suggesting. For my answer, I will assume that whatever you are going to do with your 4 (or larger) qubit system, it will be at least 'entangled', in the sense that the final state is not a product ...

0

I am confident that you cannot simulate 40 qubits full-statevector on your 16GB RAM. For a 40 qubit simulation, you would require a RAM of 16TB, not GB. So I would strongly suggest checking your circuit. I cannot speak for how Qiskit works under the hood, but usually, all simulators sample from the underlying statevector, and there is no way to store the ...

2

What I would do here is get back the raw results of your res, and there are stocked the parameters of the Ansatz you are looking for : my_res = res.raw_result # The dict of each parameter and its associated value my_param_dict = res.raw_result.optimal_parameters # The array of all the values my_param_list = res.raw_result.optimal_point print(my_param_dict) ...

1

Thanks for providing all your code. I have looked through it, run both notebooks, and can confirm the difference in the run times. Since you have pretty large amount of the code I have not studied everything till the last line, but I came up with a suspicion when I looked at the Ruslan's code. The profiler output just confirmed what I suspected. Yes, you are ...

-1

You can count the number of single and two qubit gates of your quantum circuit. All you need to do after that is to multiply number of single qubit gates with T1 and number of two qubit gates with T2 and then find an average running time for the whole circuit. Transpiling and being in queue aren't part of running time.

4

Short answer: The units of your result will be the same as the units of your input problem to VQE (units of your Hamiltonian coefficients). Long answer: In a VQE calculation, some problem Hamiltonian is mapped to a representation that is suitable for implementation in a quantum circuit. Often, this means mapping all Hamiltonian operators to strings of Pauli ...

Top 50 recent answers are included