Questions tagged [programming]

For questions about writing code to be executed on a quantum computer, or to more generally simulate some aspect of it. For questions about a specific programming language, please also include a more specific tag.

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

How to use qiskit transpile with Clifford + T basis?

How can I transpile using universal $Clifford + T$ gates set? I have only seen examples using rotations + $CNOT$. This is what I have tried ...
4
votes
1answer
310 views

How to find a common eigenstate of commuting operators?

I have multiple different operators in matrix form and I need to find their common eigenstates. The challenge is that the common eigenstate is in a superposition of multiple states and isn't just a ...
3
votes
0answers
84 views

Bell State 11 not working for parity curve

I am currently writing a script to automate the creation of parity curves for a 2 qubit bell state and then calculate fidelity and proving entanglement from that (inspired by this paper). It was going ...
3
votes
1answer
103 views

VQE jobs do not appear in queue

I am trying to calculate the ground state energy of some simple molecules using 'MolecularGroundStateEnergy' tools in qiskit. When I run the calculations for very small molecules (e.g. H2, HeH+) the ...
0
votes
0answers
20 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 ...
3
votes
1answer
59 views

Calculating the ground states of an Ising Hamiltonian on a real quantum computer

I have followed this tutorial and based on it, I've written the following function in qiskit, which can explicitly calculate the ground states of a transverse-field Ising Hamiltonian. ...
0
votes
1answer
69 views

Cannot Repeat HHL Result [closed]

There is an HHL example in IBM Qiskit https://qiskit.org/textbook/ch-applications/hhl_tutorial.html If I run on that website (click "Try") in Section 4 and set ...
1
vote
2answers
27 views

Error when attempting to visualize controlled hadamard gate state matrix with qiskit

I'm trying to get used to the qiskit module and quantum circuits in general, before tackling a QML project. So I'm going through the tutorial on the documentation page regarding gates. I've gotten as ...
3
votes
1answer
94 views

Intuition behind the construction of an ansatz circuit

I'm learning about the VQE algorithm. When I looked at the declaration in Qiskit I saw you need to pass an ansatz which prepares the state. I looked at some commonly used ansatz functions, e.g. ...
1
vote
1answer
62 views

How to compute the tensor product in QCL?

When I look at QCL (the documentation of the language begins in chapter 3) I don't see a way to compute the tensor product between two q-bits. Is the programming operator ...
2
votes
0answers
57 views

is it possible to eliminate a certain possibility of an outcome of 3+ qbits

Let's say I have n qbits each in a superposition $\begin{pmatrix} \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} \end{pmatrix}$ so each possible outcome has a probability of $\frac{1}{2^n}$. Is it possible ...
1
vote
1answer
47 views

Openfermion : `get_sparse_operator` issue

I am trying to use operfermion to calculated the eigen values for different molecules. Tried for Hydrogen, LithiumHydride, Water. It works fine. When Itried to calculated the same thing for Ozone, ...
1
vote
1answer
27 views

Recover backend information in working remotely with the IBM-QC

I'm reading the details of qiskit following this paper (I know it's a little bit dated, but some things shown there should be in principle still accessible). For ...
0
votes
0answers
29 views

How to extend Qiskit Quantum Counting with a Truthtable Oracle?

I'm a newbie in Quantum Computing. So please be indulgent with me. I'm trying to adapt the Qiskit Quantum Counting Example, which defines its oracle in a programmed quantum circuit, to use a ...
0
votes
1answer
65 views

Qiskit not finding CPLEX

I'm trying to use the CPLEX library alongside Qiskit but keep getting the error. ...
0
votes
1answer
90 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
27 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
1answer
60 views

PyTorch and Qiskit example from the Qiskit textbook seems broken

After executing the proceeding code blocks, when I try to copy the same code from Qiskit textbook on my jupyter notebook, I get the error as ...
3
votes
1answer
74 views

