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
1 vote
0 answers
26 views

Amplitude Amplification applied to HHL Algorithm

I’m trying to understand and implement the amplitude amplification algorithm described in the HHL paper. I’m using the cirq implementation of the HHL algorithm as my starting point. I have a couple of ...
user avatar
2 votes
0 answers
56 views

Add a negative phase to selected states

I have $n$ qubits in superposition. I want to add a negative phase to all states with more than $m$ $1$s, e.g. for $n=3$ qubits and $m=1$ I want to get: $\frac{1}{\sqrt{N}}(|000\rangle + |001\rangle + ...
user avatar
  • 21
2 votes
1 answer
37 views

Is there a way to get the controlled version of a AWS Braket Unitary?

In qiskit we can simply define a custom unitary $U$ and get its controlled version $C-U$ with the method .control(). So, is there a way to do the same in AWS Braket?...
user avatar
0 votes
0 answers
60 views

Jupyter Notebook not rendering latex code

Working through the Qiskit text and came across this bit of coding on the density matrix page: psi_AB.draw('latex', prefix='|\\psi_{AB}\\rangle = ') which is ...
user avatar
  • 13
1 vote
1 answer
31 views

Qiskit - MissingOptionalLibraryError pdflatex library is required to use LaTeX circuit drawing

Trying to run below snippet to generate circuit diagram in a Jupyter notebook on Windows. ...
user avatar
4 votes
1 answer
46 views

CCCRY gate creation

I'm aware there's a few questions about CCCRY gate composition on here but I still have a few questions. I'm following Frank Zickert's book on qiskit and he has defined a CCRY gate as ...
user avatar
2 votes
1 answer
27 views

TranspilerError: 'The input circuit None is not scheduled'

The following error occurs when executing the code to measure the dephasing time(T2). I would appreciate it if someone could give me a solution to this problem. Among the two functions below, ...
user avatar
1 vote
3 answers
151 views

Is there any way to always output |1> if the measurement has a probability to output 1?

Let's say I have an oracle that outputs 1 on a specific input (there can be multiple inputs x so that f(x)=1), else it outputs 0. If there is no such input so that f(x)=1, the quantum state of the ...
user avatar
3 votes
1 answer
47 views

How are the experiments ordered in a Qiskit Job?

Using the execute function, assuming the parameter experiments is a list[QuantumCircuit], would each circuit execute on the ...
user avatar
0 votes
0 answers
23 views

How to write QSVR_Loss function in Python?

I encountered a problem when I was doing quantum support vector machine experiments: when I was doing quantum kernel alignment, I saw that the example given by qiskit was SVC_Loss: https://qiskit.org/...
user avatar
1 vote
1 answer
46 views

Using Qiskit's AerSimulator with an AMD GPU

I have an AMD 6700S that I want to use for Qiskit simulations. The test case below is calculating the QFT. If I set my code up like this: ...
user avatar
3 votes
1 answer
88 views

Efficiently compute $\langle 0^{\otimes n} | e^{iA} H e^{-iB} |0^{\otimes n} \rangle$ in Qiskit

From this SE question and this Qiskit tutorial, I understand how to compute the expectation such in the form of $\langle \psi|H|\psi\rangle$ or $\langle 0^{\otimes n} |e^{iA} H e^{-iA}|0^{\otimes n} \...
user avatar
0 votes
0 answers
15 views

How to monitor a qiskit neural network on IBM Cloud?

I know qiskit offers the job_monitor function. However it only allows monitoring a BaseJob, for instance the one outputted from ...
user avatar
  • 307
2 votes
1 answer
122 views

Understanding Paddle Quantum's MBQC simulation

Paddle Quantum have a toolkit for simulating measurement-based QC patterns in Python, and I'm having a hard time understanding how this works. For example, the following code snippet considers the ...
user avatar
  • 174
1 vote
1 answer
47 views

Is this Quantum Neural Network overfitting?

In the accuracy graphs (attached the graph images below) shown in this code (Binary Classification for Fraud Detection): validation loss is greater than training loss training accuracy is greater ...
user avatar
  • 11
1 vote
0 answers
96 views

PyZX optimisation steps for Clifford circuits

Given the following ZX-diagram It should represent some random Clifford circuit (LC means Local Clifford). As far as I got, any Clifford circuit can be transformed into a ZX-diagram like the above, i....
user avatar
0 votes
1 answer
22 views

What is the data type "Unit is Adj" in Q#?

I came across it as the return type of operations in this paper: https://arxiv.org/abs/2204.13835. It is also used in various places in the Q# documentation.
user avatar
  • 475
0 votes
1 answer
52 views

References for two-local forms in QISKIT

I am using 'Two local' form of QISKIT as a waveform ansatz in VQE to compute ground state. QISKIT documentation does not provide references to all the entangling options. Is there any other place ...
user avatar
  • 35
1 vote
1 answer
52 views

cirq_google library in Python

I am trying to use the cirq_google library in Python but I receive an error: ...
user avatar
  • 223
2 votes
1 answer
138 views

How to implement subplots (several blochsphere plots) using qiskit?

Qiskit seems to use matplotlib for rendering bloch spheres under the hood. Therefore, it would be nice if we could also make use of matplotlib's subplot technique. I would like to implement subplots, ...
user avatar
1 vote
1 answer
43 views

How to convert between little/big-endian unitary forms in Braket?

As noted in this post, the Amazon Braket unitary calculation method as_unitary has been deprecated (#325) as it uses little-endian qubit order. The new, big-endian method is to_unitary. Here's a code ...
user avatar
  • 1,888
1 vote
1 answer
46 views

LaTeX package for drawing MBQC patterns [closed]

I'm looking for an appropriate $\LaTeX$ package for drawing measurement-based quantum computing patterns similar to the picture below: Does anyone know of a package which may be most efficient for ...
user avatar
  • 174
0 votes
0 answers
12 views

Understanding how control parameter inputs work in tfq.layers.ControlledPQC

In the documentation of tfq.layers.ControlledPQC, the authors provide model_params as one of the argument to the ControlledPQC object ...
user avatar
0 votes
1 answer
76 views

I am getting an error like this 'Invalid input data format for Statevector'

I am new at QC. I learn from a course. When I write to this code: ...
user avatar
  • 3
1 vote
0 answers
46 views

How to perform lattice surgery with initial state $|0\rangle+|1\rangle$, with qasm?

I am trying to perform a lattice surgery. Initial state is $|0\rangle+|1\rangle$ and when I perform a smooth merge and split, I think I get $|00\rangle+|11\rangle$ but it doesn't work. Is there ...
user avatar
1 vote
1 answer
52 views

Qiskit: Get number of iterations for Iterative Amplitude Estimation

Trying to count the number of uses of my circuit $A$ in Grover iterate circuit $Q= -AS_0A^{\dagger}S_x$. However, Qiskit's amplitude estimation algorithms such as IAE or FAE accept only precision ...
user avatar
  • 137
1 vote
1 answer
51 views

Can someone explain to me what is T gate and tdg like im five?

I'm newbie to quantum computing, i read about these two gates on IBM quantum computing docs, but I can't seem to understand what is t-gate and tdg or t-dagger, can someone give me a simple explanation ...
user avatar
0 votes
1 answer
25 views

Within Stim, how to trace back DEM error instructions to Stim circuit faults

If I have a line in a DEM e.g. error(0.001) D0 is there an easy way to see which circuit faults in the original circuit contributed to that error mechanism?
user avatar
  • 197
3 votes
1 answer
136 views

How to estimate Qiskit circuit runtime before sending to run on IBM real quantum device?

Qiskit, I tried to estimate circuit runtime using gate_length from Backend.properties() but its accuracy is very low (real system is 3.5 seconds, estimation is 0.00002 seconds). So, are there other ...
user avatar
0 votes
1 answer
19 views

Applying an S gate on which two states leaves the state unchanged

I was going through a guide given by my friend and it had this MCQ which I couldn't get the answer to. Applying an S gate on which two states leaves the state unchanged? |0 > |+ > |1 > |- &...
user avatar
1 vote
1 answer
50 views

What’s the difference between the DriveChannel and the Control Channel?

In my incredibly elementary understanding of superconducting qubits, a qubit is an LC circuit where the inductor has been replaced with a Josephson junction. In this system, microwave pulse operations ...
user avatar
2 votes
1 answer
113 views

Choosing a different optimizer when running QAOA in qiskit

I am trying to reproduce the QAOA example from https://qiskit.org/textbook/ch-applications/qaoa.html and learn how to opt for a different optimizer. The relevant block in the example is (towards the ...
user avatar
  • 515
2 votes
1 answer
63 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 ...
user avatar
  • 181
1 vote
0 answers
17 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 ...
user avatar
1 vote
0 answers
25 views

Azure quantum error message

I am using the IonQ QPU on the Azure quantum provider with a Google Cloud API to access the native gates. As you can see in the image attached, I got this error: ...
user avatar
  • 284
2 votes
2 answers
99 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 ...
user avatar
2 votes
1 answer
112 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) ...
user avatar
  • 50
2 votes
0 answers
27 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 ...
user avatar
  • 67
3 votes
2 answers
100 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 ...
user avatar
3 votes
1 answer
112 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 ...
user avatar
  • 159
1 vote
1 answer
44 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. ...
user avatar
0 votes
0 answers
19 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 ...
user avatar
1 vote
2 answers
46 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: ...
user avatar
1 vote
2 answers
102 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 ...
user avatar
0 votes
0 answers
90 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: ...
user avatar
  • 11
0 votes
0 answers
29 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 ...
user avatar
2 votes
1 answer
45 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 ...
user avatar
0 votes
1 answer
16 views

why is the ImFil optimizer history not completely 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 ...
user avatar
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....
user avatar
  • 379
2 votes
2 answers
181 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: ...
user avatar

1
2 3 4 5
28