2022 Developer Survey is open! Take survey.

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

AWS-Rigetti for beginners

I'm interested in learning AWS Braket. Can someone help with basics like creating a circuit and sending a job to the hardware and at the same time how to automatically download the calibration data ...
0 votes
1 answer
19 views

How well different featuremap encode the data?

Recently, I was doing research on QML. Qiskit gave detailed steps on how to encode data into quantum states, but I was confused about one point: there are different feature mapping methods under ...
11 votes
2 answers
2k views

Composing multiple quantum circuits in single quantum program in Qiskit

I was wondering if there is a way to compose a program with multiple quantum circuits without having the register reinitialized at $0$ for each circuit. Specifically, I would like run a second ...
1 vote
0 answers
5 views

DIMACS Examples with few variables

I am currently working on an SAT Solver using quantum computing. However, since current quantum computers are limited to a few qubits, I am in need of examples ranging from 4-30 variables. I know of a ...
0 votes
0 answers
8 views

Azure quantum error message

I am using the IonQ qpu on the Azure quantum provider with a Google Cloud API (https://ionq.com/docs/get-started-with-google-cloud) to access the native gates (https://ionq.com/docs/getting-started-...
3 votes
2 answers
154 views

Is there a function in qiskit that allows me to insert quantum gates at certain indices of a circuit?

Here's my quantum circuit with mid-circuit measurements: ...
1 vote
0 answers
44 views

How to implement SU(2) rotation with qiskit?

Before I start, I would like to say sorry for this possibly stupid question of mine. I just recently got into the topic of quantum computing and try me there. I'm currently trying to display a SU(2) ...
1 vote
1 answer
74 views

Bit Flip, Separable state and Several Question about Cirq

1)I want to use noise model for my state and bit_flip is not defined on cirq. ...
2 votes
1 answer
153 views

A Simon's algorithm with secret string b = 01, IBM Quantum experience gives a different result from what I calculate

I try to design the circuit for $b = 11$ and succeeded in running. Therefore, I start to think of the circuit for different secret string $b = 01$. The circuit I made is down below: Here is the ...
1 vote
0 answers
10 views

What are the differences between discrete-time quantum walks between dimensions?

When working with quantum walks in other dimensions (1D – 2D – 3D...) do your results tend to be different from what is proposed in theory with the probability density? The results obtained in the ...
-1 votes
1 answer
61 views

Handle Qiskit Exception while Loading IBMQ Account using Streamlit

I'm trying to build a simple web app for generating random numbers using IBMQ (Qiskit) and Streamlit. However, if there is no IBMQ saved account it should wait for the user to enter the API token and ...
1 vote
1 answer
55 views

Accessing tuple data in Q#

I am continuing my work on the SAT katas, but I thing I am missing something on the way the tuple data type works. In this example code, I am trying to access the data in a tuple type : ...
1 vote
1 answer
334 views

Unable to retrieve result for Job Error during VQE simulation

I am attempting to run a VQE calculation on the 'ibmq_qasm_simulator'. The job is failing with a series of errors caused by: ...
0 votes
1 answer
37 views

How to use the csv dataset file imported as a dataframe in QSVM Qiskit code

I am trying to run QSVM qiskit code with my custom dataset which I am loading as a pandas dataframe. When I execute the part below with my own dataset in the place of breast_cancer, it gives error &...
1 vote
1 answer
59 views

Performance metrics in QSVM

I have implemented QSVM on breast cancer dataset using link: "https://qiskit.org/documentation/stable/0.24/tutorials/machine_learning/01_qsvm_classification.html" but unable to compute other ...
3 votes
2 answers
69 views

qiskit qaoa.compute_minimum_eigenvalue

I am having some trouble running the compute_minimum_eigenvalue method from qiskit's QAOA: the documentation states that one ...
1 vote
1 answer
63 views

Help with objective function definition for CQM problem

I would like to set my problem as a constrained quadratic model (CQM), since a CQM allows users to explicitly define objective and constraints (easier for me, as I am not a QC expert!). The idea is to ...
1 vote
2 answers
179 views

Qiskit: simulate a circuit using a backend noise model

...
0 votes
1 answer
48 views

How to get information about 'qubit location' or 'variable of qubit location' in qiskit docs?

I have something problem with using qiskit. I searched several qiskit docs to get 'qubit location' or 'variables' that represent qubit. I searched three documents below. ...
1 vote
1 answer
25 views

Converting data into a SHA256 hash using Qiskit quantum computer

I was wondering how can we convert data into a hash using Qiskit quantum computer? e.g, this code below will generate a SHA256 hash based on random data. ...
1 vote
0 answers
46 views

Are there any quantum standards already in development and accessible as draft documents?

Are there any quantum standards already in development and accessible as draft documents? Any documents describing standardized way of describing and ensuring common meaning/interoperability, like e.g....
2 votes
1 answer
43 views

Can the ancilla for Qiskit's mcx with mode="recursion" be dirty?

I think their implementation is close to the one from here which does use a dirty ancilla, but I just want to make sure
0 votes
0 answers
16 views

Is there a way to connect a IBM quantum lab code to an Unreal Engine project?

I would like to know whether someone tried this before, I'm interested in be able to connect this tools. I know that Unreal Engine has a plugin to program with python, that all I know. I'll really ...
1 vote
2 answers
30 views

How is the ket of a quantum state calculated in this code?

For the following code qc = QuantumCircuit(2) qc.h(1) qc.cx(1,0) ket = Statevector(qc) ket.draw() the output will be the following: ...
0 votes
1 answer
141 views

Hybrid Quantum LSTM in Qiskit

I read this article on a Hybrid Quantum LSTM in Pennylane and I'm trying to replicate it in Qiskit. Nevertheless it doesn't seem to work very well. Here's my code ...
0 votes
2 answers
45 views