Implementing 3-Qubit Grover Algorithm in Qiskit

The Qiskit tutorial on Grover's Algorithm shows an example of finding two marked solutions out of 8 items, produced by 3 qubits. Using the general diffuser code it provides, however, I realize that ...
0
votes
1answer
74 views

Choi matrix in QETLAB

I am using QETLAB, a package for working with quantum information theory in Matlab and I have some doubts. I am trying to calculate diamond norms using such for some quantum channels. However, when ...
1
vote
2answers
69 views

Software used for modelling quantum processors

What kind of software is used for modelling quantum processor architectures? Not just simulate the output, but the one that is actually used in research.
2
votes
1answer
118 views

Symbolic computation with quantum circuits

What are my options for computing symbolic results for quantum circuits? I have identified some possibilities: SymPy (Python library, see also this), unfortunately, the software forces you to encode ...
1
vote
1answer
38 views

How do I work with Gaussian in Qiskit?

I am trying to run this Qiskit Nature tutorial (Vibrational Structure) and it uses the GaussianForceDriver. Every time I run the Gaussian job from Qiskit I get this message: ...
1
vote
1answer
66 views

A Simon's algorithm with secret string b = 01, IBM Quantum experience gives a different result from whay 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
2answers
70 views

How to measure a qubit Hamiltonian in qiskit

I am using qiskit to get some measurement results of observables similar to the Hamiltonian. Can someone provide the way how qiskit measures the Hamiltonian (Jordan-Wigner transformed) when using VQE? ...
-1
votes
1answer
46 views

Optimising Angle Code in Qiskit - Using the QAOAVarForm

I’ve got a bit of an elongated plea for aid here! I’ve got some code that finds the optimum angles for QAOA on the Maximum Independent Set Problem. It does however seem about ~10x slower than related ...
1
vote
1answer
48 views

Qiskit: is there a quick way to work out the spherical coordinates for a given qubit statevector?

