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
0answers
56 views

When I try to transpile circuit with Qiskit, how can I use $Ry(\pi/2)$ as a basis gate?

When I try to transpile circuit with Qiskit, I can use 'ry' as a basis gate. But I want to set one of the basis gate as $R_y(\pi/2)$. How can I do that? Edited: <...
1
vote
0answers
35 views

How to create this feature map?

In this paper, the following feature map is used: $$x \to \vert\phi(x)\rangle = \frac{1}{\sqrt{2^k}}\sum_{i=0}^{2^k-1}\vert x\cdot g^i\rangle$$ But no circuit is provided. A theoretical description of ...
1
vote
0answers
27 views

I can not extract the final statevector when using a binded Parametric Controlled gate

I'm trying to implement a Parametric Hadamard Test. I have already my parametric evolution gate $\exp(-i\theta H)$ where $\theta$ is the parameter. When I defined the controlled-gate with Gate.control(...
1
vote
1answer
43 views

'Internal error. Error code 9999' when running job on IBMQ

I'm trying to run a series of circuits in a job and I keep getting this error message which I haven't been able to find the meaning of anywhere in qiskit's documentation, online, etc. The job appears ...
1
vote
0answers
64 views

QuTiP VS RK45: Which one gives the correct results for time-dependent systems?

I am writing a code for a quantum thermal machine which includes both coherent and dissipative time evolutions in its different stages of operation. However, evolving the system with "mesolve&...
1
vote
0answers
25 views

Applying QPE on a large matrix on amazon-braket

I'm running a QPE algorithm on the amazon-braket but it can only apply on a 22 or 44 matrix, when I want to expand it into a 5*5 or more, it will come an error. As I know, there is no theoretical ...
1
vote
1answer
48 views

Qiskit does not interpret qasm string as 3.0?

I am trying to get my first openqasm3.0 program and I am getting error messages that I cannot interpret. Here is my program: ...
1
vote
0answers
15 views

Is there any software package tracking Pauli errors in stabilizing circuits with GUI?

I want to track the Pauli errors propagating in stabilizer circuits like surface code. I wonder whether there is any developed package that can do this elegantly. It will be better if it has GUI that ...
1
vote
1answer
63 views

Binary classification using a very simple Neural Net with Qiskit and Pennylane

I implemented a simple Neural Net with Pennylane and Qiskit for classifying two half moons: notebook for two half moons (GitHub). It works somehow (not overwhelmingly by any means): I tried running ...
1
vote
1answer
72 views

QUBO defined in Qiskit/DOcplex: how to solve it using Pennylane?

I have a complex Integer Linear Programming model defined in DOcplex/Qiskit representing a combinatorial optimization problem. Using the Qiskit utils, it is possible to covert it to either an Ising ...
1
vote
0answers
25 views

Plots of the result for the qiskit HHL tutorial

Could anyone make explicit the code which gives the two plots at the end of the HHL tutorial. They show the results of the jobs on a real IBM quantum device.
1
vote
0answers
67 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 ...
1
vote
0answers
47 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 ...
1
vote
0answers
39 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
1
vote
1answer
33 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: ...
1
vote
0answers
54 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 ...
1
vote
0answers
59 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 ...
1
vote
1answer
39 views

Qiskit noise model question (from textbook)

I'm reading the chapter Introduction to Quantum Error Correction using Repetition Codes and a code example demonstrates how to add depolarizing and pauli error. I have several questions. Is it not ...
1
vote
0answers
41 views

Callback in VQC does not return correct float value for objective function evaluation

The callback for the VQC class is defined as: callback (Optional[Callable[[ndarray, float], None]]) – a reference to a user’s callback function that has two ...
1
vote
1answer
68 views

Qiskit: How did they use Haar measure in random_statevector?

I have read this article to understand sampling state vectors from Haar measure: Understanding the Haar Measure. Qiskit uses Haar measure to sample state vectors, but when I looked at the source code ...
1
vote
0answers
38 views

Generate certain depth Clifford random circuit by qiskit

To obtain knowledge about the pattern of errors occur in quantum circuits, random Clifford circuits are a good paradigm to use in that these kind of circuits can be efficiently simulated by a ...
1
vote
0answers
62 views

How do I find the qubit trajectory on the Bloch sphere when implementing an RY rotation on an IBM backend?

Suppose I use Qiskit to prepare the $| + \rangle$ state using a RY rotation, ...
1
vote
1answer
105 views

QAOA Optimization

I want to use historical data for 5 stocks from YahooFinance and then calculate mean vector and covariance matrice, so I can optimize them with QAOA. Anyone know what is wrong with this code:
1
vote
0answers
43 views

Transform Fermionic operators to quantum circuit in qiskit

I am trying to realize a modified version of the UCCSD algorithm, which consists of combining multiple fermionic opeators to form a unitary tranformation U to act ...
1
vote
0answers
57 views

Thoughts in coding large and repetitive/non-repetitive quantum circuits?

Just out of curiosity, are there advances or directions on how to write a program (e.g. in qiskit) for a large number of qubits? Assuming that the number of gates ...
1
vote
0answers
37 views

How do you verify the output of an X Gate within the Pulse gates framework?

I have found out how to create an X gate for a constant pulse within the Pulse gates framework found on this link: https://qiskit.org/documentation/tutorials/circuits_advanced/05_pulse_gates.html My ...
1
vote
1answer
72 views

Measuring the accuracy of a circuit output?

