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

# Tag Info

## New answers tagged programming

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

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

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

2

Yes, removing the ResetAll will prevent your code from running. Q# assumes that released qubits are in the 00..0 state. One option is uncomputation - essentially, applying the adjoint of the operations you've applied. For instance, The first two ancilla qubits are left unchanged by the last operation, but the last qubit has been modified and is dependent ...

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

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\... 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 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). 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$...\$...

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

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

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

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

Top 50 recent answers are included