# Questions tagged [programming]

For any questions whose answer is expected to require code or programming notions. For questions about a specific framework (e.g. qiskit or cirq) please also include a more specific tag. If your question is about installation or any specific framework error, consider posting it in https://stackoverflow.com/ instead.

1,357 questions
Filter by
Sorted by
Tagged with
53 views

### Getting the density matrix of a noisy state in Qiskit

Currently, it seems that qiskit can only compute the density matrix for a pure state. On the other hand, for noisy state, the known way to deal with it is to do sampling, which can induce great cost. ...
• 615
107 views

### Using opflow, CircuitStateFn and CircuitSampler, is there any way to submit the expectation values for multiple, distinct states in the same IBMQ job

I am trying to find the expectation of a Hamiltonian w.r.t different states. I am creating my states using CircuitStateFn. Then, I am using ListOp() of CircuitStateFn. But this is giving me an error - ...
172 views

### How to multiply two vectors (kets) in qiskit?

Hi does anyone know how i could write a program to get the product of something like |1>|0>|0>?
1 vote
124 views

### Ground state compute issue by qiskit

I use the following code to calculate the ground state for the LiH molecule in an active space. I come across two problems. The first is I found that the Hartree Fock state gave energy that is far ...
• 615
36 views

### Measuring with a certain probability in Qiskit

I have the following quantum operation on two qubits: $$\mathcal{E}(\rho) = p \mathcal{T} \circ \mathcal{U}(\rho) + (1-p) \mathcal{U}(\rho) ​$$ where $p$ is some probability, $\mathcal{U}$ is some ...
36 views

### Is it possible to construct a QuantumCircuit object which only shows the 5 qubits and the classical bit where I store the measurement outcome?

I have a 5-qubit circuit on Qiskit, which applies some unitary. Then I have a second circuit which basically measures whether all the qubits are 1, and it does so through a 5-CNOT on an ancilla qubit, ...
76 views

### is there such things as Quantum Operating system?

Wikipedia informed me about quite a lot of language that exist for quantum computing, with diverse low or high level language, but I don't know about specific operating system made for specific ...
• 123
1 vote
98 views

### Create your own n-qubit quantum gate in Qiskit

I need to create the 2-qubit gates that are not supported by Qiskit (Ex: Controlled - F gate). Is there any way to create a class/object and use it as other basic gates? Example: ...
• 345
112 views

### How to convert code from QISKIT to QuEST using QASM

I have been working on this project which requires a lot of qubits. Originally we have made the whole project in QISKIT as we have been using it for a long time. But the maximum number of qubits that ...
1 vote
224 views

### Is there a quantum circuit builder package that allows you to import/export a circuit as a JSON?

I've done a superficial search in each of the qiskit, cirq, and braket open source repositories for such a feature, but can't find any explicit examples of this functionality. I'm wondering if anyone ...
• 131
1 vote
136 views

### Qiskit's PauliTrotterEvolution yields weird gates

I am trying to work with Qiskit's PauliTrotterEvolution() module, but the resulting circuits contain weird gates that I know nothing about. Here is a simple example: I want to implement the fermionic ...
• 107
86 views

1 vote
53 views

### Solving Particle in Box problem using Qiskit

I am new to quantum computing, I would like to ask how can I solve simple particle in box problem using qiskit which allows to compute the bound states in finite quantum well. Finite quantum well
• 11
567 views

### Difference between Aer.get_backend('aer_simulator') and AerSimulator()

In Qiskit, there are several ways to choose simulator: one is from qiskit import Aer backend = Aer.get_backend('aer_simulator') result = backend.run(circ).result() ...
• 111
1 vote
131 views

### How to perform multi-class classification with qiskit's VQC?

I am following the tutorial given in qiskit's website Neural Network Classifier and Regressor. In the first part, classification, the third section refers to qiskit's VQC library. Everything works ...
238 views

### How can I run a VQE on one of IBMQ's Quantum Computers

I have implemented a VQE based on Qiskit's VQE function and want to run that on an actual quantum computer. My understanding was, that an IBMQ backend can be passed into the function as a Quantum ...
• 51
1 vote
74 views