I have created a circuit and got the output which matches the truth table but, I'm not understanding the measuring the circuit output in terms of the probabilities, power or error. This is the circuit ...
1
vote
2answers
111 views

Random accuracy using VQC and Iris dataset

Using the same seed (seed_simulator and seed_transpiler) I get different accuracy when running it several times. In Aqua library (from qiskit.aqua.algorithms import VQC) I solved it adding ...
1
vote
0answers
78 views

Error when computing the self-designed gradient in qiskit

I had question with the way to define a new kind of gradient to improve the performance of VQE. The gradient formula I used consists of multiply energy (measurement result of the Hamiltonian) with the ...
1
vote
0answers
36 views

Difference in HLL applications

I am new to Qiskit and I have seen two types of simple 2X2 $Ax=b$ system solutions. I am wondering what the difference is exactly. They both occur on a simulator backend, but the first gives me a ...
1
vote
0answers
39 views

Quantum Machine Learning: how to get effective time of training/scoring

I am trying to examine the potential of Quantum Machine learning in terms of performance and time compared to classical algorithms. I am using both Qiskit's QSVM and scikit's SVM with Qiskit Quantum ...
1
vote
0answers
34 views

Recover qubits used in an actual computation

How do I recover from a certain job_id in the IBM backends which qubits where used? I would be interested to know if for instance, in a batch of say 50 jobs, 25 of ...
1
vote
0answers
69 views

Are inconsistent results between different VQE runs justified?

I made this post a while ago, where I learned I could use qiskit's VQE to calculate (or approximate) the Transverse Field Ising Hamiltonian and other similar Hamiltonians. After working with my code ...
1
vote
0answers
61 views

How to calculate Alpha and Beta values for QAOA Max-cut problem manually?

I'm new to Quantum Computing. I came across solving the Max-cut problem using QAOA. For example, if I have a $U3$ gate with parameters $U3(0,0, \gamma_{XYZ})$ gamma parameter at $p=X$ between logical ...
1
vote
0answers
44 views

What is the kernel used in the IBM Qiskit's source code?

I want to redefine the QSVM code for a different kernel. But what is the kernel actually used in the IBM Qiskit's source code? And where is it defined, exactly. QSVM on Qiskit.
1
vote
1answer
120 views

Running qiskit on jupyter notebook certverification error: unable to get local user certificate

I have code which runs on the IBMQ website perfectly, however copying and pasting the same code (and including my API token) the same code does not run when I try and run it on a real quantum computer ...
1
vote
0answers
54 views

How to avoid Cirq: State_vector is not normalized error for Feedback-loop in optimizer?

I am doing a VQE in Cirq, but sometimes I get this error while running steps of the classical optimization loop: State_vector is not normalized instead had norm 1.0000000010132789 And therefore the ...
1
vote
0answers
58 views

How to transform fermionic operators in qiskit

I encountered some problems when using the qiskit pakage to define the 2-electron reduced density matrix (2-RDM), which is a 4-index tensor, $\langle a_i^\dagger a_j^\dagger a_k a_l\rangle$. I need to ...
1
vote
0answers
25 views

Need Help in QGAN function to load higher dimentional data

I have a query that I am using qiskit.aqua.algorithms.QGAN library and using the qgan function and I am having difficulty in loading data of dimension 1000 rows x 10 columns. I am following qiskit's ...
1
vote
0answers
68 views

How to divide one quantum circuit into multiple sub-circuits in qiskit?

While I'm simulating one Big quantum circuit in Qiskit, I wonder how we can divide one big quantum circuit into several sub-circuits. I looked in Qiskit API documents, but I couldn't find it. Is there ...
1
vote
1answer
154 views

Qiskit not finding CPLEX

I'm trying to use the CPLEX library alongside Qiskit but keep getting the error. ...
1
vote
1answer
82 views

How do I get sate vector for each shot running on a quantum computer?

I was running this code on a quantum computer how can I generate a state vector for each shot while running on a quantum computer? qikit code ...
1
vote
0answers
56 views

Why Measurement Error Mitigation does not seem to improve the result of VQE?

I try to follow https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/algorithms/03_vqe_simulation_with_noise.ipynb to perform measurement error mitigation for calculating H2 energy with ...
1
vote
0answers
30 views

Why do I get the error 'IBMQManagedResultDataNotAvailable'?

I'm trying to use IBMQ job manager to submit a list of quantum circuits (300 of them in total) to 'ibmq_16_melbourne'. This is what the job status looks like on IBM Quantum Experience: I don't know ...
1
vote
0answers
86 views

Why qiskit.execute runs much slower for inputs with multiple circuits, and how to speed it up?

I am using the "execute" in qiskit to run experiments for two circuits, and it turns out that "execute" runs much slower if the two circuits are run simultaneously, compared to if ...
1
vote
0answers
163 views

How can I fix the BrokenProcessPool error in Qiskit?

I'm running a set of quantum circuits using the ibmq_qasm_simulator. However, sometimes my code works for the simulation, but sometimes it doesn't, and the system ...
1
vote
0answers
39 views

Differences between Extractors and Privacy Amplification for Quantum Random Generators

We know that for the last step of QRNG: we need to separate quantum and classical noises from each other so we use extractors, after extractor we need privacy amplification step. At this point: if ...
1
vote
2answers
126 views

Qiskit: simulate a circuit using a backend noise model

...
1
vote
0answers
90 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
73 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 ...