Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
14 votes
3 answers
6k 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 ...
C-Roux's user avatar
  • 918
10 votes
1 answer
1k 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. ...
user14092875's user avatar
10 votes
1 answer
2k views

QUBO, Ising Hamiltonians and VQA

I understand that usually the combinatorial optimisation problems are turned into QUBO, which has a very simple mapping to Ising Hamiltonians. Ising Hamiltonians in turn have the desired properties of ...
karolyzz's user avatar
  • 289
7 votes
1 answer
5k views

How to add several parameters in qiskit circuit?

I want to construct an ansatz circuit in Qiskit, so I need some parameters to act on the gates (e.g. RX(a), RY(b)). In the Qiskit tutorials I find a way to implement a parameter: ...
wu Peter's user avatar
7 votes
1 answer
939 views

How can I run a VQE on one of IBMQ's Quantum Computers

I have implemented a VQE based on Qiskit's VQE function and want to run that on an actual quantum computer. My understanding was, that an IBMQ backend can be passed into the function as a Quantum ...
Tom's user avatar
  • 71
7 votes
0 answers
210 views

Run VQE for parametrized quantum circuit with ancilla qubits

Let's say we have the following circuit (picture and code shown below), and now the $q_0$ is an ancilla qubit. If the system of interest has only two qubits, Is there a way to use only $q_{1,2}$ as my ...
fagd's user avatar
  • 975
6 votes
1 answer
390 views

Use one_body_integrals to know which orbitals to freeze in ElectronicStructureProblem

In exercise 5 of the this year's IBM Quantum Challenge, you need to use the FreezeCoreTransformer (along two_qubit_reduction and ...
epelaez's user avatar
  • 2,965
5 votes
1 answer
738 views

Simulation of a helium molecule using Qiskit

I am trying to compute the ground state energy of He-He using VQE. For this purpose I have utilized Qiskit and have written the following script: ...
user14660's user avatar
4 votes
3 answers
2k views

Creating a parameterized Operator in Qiskit

I'm trying to run a VQE for a specific custom Anzats. The Anzats is built up of an unitary matrix $U_H$, which I'm trying to created in this way: ...
Paco Bontenbal's user avatar
4 votes
1 answer
488 views

TypeError: 'NumPyMinimumEigensolver' object is not subscriptable

I'm trying to implement the same Jupyter notebook Jin-Sung Kim gave in his YouTube video The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4; however, I'm ...
Bruno Ambrozio's user avatar
4 votes
2 answers
344 views

How do I identify a VQE job run in real hardware?

I am running a VQEUCCFactory for H2 on a real hardware device. ...
bjail66's user avatar
  • 155
4 votes
0 answers
232 views

Implemented QAOA returns wrong result

I try to apply QAOA algorithm to find minimal energy state of the Hamiltonian: $H_A = \frac{1}{2}\sigma_z^1 + \frac{1}{2}\sigma_z^1\sigma_z^2$ It is expected that with p=2 my variational should ...
Masamune's user avatar
3 votes
1 answer
176 views

What explains my anomalously scaled up VQE?

I am trying to implement VQE from the Qiskit to obtain the ground state of a very specific Hamiltonian that has been generated via a docplex minimized quadratic ...
evil_potato's user avatar
3 votes
2 answers
463 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 ...
user14092875's user avatar
3 votes
1 answer
380 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 ...
user14924's user avatar
  • 317
3 votes
1 answer
270 views

VQE from scratch, what have I got wrong?

I've been working on a code to run VQE with a grouped measurement. For some reason, my expectation values are slightly off from those computed by pennylane, the software I decided to use for this ...
Cuhrazatee's user avatar
3 votes
1 answer
2k views

Qiskit - Simpler way to create a Hamiltonian

I am looking for an efficient way to create a Hamiltonian in Qiskit. Following are my desired input and outputs input: 'ZZI' output: Z^Z^I, where Z and I are operators. Here is how I am doing it ...
boniface316's user avatar
3 votes
2 answers
855 views

Qiskit best programming practices - how to speed up qiskit code?

