4

No, there isn't. We are avoiding having the means for types to impact the program flow, but I'd be interested to hear what the use case is. If is it only a matter of wanting to print the type rather than getting something that can be used within the program, then that is certainly something we could cover in the future (please consider making a feature ...


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

As I explained in my answer on a previous question of yours, the depolarizing channel is not really 'physical' - actual quantum systems don't really behave that way. So for simulations where you, for instance, investigate the performance of some code against the depolarizing channel, it doesn't really matter what the exact value of $p$ is in your simulations....


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

@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

As @JSdJ indicated in their comment, one approach is to perform the assertion in the 𝑋-basis instead of the 𝑍-basis: open Microsoft.Quantum.Diagnostics; @Test("QuantumSimulator") operation CheckThatHPreparesPlus() : Unit { using (q = Qubit()) { within { H(q); } apply { ...


1

Welcome Daniele! It's a fantastic question - some forms of physical hardware can measure on different axis', so you could verify the qubit state by measuring with the $| + \rangle $ and $ |-\rangle$ basis states (and, if you got $|+\rangle$ with high probability, you could assume $H |0\rangle \mapsto |+\rangle$). In Q#, I don't believe this has yet been ...


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

One potential strategy is to probabilistically estimate the qubits' probabilities. Here's some pseudocode: counts = Int[NumberOfQubits] for counter in trials: ApplyOperationToArray results = MeasureArray AddResults(results, counts) idx = maxIdx(counts) As mentioned in the comments, we cannot ascertain which qubit has the highest probability by the ...


1

Can a partial applicated operation be passed as an argument ? Yes. For example, let's say you want to pass an argument of type (Qubit => Unit) (an operation applied to a single qubit, say, a gate), and you want to get it by using Ry gate with a fixed rotation angle parameter. The signature of Ry operation is operation Ry (theta : Double, qubit : Qubit) : ...


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.


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