Linked Questions
15 questions linked to/from Evaluating expectation values of operators in Qiskit
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 ...
11
votes
2
answers
4k
views
Qiskit - Z expectation value from counts?
For a given state $|\psi\rangle$, how would I work out $\langle\psi|Z|\psi\rangle$ ?
If I run a quantum circuit and get the counts dictionary on qiskit, I get observables in the Z basis.
For n=1 ...
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 ...
2
votes
2
answers
304
views
Why is CircuitSampler ignoring number of shots if backend is a statevector_simulator?
I am calculating the expectation value of an operator using the CircuitSampler class as mentioned here. Now, I was getting exact same result for the expectation ...
4
votes
1
answer
351
views
Am I doing anything wrong when trying to calculate the expectation value in Qiskit on the real hardware?
I am trying to use the method of calculating the expectation values of Pauli operators in Qiskit which I found here.
However, the results obtained via IBMQ sampling differ significantly from the exact ...
3
votes
2
answers
220
views
Projection and expected value in Qiskit?
I want to make a circuit that measures the expected value of a projector. In this case I want to measure the expected value of the singlet projector operator, that is a non-unitary hermitian matrix. ...
3
votes
1
answer
170
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} \...
3
votes
1
answer
279
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 ...
2
votes
1
answer
207
views
Is it true that QasmSimulator is much slower than StatevectorSimulator, or am I doing something wrong?
I'm trying to calculate the expectation value of some operator for a state that comes out of a quantum circuit using Qiskit. I was initially using ...
2
votes
0
answers
197
views
Calculating exact expectation values on ibmq_qasm_simulator
In order to calculate the exact expectation value of a Pauli operator in some state using local qasm_simulator, I do
...
1
vote
1
answer
134
views
Parallel calculation of expectation values of operator for different quantum states qiskit on a QPU
I need to calculate the expectation values of an operator h for various quantum states ψ on an IBMQ quantum machine. This can be ...
1
vote
1
answer
165
views
Two questions on circuit composer on IBM Q Experience [closed]
I have two (unrelated) questions when I run circuits on IBM Q Expierence.
The first one is encountered, when I run the built-in function VQE (for H2 molecule). It seems two circuits were run, and the ...
1
vote
1
answer
114
views
Evaluate a gradient with a specific backend (Qiskit)
I'm following the tutorial on gradients in Qiskit. Suppose I have the following:
...
1
vote
2
answers
71
views
How to calculate the expected value of a quantum operator in Qiskit (after deprecations)
Background
In 2022 Qiskit released a very nice tutorial detailing how the expectation value of an operator could be found using CircuitOp. As of 2024, these ...
0
votes
0
answers
29
views
How does Qiskit CircuitSampler class calculate expectation values of operators?
I have been using Qiskit CircuitSampler class to calculate the expectation values of operators as described here. Now it turns ...