Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

8

You won't find the barrier in quantum computing textbooks because it isn't a standard primitive of quantum information theory like unitary gates and quantum circuits. The barrier as a directive for circuit compilation to separate pieces of a circuit so that any optimizations or re-writes are constrained to only act between barriers (and if there a no ...


3

Check out the resources on this page especially the textbook as that starts from the very fundamentals and works up. There are also tutorials to teach you about the basics of quantum computing and work up to very complex topics. As for resources in Spanish, if you join the qiskit Slack community there is a channel #spain where they discuss quantum computing ...


3

If you call initialize in this case, you will be specifying a general state in $\mathbb{C}^8$. However what you have is more specialized. For example only having 4 nonzero amplitudes. So the call to initialize won't know this a priori. So it won't realize the initialization circuit can be decomposed easily. Or at least it will need to do some extra ...


3

Great to see you are engaging with the tutorials! I have had a look and I think this is deliberate, I believe that qc2 is only introduced to demonstrate one type of circuit. The notebook then goes on to create circuits qc3 and qc4 to demonstrate other concepts. If you find any other bugs please report them to the Git repo by creating a new Issue.


3

I found a solution: to serialise instead of print(res) I need to do: print(res.to_dict()) To load the serialized string (eg. line from a file) dict = eval(line) res = Result.from_dict(dict) all of the above with from qiskit.result import Result


2

There are a few ways to speed up this execution in Aqua. One way in the case of noiseless simulation is to use SLSQP instead of Cobyla, which we've noticed empirically seems to converge faster in noiseless environments. Another is to set skip_qobj_validation=True in the QuantumInstance init. I would start with these two and see how they do. QAOA in general ...


2

Qiskit uses little-endian for both classical bit ordering and qubit ordering. For classical bits: A 3-bit classical register creg with value abc has creg[0]=c, creg[1]=b, creg[2]=a. For qubits: The ordering is with respect to the tensor-product structure of the state space. So a 3-qubit quantum register qreg with wave-function $|\psi\rangle = |A\otimes B\...


2

The problem seems to stem from the utf8tolatex parsing in the pylatexenc.latexencode package, line 370 here. Use of this function is not yet depreciated, but it is discouraged, and it has the unfortunate behavior of escaping the underscore, changing 'X_t' to 'X{\\_}t' (this is already inserted into the latex source in a math environment, so no need for $...$...


2

Look at the picture of layer #9. It tells you explicitly how to group the qubits. There's a pair (q0,q5), another pair (q3,q8) and the rest of the qubits (q1,q2,q4,q6,q7,q9,q10,11). To see the relevance, look back to the circuit. Start with qubits 0 and 5. You can see that there's a two-qubit gate between them, but there are no two-qubit gates going from one ...


2

You can initialize a quantum state by using the QuantumCircuit.initialize() function. For example, to initialize a circuit into the state |1>, we can perform the initialization as follows : vector = [0,1] qr = QuantumRegister(1) qc = QuantumCircuit(qr) qc.initialize(vector, [qr[0]]) There is more detail about how to use it in this tutorial


2

If you call execute with the parameter optimization_level set to 0, qiskit will not perform any circuit optimizations. Your call should therefore be job = execute(circ, simulator, optimization_level=0, noise_model = noise_bit_flip) The optimization level can be 0-3 inclusive depending on how much optimization you would like ...


2

I found out the number of ancillas is minimum $n-2$. I found this line in the Qiskit source code of mct: if len(ancillary_qubits) < len(control_qubits) - 2: raise AquaError('Insufficient number of ancillary qubits.')


1

If you have defintely accepted the license agreement then the case is usually the credentials haven't updated locally. Try generating a new API token on the website and then run : IBMQ.delete_account() IBMQ.save_account(APITOKEN, overwrite=True) IBMQ.load_account() This should clear up anything that could possibly still be around linked to your old ...


1

IBM's Qiskit consists of multiple components. Qiskit terra provides you the tools for building quantum circuits. You can either run these circuits on an actual quantum device on IBMQ Experience which is a free cloud-based Quantum computer service. Or you can run your circuit on Qiskit Aer; another Qiskit component. This component simulates the circuit on ...


1

This error code means there was a time-out waiting for a response from the server. It could have been caused by a blip in the network. I would try running the same code again, and seeing if you consistently get this error. If not, then I would not worry, as you are unlikely to see it again.


1

There is not a way to have the latex drawer do the subscript currently. As ChainedSymmetry pointed out the use of pylatexenc prevents that because it will escape or convert the underscore and symbols to their latex equivalents. This was added because when we first added custom gates support to the drawer people had issues with passing things like custom_gate ...


1

I don't think that this is currently possible with Qiskit, could you please add this as an Enhancement to the GitHub repo? This is done by creating an Issue and then selecting that it is an Enhancement.


1

That tutorial was recently updated. In it you'll find a more familiar way to declare and execute algorithms. ee = ExactEigensolver(qubitOp, k=1) result = ee.run() The problem section of the older declarative form of Aqua execution (which is gradually being moved away from) is a way for the Aqua UI to display a list of algorithms applicable to a user-...


1

The problem with your circuit is not the number of classical bits. There is no practical limit to those. The circuit that you have drawn will not run because you are doing repeated measurements on a single qubit. This is not supported on any IBM machine currently available (this would require new control electronics for operating the qubits).


1

Why do you need so many classical registers? One usually only uses them to catch the measurement at the end of the quantum algorithm; one for every qubit. If you do repeated measurements and intend to store statistics in separate classical registers, then you can better repeat the whole experiment. There is also on option to keep individual result of every ...


1

As far as I am aware you can have as many ClassicalRegisters as you need, assuming they fit in the memory of the classical device controlling the Quantum Computer. I would suggest trying to reuse them if possible if you are concerned about this!


1

You could recreate the object by reading the parameters and then creating a new result object result = Result(parameters). You can see the method that does this here. If you have access to the account that submitted the job you can also simply retrieve the job from the backend again using get_job().


1

You would need to send a job to each backend you want to run on. For example, if you wanted to send to ibmqx2 and ibmq_ourense you could execute code similar to this: backend_1 = provider.get_backend('ibmqx2') backend_2 = provider.get_backend('ibmq_ourense') job_1 = execute(circuit, backend_1) # Sends a job to run on ibmqx2 job_2 = execute(circuit, ...


1

Pulling from another question (Big Endian vs Little Endian in Qiskit) and their documentation (https://community.qiskit.org/textbook/ch-prerequisites/qiskit.html), it appears that the register is intentionally labeled right-to-left so that integers are intuitively represented. Consider your example, where you applied X(qr[0]): $ |00\rangle \rightarrow |01\...


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