I am trying to calculate the spherical coordinates of different qubit states (i.e. working out $\theta$ and $\phi$ from: $|\psi\rangle = e^{-i\phi/2}\cos(\theta/2)|0\rangle + e^{i\phi/2}\sin(\theta/2)|...
0
votes
1answer
93 views

Qiskit HHL algorithm BrokenProcessPool error

I try to run HHL algorithm on qasm_simulator. I took the example from here. I try to solve 8x8 random matrix and adjust some parameters in create_eigs. ...
2
votes
2answers
85 views

Re-initializing qubits in a circuit without losing superposition

So recently I was building some circuit made of subcircuits. My subcircuits happen to use auxiliary qubits, that are always initialized in the state $|0\rangle$ and are not used after the calculation. ...
4
votes
1answer
114 views

'Best practices' for making Stim run as fast as possible?

I'm currently testing out an error-correction surface code circuit in Stim. I've tried a 19x19 surface code over 10k rounds of syndrome extraction sampled 256 times, and this takes about 165 seconds. ...
2
votes
1answer
108 views

ImportError when setting up PySCF driver

I have a problem when attempting to set up a PySCF driver for a hydrogen molecule from the QISKIT Chemistry tutorial: https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html. ...
1
vote
1answer
49 views

Expectation value of an arbitrary observable. My own definition and `cirq` limitations

In my previous question I was struggling with the definition of expectation value of an observable for a circuit. Here is what I have derived after some support (I simplify the definition to 2-qubit ...
1
vote
1answer
38 views

Unable to use iSWAP in Qiskit TwoLocal entangling_block

I would like to use a general entangler in the entanglement_block of the TwoLocal function. The function seems to work with 'cz', 'cx', 'swap' gates, but it fails for 'iswap' gate. Below is the error ...
2
votes
1answer
50 views

Is there any way to assign a colour for a single gate in Qiskit?

I'm drawing with Qiskit a big circuit with some predefined and custom gates. I want to colour some of them in non-default colours for a better reading of it. Is it possible to do it for predefined ...
1
vote
1answer
542 views

import error :No module named 'qiskit_aqua'

I have an error when I use Quantum SVM kernel algorithm from Qiskit aqua. This is my code section with imports: ...
-2
votes
2answers
251 views

The most important quantum question , how to force a superposition qubit to collapses to an exact value? [closed]

Note: forcing a superposition qubit to collapses to 1, means cancel the other value 0 to get 1 appear Question details step by step: ...
0
votes
1answer
49 views

How the arguments of $U_3$ gate are converted when they're not lying in the expected range?

From the qiskit documentation (here), a general form of a single qubit unitary is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \sin\...
0
votes
1answer
35 views

Getting the current variational parameters in Qiskit

I am right now using variational quantum eigensolver (VQE) to calculate the ground state of some molecules, like H2, by qiskit. The quesiton is that how to get the current parameters of the varaional ...
0
votes
1answer
22 views

How can I compose the Ising XXPOW,YYPOW and ZZPOW gate in single qubit gates and CNOT,…?

I am a bit stuck in decomposing these gates in single qubit gates, in the Cirq documentation it is written, for example that XX is for example the tensor product of Rx gates. But when I calculate ...
0
votes
0answers
36 views

Question on qiskit.circuit.library.PiecewiseChebyshev Qiskit circuit library

This question follows the post https://quantumcomputing.stackexchange.com/posts/15070/edit. I am working on an implementation of HHL algorithm, to do so, I need to map $|\lambda\rangle\mapsto |\arcsin(...
0
votes
1answer
29 views

Quantum Katas - Tutorials - SingleQubitGates - Exercise 7 - Preparing an arbitrary state

Exercise 7 "Preparing an arbitrary state" from the Quantum Katas - Tutorials - SingleQubitGates asks to prepare a state $\alpha|0\rangle + e^{i\theta}\beta|1\rangle$, using parameters $\...
1
vote
0answers
47 views

How to solve TSP problem with more than 3 nodes in the tutorial of Max-Cut and Traveling Salesman Problem?

I had to try the example of qiskit’s Traveling Salesman Problem with 3 nodes and executing it at IBM backend called simulator_statevector.Can execute and get the result normally. But when trying to ...
2
votes
1answer
35 views

How to get eigenvectors of Hamiltonian in OpenFermion

In OpenFermion you can create a Hamiltonian in terms of creation and annihilation pretty easily: ...
0
votes
1answer
58 views

Calculating the expected value of a weighted Pauli Operator in Qiskit

Following UT course on Quantum Machine Learning, they have a notebook on QAOA. As part of their lecture, they perform QAOA using Qiskit. Unfortunately, it seems the new versions of Qiskit have changed ...
1
vote
2answers
62 views

How do I get the Unitary matrix of this circuit without using 'unitary_simulator'? [duplicate]

I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
4
votes
1answer
70 views

I don't understand unitary of ${e^{iAt}}$ from HHL algorithm

I tried to implement the following circuit in the image below but with the red circled gates replaced with a unitary controlled ${e^{iAt/2}}$ and controlled ${e^{iAt/4}}$ The image came from this ...
0
votes
1answer
37 views

I can't see the results of my of my jobs

New user here. I tried to run a test circuit which I submitted to ibmq_santiago to run, but now I cannot see my results. No histogram, no circuit, only the status timeline. I believe the problem is ...
2
votes
1answer
42 views

Design NISQ Circuit with StrawberryFields

I am trying to design this circuits with strawberry fields. However I could not connect my first and second qubit mode: orange boxes are beam splitters, blue boxes are phase shifters. The green box ...
2
votes
1answer
277 views

Qiskit issues with Apple Silicon?

Edit/summary: Everything below this first paragraph is my original question posted several days ago and involves a lot of speculating on a problem I knew less about at the time. The purpose of this ...

1
2 3 4 5
19