Expectation value of pauli strings for VQE

I am studying VQE and have boiled it down to a matter of determining the expectation value of pauli strings: $$\langle H \rangle = \sum_i \alpha_i \langle\psi|\hat{P_i}|\psi\rangle.$$ I have been ...
2 votes
1 answer
32 views

Iterative quantum phase estimation - real device

I'm trying to implement the iterative quantum phase estimation on a real (IBM) quantum computer. I'm using the code below. When I run this code on a simulator the results are the expected ones, but ...
0 votes
0 answers
61 views

Hamiltonian & QubitMappingType cannot be imported from qiskit.chemistry.core

I'm trying to implement the same Jupyter notebook in The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4;however,I found a problem: Error: ...
7 votes
1 answer
228 views

Inequality constraints on D-Wave (using PyQUBO)

Inequalities cannot be directly converted into a QUBO form. By inequality, I mean something like this: 0⩽ Expression ⩽ N. We can introduce a slack variable and convert it to an equality problem: ⟹ ...
1 vote
1 answer
136 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 ...
0 votes
0 answers
19 views

Why does Qsample encoding require N Qubits for encoding size N probability distribution?

I'm reading Supervised Learning with Quantum Computers book https://link.springer.com/book/10.1007/978-3-319-96424-9. In the data encoding section, Qsample encoding is one of the techniques to encode ...
2 votes
2 answers
96 views

Qiskit compute mean expectation value

I want to calculate the mean expectation value of an PauliSumOp within qiskit after I executed a QAOA Circuit. My approach is the following: ...
5 votes
2 answers
669 views

Test equivalence of circuits exactly on qiskit

I have two circuits that I believe are equivalent. When I say 'equivalent' I mean that they have equivalent unitary representations up to a global phase. How can one check this using Qiskit? How I ...
2 votes
1 answer
71 views

Qiskit IBMQ.load_account fails on version 0.20.0

So when trying to load my account I get this error: ...
0 votes
1 answer
13 views

why is the ImFil optimizer history not completly printed?

I use the [scikit-quant] (https://scikit-quant.readthedocs.io/en/latest/starting.html) implementation of the ImFil optimizer. I want to plot the objective function values vs. iteration number and thus ...
2 votes
2 answers
244 views

Qiskit sample - Portfolio optimization

I've recently tried to run this sample from Qiskit (Portfolio Optimization) I was able to change RandomDataProvider to YahooDataProvider and able to run it on real stock prices. However, there is one ...
11 votes
3 answers
4k views

How to calculate an Expected Value of some operator acting on qubits?

I'm trying to implement the Variational Quantum Eigensolver in Qiskit. Suppose, I have an operator $A = \sigma_1^z\sigma_2^z$ acting on some two-qubit state $|\psi\rangle$. After a measurement I get ...
1 vote
1 answer
127 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:
0 votes
0 answers
48 views

Q# Grover Tutorial Problem

Referring to the Q# tutorial on Grover algorithm in https://docs.microsoft.com/en-us/azure/quantum/tutorial-qdk-grovers-search?tabs=tabid-visualstudio, I replicated the code exactly in Visual Studio ...
1 vote
1 answer
143 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 ...
3 votes
2 answers
77 views

Bernstein Vazirani Algorithm widget (bv_widget) in the Qiskit documentation

I'm new to quantum computing and Qiskit, so please be patient with me. I'm going through the info on Bernstein Vazirani. Here is the link to the section: https://qiskit.org/textbook/ch-algorithms/...
1 vote
1 answer
69 views

Qiskit - nuclear repulsion energy derivative

I know a function in PSI4 computing a nuclear repulsion energy derivative located in psi4.core.Molecule. Is there a possibility to access such function from Qiskit interface? By this "interface&...
3 votes
1 answer
132 views

Implementation of Unitary in Shor's Algorithm in PennyLane

I've been working on implementing Shor's Algorithm in PennyLane, but am struggling to understand how the circuit for 'U' has been constructed according to Qiskit. In the Qiskit textbook, they seek to ...
2 votes
2 answers
188 views

qiskit: IQFT acting on subsystem of reversed-ordered qubits state

I have a state psi as an ndarray of shape (2 ** 3,) s.t. psi[0]= amplitude of 000 ...
0 votes
1 answer
29 views

split_dataset_to_data_and_labels in qiskit not working correctly

I am using source code of split_dataset_to_data_and_labels as I am unable to install qiskit-aqua because of error. But in that source code, "keys" is not being identified. I am using qiskit'...
3 votes
1 answer
115 views

How call from IBM Q Experience (Jupyter Notebook) cplex

I have the latest version of cplex (12.9) installed on my computer. I use it very well with Jupyter notebook, but in IBM Q Experience, I did not get way to call it. IBM Q Experience warns me that the ...
-1 votes
0 answers
26 views

understanding docplex output in portfolio optimization using Qiskit

Can someone please explain the below equation? what are we doing in Obj? Source: https://qiskit.org/documentation/finance/tutorials/01_portfolio_optimization.html ...
-1 votes
1 answer
44 views

No module named 'qiskit.optimization' on Google Colab

I have qiskit installed in my colab runtime and can import qiskit, but I can not import anything from qiskit.optimization. Am I missing something? EDIT: It seems ...
1 vote
1 answer
28 views

Unable to import split_dataset_to_data_and_labels and map_label_to_class_name in qiskit

I was using command-: from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name but it was giving error-: ...
1 vote
2 answers
51 views

Can one reset a qubit to the ground state on real IBM quantum processor?

As explained here, IBM provided the possibility to reset a qubit to the ground state within the Qiskit framework. However it is not clear whether this tool is available for any backend or it works ...

1
2 3 4 5
27