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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
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. ...
user avatar
0 votes
0 answers
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 - ...
user avatar
0 votes
2 answers
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>?
user avatar
1 vote
0 answers
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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
3 votes
0 answers
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, ...
user avatar
2 votes
1 answer
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 ...
user avatar
  • 123
1 vote
2 answers
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: ...
user avatar
  • 345
2 votes
1 answer
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 131
1 vote
2 answers
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 ...
user avatar
2 votes
2 answers
86 views

How can I initialize a state like, $|00\rangle$ or $|01\rangle$ or $|10\rangle$ or $|11\rangle$ in Qiskit?

Many thanks in advance for your help. I am a beginner in Qiskit. I want to implement a circuit that uses the position of an element/item, of the form (x,y) and I would like to represent it as a state $...
user avatar
  • 23
4 votes
0 answers
48 views

Any simulator packages for quantum annealing/adiabatic quantum computation?

Are there any simulator packages for quantum annealing/adiabatic quantum computation, like Qiskit Aer but for quantum annealing? There seems to be only classical heuristics in D-Wave Ocean package, ...
user avatar
  • 166
0 votes
0 answers
60 views

Problems when computing the two-electron reduced density matrix (2-RDM) by qiskit

The definition of a 2-RDM is $D_{ijkl}=\langle\psi|a_i^{\dagger}a_j^{\dagger}a_k a_l|\psi\rangle,i,,j,k,l\in[0,N-1]$, where $N$ is the number of qubits/ orbitals in the quantum system.I am trying to ...
user avatar
0 votes
0 answers
119 views

Correct implementation of Qiskit QAOA

I've been dealing with a QAOA implementation of a QUBO problem. In order to do this, I converted my QUBO matrix to a QuadraticModel. Once done, I have used ...
user avatar
1 vote
1 answer
75 views

QASM Files on Jupyter Notebook

Is it possible to run qasm files on jupyter notebook (like with the qasm_simulator)? I downloaded one code file and I would like to play around with it on jupyter notebook.
user avatar
  • 19
1 vote
1 answer
110 views

How to select the statevetor of a qubit in a multiqubit circuit in qiskit?

I need to use and plot the state of the first qubit in my multiqubit circuit, but the issue is that I need to use post selection - I want only the results of which the other qubits in the circuit are ...
user avatar
  • 11
1 vote
0 answers
83 views

How can I get the results from simulating noise models?

I'm trying to run some simulations of my quantum circuits using qasm simulator. I first tried to import the noise data from a quantum device and then use that information on qasm. Here's part of my ...
user avatar
  • 2,228
2 votes
1 answer
57 views

Measurement bitstrings to detection event bitstrings in stim

Does Stim have exposed functionality for converting a measurement outcome string into a detection event string? I.e. I feed stim a string of 0,1's corresponding to measurements in a circuit along with ...
user avatar
  • 197
2 votes
1 answer
95 views

How to create known quantum state in Qiskit (or any other platform) comprising of two or more bits?

Is there there any way to create a known quantum state in Qiskit (or any other platform) comprising of two or more than two bit? For example if I want to create $\frac{1}{\sqrt{3}}[|00\rangle+|01\...
user avatar
1 vote
0 answers
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
user avatar
4 votes
1 answer
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() ...
user avatar
  • 111
1 vote
1 answer
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 ...
user avatar
5 votes
1 answer
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 ...
user avatar
  • 51
1 vote
1 answer
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: ...
user avatar
3 votes
1 answer
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 ...
user avatar
  • 1,162
0 votes
0 answers
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 ...
user avatar
  • 41
0 votes
0 answers
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 ...
user avatar
  • 77
1 vote
0 answers
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 ...
user avatar
2 votes
0 answers
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 ...
user avatar
  • 147
0 votes
0 answers
37 views

Questions about OpenFermion

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 ...
user avatar
1 vote
2 answers
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: ...
user avatar
  • 2,228
1 vote
1 answer
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 ...
user avatar
0 votes
0 answers
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: ...
user avatar
  • 1
4 votes
1 answer
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 ...
user avatar
  • 43
2 votes
2 answers
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 : ...
user avatar
  • 1,162
3 votes
1 answer
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$...
user avatar
0 votes
0 answers
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?
user avatar
1 vote
1 answer
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 ...
user avatar
2 votes
1 answer
69 views

What is the syntax for general control gate in stim

For a stabilizer code with the stabilizers in canonical form, an encoding circuit has the form that's a product of hadamard gates and general control gates : $H_i C_i(U_i)$. For example for the $[[5,1,...
user avatar
  • 1,162
1 vote
0 answers
65 views

Working with higher energy states in Qiskit Experiments

I'm looking at the source code for the Qiskit Experiments module and see that the EFRabi class subclasses the Rabi class with the intent of calibrating rotations between the 1 and 2 states instead of ...
user avatar
3 votes
1 answer
128 views

How to import a generic stabilizer code in stim

I just started using stim to simulate the performance of quantum error correcting codes. I hope this is the right place to ask questions about the subject. The example code with the repetition code ...
user avatar
  • 1,162
1 vote
0 answers
116 views

from hello_qiskit import run_puzzle results in error

I am working my way through the beta version of the Qiskit textbook. Everything was going fine until I got to the Visualizing Entanglement section and had some exercises to complete. All of the ...
user avatar
2 votes
1 answer
189 views

How do I pick a random Clifford operation in Stim?

I want to sample random n-qubit Clifford operations. How do I do that in Stim? (Self-answering because this was requested when the feature already existed)
user avatar
  • 23.3k
5 votes
1 answer
93 views

Where does the "correction" in quantum error correction occur, specifically when using repetition codes?

I'm reading the part of the qiskit textbook that deals with this (https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html) and so far it seems as though they're just ...
user avatar
2 votes
1 answer
165 views

Getting non-Clifford after performing several Clifford gates in qiskit

I'm trying to test Clifford gates in qiskit according to the table in Fault-tolerant SQ, page 101. I tried 4 Cliffords in the test $$-X/2 - X -X/2,Y/2,X/2 - -X/2,Y/2,-X/2$$ using the following code <...
user avatar
  • 77
0 votes
1 answer
100 views

How to create a quantum circuit to implement the same operations but acting on different qubits?

I want the draw the quantum circuit of the following Hamiltonian: $$H = - 4 \times X\otimes X\otimes X\otimes X - 4\times Z\otimes Z\otimes Z \otimes Z$$. I have been able to draw the circuits of $ - ...
user avatar
1 vote
0 answers
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 ...
user avatar
1 vote
1 answer
77 views

Equivalent matrix for operators in qiskit

What is eqivalent matrix to qc.rx(np.pi, 0): ...
user avatar
  • 77
1 vote
3 answers
1k views

Which quantum computing frame is suitable for optimization problems?

As in the computer world, not all programming languages are suitable for everything. Php = Backend Javascript = Frontend Data Analsys/ML = Python embedded systems = C Mobilphone/apps = Android / Swift ...
user avatar

1
3 4
5
6 7
28