### How to add label to custom operator (from matrix) controlled gate?

So here is what I'm trying to accomplish: I have made a gate out of a matrix, with a control: ...
403 views

### What is the meaning of "shots" and "rounds" in Stim?

I'm running simulations using Stim to get logical error rate vs. physical error rates of some quantum error correcting codes (QECC). I looked into the documentation, but I'm confused about the meaning ...
• 1,162
53 views

### How does one get the right counts for the measurement of a single qubit in the presence of noise with qiskit?

I am using a single qubit in the IBM quantum lab running on ibm_armonk and it is simulated with real noise, however when I try to measure out a state where the coefficient of the 0 state is less than ...
• 41
72 views

### How to choose $\beta$ in Gaussian derivative component of DRAG pulse?

From definition of the DRAG pulse it is: $$f(x)=Gaussian+1j*\beta*(-(x-duration/2)/\sigma^2)Gaussian,$$ where $Gaussian(x, amp, \sigma)=amp*e^{-(1/2)*(x-duration/2)^2/\sigma^2}$. If I try it in ...
• 77
1 vote
66 views

### How to train a Quantum Neural network for regression model in supervised learning

We want to train a parameterised circuit(which is our neural network - from this paper. Now our final circuit looks a little like Let's say there are n training cases. So I have n |gt> vectors ...
116 views

### Adding trainable weights to feature inputs for a CircuitQNN?

Currently I'm trying to get together a QNN that can be trained to classify the normalized (-1, 1) IRIS Dataset on all 3 classes. For this I am using Qiskit's ...
• 147
37 views

I have some questions about OpenFermion. I'm exploring the code, does anybody knows how to implement triatomic molecules like Li-H2? How should I set the number of orbitals? Last but not least, once ...
1 vote
66 views

### Are we using the real-time error information in simulating noise on qasm?

I'm trying to run some quantum circuits on qasm simulator using the noise information from IBM Q quantum device: ...
• 2,228
1 vote
143 views

### How to set hyper parameters for a Variational Quantum Classifier (qiskit)?

I am trying to implement a Variational Quantum Classifier using qiskit's VQC. I have set the feature map to ZZFeatureMap and am using the ...
44 views

### Two body integral calculation taking too long

I'm running the most recent version of qiskit and am trying to run H2 in the cc-pvtz basis. However, it is taking an incredibly long time. This is what my code looks like: ...
197 views

### Computing expectation value of a Pauli string on stabilizer states

I need some help on stim, where I'm trying to compute expectation values of Pauli strings. Hopefully I did not overlook on the documentation an implementation of ...
• 43
244 views

### How to perform encoding and syndrome measurement in stim

I can generate the encoding circuit of a stabilizer code and can read it into stim. For example for the $[[5,1,3]]$ code : ...
• 1,162
57 views

### How to write a code to made envelope function equal to $\pi$ to result in an X gate?

$$\hat U_d = \exp\Big( -i\underbrace{\frac{Q}{2}\int_0^T A(t^\prime)\mathop{dt^\prime}}_{\Theta(t)} \hat\sigma_x \Big)$$ This equation is a Unitary transformation applied to a qubit from time $t = 0$...
30 views

### How do you access stored Ramsey experiment frequency?

What is the stored frequency for the Ramsey experiment and how can this stored frequency be accessed? Is there a backend.get(frequency) command for this frequency?
1 vote
153 views

### Q#/VS: No namespace with the name "Microsoft.Quantum.Canon" exists

I am trying to run a simple "Hello World" project in Q#, following this tutorial. I have completed the following steps (Step #s from tutorial link): Step 1: Installed the latest version of ...
69 views

1 vote
38 views

### How can extract reduced dynamics of a bipartite system from unitary evolution in quite

Let us assume that I have a bipartite system $A\otimes B$ and an initial product state undergoing some evolution $H^{AB} = H^A+H^B+V^{AB}$, which is time independent. I want to simulate the reduced ...
• 111
1 vote