I am currently doing some experiments using Variational Quantum Eigensolver in molecular dynamics using qiskit, and noticed that the time for execution on real backend is significantly higher than the ...
Vindem's user avatar
  • 85
3 votes
1 answer
455 views

Variational quantum eigensolver in qiskit

I have implemented a hybrid quantum NN on a dataset to perform classification. Now I want to apply quantum PCA to my dataset to find the eigenvalues. After going through a few qiskit tutorials, I ...
user14924's user avatar
  • 317
3 votes
1 answer
166 views

Trouble when implement a self designed gradient in qiskit

everyone! I have trouble when implement a self-designed gradient to the VQE algorithm. The following code will pop the 'ListOp' object is not callable exception to the last line of the code when ...
ironmanaudi's user avatar
3 votes
1 answer
296 views

How to find the expectation value of several circuits using Qiskit aqua operator logic?

I am using the method from this SE answer to calculate the expectation value using qiskit aqua operator logic which works well for a single circuit. Here is a simplified code snippet to demonstrate ...
thespaceman's user avatar
3 votes
1 answer
950 views

Using Qiskit VQE for solving an eigenvalue problem

I am a new user of Qiskit and I believe there is a simple answer to my question but I have had a very hard time finding a straightforward answer. I am trying to transform a given $3 \times 3$ (...
John R's user avatar
  • 41
3 votes
2 answers
609 views

How to run VQE experiments on IBMQ Backends?

The VQE.run method only takes a quantum_instance of type QuantumInstance or BaseBackend and ...
MShakeG's user avatar
  • 431
3 votes
1 answer
172 views

What is the best way to handle parametric circuits in Qiskit?

What is the best way to handle parametric circuits in Qiskit? When I create a variational form like TwoLocal and then do ...
Bidon's user avatar
  • 878
3 votes
1 answer
382 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 ...
Joshua's user avatar
  • 57
2 votes
3 answers
1k views

Creating a custom VariationalForm in Qiskit

I would like to use the built-in Qiskit VQE() function, with my own variational form. What is the proper way to define it? I was expecting ...
mavzolej's user avatar
  • 2,221
2 votes
3 answers
468 views

error when running VQE in Qiskit

I am running the code, which gets the ground state energy with different atomic distances of LiH. However, I encountered this error. The code is as follow ...
ironmanaudi's user avatar
2 votes
1 answer
143 views

The number of qubits of the ansatz does not match the operator

I am trying to run my below code on FakeSherbrooke() system, but I am getting an error as shown below: ...
Manu's user avatar
  • 219
2 votes
2 answers
400 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? ...
ironmanaudi's user avatar
2 votes
1 answer
174 views

Qiskit: getting QAOA expectation

Suppose I run the Qiskit's QAOA algorithm. qaoa = QAOA(operator=qubit_operator, p=p, optimizer=optimizer) result = qaoa.run(quantum_instance) There is a built-in ...
Ghostwriter's user avatar
2 votes
1 answer
475 views

Increase maximum shots on IBM Hardware when running Quantum Variational Algorithms

I am interested to know whether there is a quick and elegant way of increasing the number of shots (more than 8192 shots) on IBM hardware when running variational algorithms like VQE or QAOA. I know ...
KAJ226's user avatar
  • 14.1k
2 votes
1 answer
201 views

How to build an ExpectationBase object?

I'm trying to wrap my head around the expectation argument in Qiskit's VQE class, so to understand it I'm trying to create an ExpectationBase object to understand ...
Bidon's user avatar
  • 878
2 votes
2 answers
535 views

Need some help with simulating molecules with VQE

I have studied the example of the simulation of LiH molecule in Learning Quantum Computation using Qiskit. It is available on this link: https://qiskit.org/textbook/ch-applications/vqe-molecules.html#...
Antonio Sannia's user avatar
2 votes
1 answer
324 views

How to improve accuracy of ground energy values from a VQE

Using the Qiskit textbook I have been using a VQE to find the ground state energy of Hydrogen at different interatomic distances on a quantum machine. However, the average energy value I will always ...
LouisL's user avatar
  • 71
2 votes
1 answer
515 views

Why VQE gives an incorrect ground state energy for a chain of 4 hydrogen atoms?

I am a bit hesitant to ask this very specific question, as I feel other people need not benefit from it. But since I have struggled for a while, and I think I should get some help. So I am using VQE ...
fagd's user avatar
  • 975
2 votes
1 answer
573 views

On number of parameters and operators in UCCSD in qiskit

I have two questions on UCCSD in qiskit, please see the code below. ...
fagd's user avatar
  • 975
2 votes
0 answers
70 views

What is the input for the interpret of Quantum Variational Regressors?

I'm trying to implement my first variational regressor using qiskit. I would like to understand how the interpret of a CircuitQNN works. I need to define an interpret that works on the amplitudes of a ...
Roberto Schiattarella's user avatar
2 votes
0 answers
104 views

How to implement the Mixer of Quantum Alternating Operator Ansatz for Max-Independent-Set

I am trying to implement the Mixer of the Max-Independent Set from The Quantum Alternating Operator Ansatz from this paper (arXiv) in Chapter 4.2, page 15 to 17. For every verice $v$ in the Graph this ...
Hannah's user avatar
  • 529
2 votes
0 answers
138 views

Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian

I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework. My Hamiltonian is the following: $H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$ I try to ...
Schrödinger314's user avatar
1 vote
1 answer
160 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 ...
Pranav M's user avatar
1 vote
1 answer
353 views

An effective way to submit all the jobs for VQE/QAOA at a time to an IBMQ machine?

In Qiskit, I am solving a VRP for 5 nodes and it creates 20 variables for a QUBO. It runs in a 65 qubit machines (any machine below that many fails). Now, in such a typical solvers for optimization (...
Amitava Chakraborty's user avatar
1 vote
1 answer
62 views

vqe.compute_minimum_eigenvalue API of qiskit produces different eigenstate results for statevector_simulator ands qasm_simulator

I am trying to understand the usage of vqe.compute_minimum_eigenvalue API of qiskit for the statevector_simulator and qasm_simulator. I am only interested in the <...
Manu's user avatar
  • 513
1 vote
1 answer
92 views

Reusing Parameters for Multiple Runs with Qiskit's SPSA Optimization

I am using Qiskit's SPSA optimization algorithm to find the ground state energy of various lattices (Fermi-Hubbard model) by running different circuits through it and having the algorithm modify the ...
Nidhish Sharma's user avatar
1 vote
1 answer
205 views

Recording the time taken by a VQE to find ground state energy

I want to record the time that a VQE solver takes to find the ground state. At the moment I am using: ...
LouisL's user avatar
  • 71
1 vote
2 answers
256 views

Why is there a significant variation between the exact and VQE energy results?

When running the VQE simulation for $H_2$ over a range of distances as detailed in the Simulating Molecules using VQE section of the Qiskit Textbook, the VQE energy deviation from the exact energy ...
MShakeG's user avatar
  • 431
1 vote
1 answer
198 views

Why is circuit inverse not working for EfficientSU2?

For some reason I get the following error when attempting to find the inverse of the EfficientSU2 VQE variational form: TypeError: 'NoneType' object is not ...
MShakeG's user avatar
  • 431
1 vote
1 answer
269 views

SPSA max_trials

I'm using SPSA as an optimizer in VQE algorithm. The code runs on ibmq-qasm-simulator. I've set SPSA max_trials parameter to 500, but, when I run the code, it makes ...
Valentina's user avatar
1 vote
1 answer
107 views

Need help regarding building a custom VQE

I want to write code for a custom Variational Quantum Eigensolver (VQE) capable of computing eigenvalue(s) for non-Hermitian systems, based on this paper. I have formulated a cost function (provided ...
Bravyi's user avatar
  • 11
1 vote
2 answers
464 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 ...
Samuel Grund's user avatar
1 vote
1 answer
363 views

Why does the Qiskit tutorial for the Variational Quantum Linear Solver not work properly?

I am following this very nice qiskit tutorial on how to implement a simple variational quantum linear solver (VQLS). There are 3 examples implemented in the tutorial all of which are solving the $Ax=b$...
thespaceman's user avatar