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.

234 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
2answers
115 views

Qiskit: simulate a circuit using a backend noise model

...
1
vote
0answers
87 views

State bug in IBM Quantum Experience

I run many tests with VQC and QSVM algorithms. In last times I can't get final result because some job hang on state Creating, Validating or Running. It can continue many hours and It doesn't finish. ...
1
vote
0answers
71 views

Length / transpilation issues with Grover's algorithm

I would like to discuss the discrepancies between what we see in the simulator versus what we see in the actual running of the code on any IBMQ machine for any qubits at 5 or above. I am doing a final ...
1
vote
1answer
195 views

Parallel shots on Qiskit

I am running variational algorithms using QuasmSimulator, which means I am performing a classical optimization where the cost function is computed running a quantum circuit. Moreover, for the ...
1
vote
0answers
146 views

Implementing the HHL algorithm with negative eigenvalues (Cirq)

How do I implement the HHL with negative eigenvalues? This paper (https://arxiv.org/abs/1803.01486) says that: what if $\lambda<0$? This problem actually does not hard to solve, since we can ...
1
vote
1answer
56 views

No backends assigned to my Account

When I open my account on IBM Quantum Experience, I am shown 9 backends that are assigned to me. But when I open any of my circuits, I get the error that "This account has no backends assigned&...
1
vote
1answer
104 views

Grover's algorithm with matrix_product_state method

I implemented Grover algorithm with matrix_product_state method in qiskit. But I found something strange. I designed the oracle part come out $|1111\rangle$ but, real output was $0011\rangle$. I check ...
1
vote
2answers
98 views

How to use VQE function in Qiskit

As part of a project I'm working on, I want to use VQE algorithm to calculate the minimal eigenvalue for given Hamiltonian. I use Qiskit on IBM UI online. The Hamiltonian is given as a sum of tensor ...
1
vote
1answer
108 views

Long running time at job

I try to launch QSVM algorithm (from Qiskit example ) on all real quantum devices (that is IBM Q) and get running time 5-30 seconds on one job. But if I use ...
1
vote
0answers
40 views

qasm_simulator generating identical results repeatedly

I wish to run a very simple circuit on the qasm_simulator backend. My circuit is ...
1
vote
1answer
173 views

Why do the qasm_simulator runtimes vary significantly for different IBMQ CouplingMap/NoiseModels?

I have been running VQE experiments locally using the qasm_simulator with actual IBMQBackend NoiseModels as shown in the Qiskit Textbook. I have noticed that the ...
1
vote
0answers
161 views

qiskit - MCMT - base gate acting on only one qubit

I want to reduce the depth of a ucrz gate acting on multiple qubits with ancilla qubits in qiskit. One way to do this could be the mcmt implementation with ...
1
vote
0answers
53 views

Qiskit function phase_amplitude_damping_error

I am reading about the noise models that can be simulated in Qiskit and I found out the phase_amplitude_damping_error function. I read about it and it seems to be a function that simulates a combined ...
1
vote
0answers
61 views

Help Understanding Line in Source Code

In Qiskit's implementation of the HHL algorithm, they have the following line at the end of their code that allows them to compute the global phase we need to add on to the solution. ...
1
vote
0answers
227 views

Problem with installing Qiskit on Android with Termux emulator

Termux has some issues with cmake, therefore qiskit-aer-0.5.2 installation returns error 1. ...
1
vote
0answers
40 views

How to create a C# host program for a Q# program in Visual Studio Community 2019?

I have been trying to create a C# host program for a Q# program in Visual Studio Community 2019 by following these instructions: https://docs.microsoft.com/en-us/quantum/quickstarts/install-cs?tabs=...
1
vote
0answers
74 views

Adding Quantum State Tomography Step to HHL Algorithm (Cirq)

Over the past month, I have been learning about the HHL algorithm and am interested in extending the Cirq implementation to include the quantum state tomography step to extract the amplitudes or ...
1
vote
0answers
50 views

How do you decide which rotations to use in a Quantum Machine Learning model?

I am trying to design a model using Q#'s machine learning library that takes in two features (real numbers from 0 to 1) and classifies as 0 or 1. So how do I decide which Rotations and what seeds to ...
1
vote
0answers
85 views

Attempting to use the QuantumMachineLearning Repositry with vscode and now import qsharp is reporting 'Fail'

I have been trying to follow the Quantum machine learning kata by using vscode and jupyter notebook, I was using the wrong version of iqsharp so changed it in the code like so: As can be seen the ...
1
vote
0answers
170 views

Q# Quantum.MachineLearning namespace doesn't exist error

I am trying to use the HalfMoon Classifier in Quantum Machine Learning Sample Examples. I am trying to run it locally. However I keep getting this error. ...
1
vote
0answers
39 views

How to ignore spins is Qiskit chemistry package?

Is it possible to use built-in qiskit.chemistry tools, such as VQE, UCCSD, etc., without ...
1
vote
1answer
138 views

How to get running time for each circuit executed on IBM's quantum processors in one round?

I want to execute multiple circuits in one round on IBM's backends, especially the 16-qubit one, to save time. For instance, ...
1
vote
0answers
38 views

Error in qiskit.aqua.operator

I want to implement this thing: Operator([[3, Pauli([1,0,0], [0,0,0])], [2, Pauli([0,0,0],[0,0,3])]]) But while doing this there is an error in ...
1
vote
0answers
85 views

How can I run programs in test folder Github Qiskit

I am new to GitHub/Python - please tell me how can I run programs in https://github.com/Qiskit/qiskit-aqua/tree/master/test and its sub directories in Jupyter. I am connected to IBM Q Expereince. I am ...
1
vote
0answers
103 views

Numerical methods for finding an eigen basis of a degenerate Liouvillian

I'm trying to find the steady-state of a master equation, $$\dot{\rho}(t) = \mathcal{L}\rho(t),\tag{1}\label{1}$$ In the form where we vectorise the density matrix and matrixify (??) the Liouvillian ...
1
vote
0answers
68 views

How to reduce the length of Q# programs execution time?

In the released Q# documentation by Microsoft available at: Quantum Development Kit Full State Simulator, it is written By default OpenMP uses all available hardware threads, which means that ...
1
vote
0answers
260 views

A question about qiskit's WeightedPauliOperator.evolve method for IPEA (IQPE) implementation

I'm doing an implementation/tutorial of the iterative phase estimation algorithm (IPEA) and have a problem. My Hamiltonian is a diagonal matrix $H = \begin{pmatrix} E_1 & 0 \\ 0 & E_2\end{...
1
vote
0answers
69 views

Number of columns mismatch in Qiskit

So I have the following code qgan = QGAN(real_data, bounds, num_qubits, batch_size, num_epochs, snapshot_dir=None) with num qubits being defined as ...
1
vote
0answers
102 views

Exponentiating Hermitian Matrix for use in QPE/HHL

I am currently trying to understand HHL by implementing a very inefficient Qiskit simulation script that performs HHL on an arbitrary hermitian matrix $A$ and a vector $b$. Because I am currently ...
1
vote
0answers
103 views

'ERROR: QasmSimulator: Circuit cannot be run using available methods.'

I used the following code. Can anyone say what that error is about? ...
1
vote
1answer
295 views

ERROR_RUNNING_JOB with 32 qubit circuit running on ibmq_qasm_simulator backend

I recently made a quantum circuit that uses 32 qubits and try to run it on IBM Q Experience qasm_simulator backend. But it always ends with ERROR_RUNNING_JOB. ...
1
vote
0answers
56 views

Encoding Binary Data into Quantum Basis

I am working on implementing a paper on QNNs. I have successfully been able to resize a MNIST digit to be able to meet the size of quantum circuit. But I am not clear of how to convert the resized ...
1
vote
0answers
209 views

Having trouble communicating with the IBM Q Experience REST API

I have started using IBM's Q Experience and I am trying to obtain an access token in order to communicate with the REST API. I understand that I can use my API token to obtain authorization by sending ...
1
vote
0answers
96 views

How to plot decision boundary with support vectors when running quantum SVM algorithm?

I'm working on QSVM to know the difference between SVM and QSVM. How much better quantum machine learning can do when compared to classical machine learning algorithms? Part of my code: ...
1
vote
0answers
93 views

Exception encountered while running quantum-enhanced support vector machines

I am trying to run the code of the notebook example aqua/artificial_intelligence/qsvm_kernel_classification.ipynb. I save it in a python file and I have an exception at runtime the display of ...
1
vote
0answers
66 views

QE error: No handlers could be found for logger

When I run a QASM program on a QE simulator, I get this error. No handlers could be found for logger "IBMQuantumExperience.IBMQuantumExperience" What ...
1
vote
1answer
54 views

What does a statevector with 3 elements (in Qiskit) represent?

I wasn't quite sure where to post this as I don't know if this is a Qiskit specific thing or not, but I'm not sure how to interpret this result I got from running a simulation. from result.data(): <...
0
votes
0answers
24 views

Quantum GAN implementation

Can anyone provide a good link to understand how to implement qgan using pytorch in qiskit. Trying to understand this ( https://qiskit.org/documentation/machine-learning/tutorials/...
0
votes
0answers
29 views

How can I delay the construction of the power of a gate in a parametric circuit?

I want to implement the parametric power of a gate. I know that the parametric power is impractical to implement (cf https://github.com/Qiskit/qiskit-terra/issues/4751). So, I want to delay the ...
0
votes
0answers
25 views

Qiskit- Building an oracle to test on Qiskit's Grover

I want to build an oracle with multiple state solutions. For example: For n=4 qubits, I want the state solutions to be 1111, 1101, 1110 and 1100. So, as you can see, in all solutions, there are two ...
0
votes
0answers
37 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 - ...
0
votes
2answers
78 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>?
0
votes
0answers
27 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 ...
0
votes
0answers
33 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 ...
0
votes
0answers
57 views

Correct implementation of Qiksit 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 ...
0
votes
0answers
32 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 ...
0
votes
0answers
33 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 ...
0
votes
0answers
35 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 ...
0
votes
0answers
27 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 ...
0
votes
0answers
24 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 ...