This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
Incorrectly generated matrix out of a list of Pauli strings after converting to opflow #1381
Labels
type: bug
Something isn't working
Comments
Thanks for the issue. minimal code qubit_op = WeightedPauliOperator.from_dict({"paulis":[{"coeff": {"imag": 1, "real": 0}, "label": "X"}]})
print(qubit_op.to_opflow().to_matrix()) This returns a Pauli X. I will fix this issue. |
ikkoham
added a commit
to ikkoham/qiskit-aqua
that referenced
this issue
Oct 26, 2020
ikkoham
added a commit
to ikkoham/qiskit-aqua
that referenced
this issue
Oct 26, 2020
manoelmarques
pushed a commit
to manoelmarques/qiskit-aqua
that referenced
this issue
Nov 9, 2020
* fix qiskit-community#1311 * fix qiskit-community#1317 * add a test of reps for trotterization * fix tests for qiskit-community#1311 * fix typing * fix qiskit-community#1321 * add release note * fix qiskit-community#1381 * add a test for to_opflow * Update qiskit/aqua/operators/converters/circuit_sampler.py Co-authored-by: John Lapeyre <[email protected]> * remove None from constructor * simplify logic * Revert "remove None from constructor" This reverts commit c884ebb. * add releasenote * simplify logic (not iscomplex to isreal) * remove Optional * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Panagiotis Barkoutsos <[email protected]> Co-authored-by: Steve Wood <[email protected]>
mtreinish
pushed a commit
to mtreinish/qiskit-core
that referenced
this issue
Nov 20, 2020
* fix qiskit-community/qiskit-aqua#1311 * fix qiskit-community/qiskit-aqua#1317 * add a test of reps for trotterization * fix tests for qiskit-community/qiskit-aqua#1311 * fix typing * fix qiskit-community/qiskit-aqua#1321 * add release note * fix qiskit-community/qiskit-aqua#1381 * add a test for to_opflow * Update qiskit/aqua/operators/converters/circuit_sampler.py Co-authored-by: John Lapeyre <[email protected]> * remove None from constructor * simplify logic * Revert "remove None from constructor" This reverts commit c884ebba123adee22f252e11f90964a6defaec38. * add releasenote * simplify logic (not iscomplex to isreal) * remove Optional * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Panagiotis Barkoutsos <[email protected]> Co-authored-by: Steve Wood <[email protected]>
manoelmarques
pushed a commit
to manoelmarques/qiskit-terra
that referenced
this issue
Dec 2, 2020
* fix qiskit-community/qiskit-aqua#1311 * fix qiskit-community/qiskit-aqua#1317 * add a test of reps for trotterization * fix tests for qiskit-community/qiskit-aqua#1311 * fix typing * fix qiskit-community/qiskit-aqua#1321 * add release note * fix qiskit-community/qiskit-aqua#1381 * add a test for to_opflow * Update qiskit/aqua/operators/converters/circuit_sampler.py Co-authored-by: John Lapeyre <[email protected]> * remove None from constructor * simplify logic * Revert "remove None from constructor" This reverts commit c884ebba123adee22f252e11f90964a6defaec38. * add releasenote * simplify logic (not iscomplex to isreal) * remove Optional * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Panagiotis Barkoutsos <[email protected]> Co-authored-by: Steve Wood <[email protected]>
manoelmarques
pushed a commit
to manoelmarques/qiskit-terra
that referenced
this issue
Dec 7, 2020
* fix qiskit-community/qiskit-aqua#1311 * fix qiskit-community/qiskit-aqua#1317 * add a test of reps for trotterization * fix tests for qiskit-community/qiskit-aqua#1311 * fix typing * fix qiskit-community/qiskit-aqua#1321 * add release note * fix qiskit-community/qiskit-aqua#1381 * add a test for to_opflow * Update qiskit/aqua/operators/converters/circuit_sampler.py Co-authored-by: John Lapeyre <[email protected]> * remove None from constructor * simplify logic * Revert "remove None from constructor" This reverts commit c884ebba123adee22f252e11f90964a6defaec38. * add releasenote * simplify logic (not iscomplex to isreal) * remove Optional * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py * Update qiskit/aqua/operators/legacy/weighted_pauli_operator.py Co-authored-by: John Lapeyre <[email protected]> Co-authored-by: Panagiotis Barkoutsos <[email protected]> Co-authored-by: Steve Wood <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Information
Qiskit Aqua version:
'qiskit-terra': '0.17.0',
'qiskit-aer': '0.8.0',
'qiskit-ignis': '0.6.0',
'qiskit-ibmq-provider': '0.12.0',
'qiskit-aqua': '0.9.0'
Python version:
Python 3.6.11 | packaged by conda-forge | (default, Aug 5 2020, 20:19:23)
Operating system:
macOS Cataline Version 10.15.5 (19F101)
What is the current behavior?
Problem spotted when executed the
NumpyEigensolver
for an operator.The matrix and the spectrum of an operator (specific case) is changed when using
to_opflow()
(automatically called for legacy operators in theNumpyEigensolver
).Steps to reproduce the problem
Given a list of Paulis strings with coefficients in a dictionary (particular case), giving it to
WeightedPauliOperator
to construct the matrix withqubit_op= WeightedPauliOperator.from_dict(pauli_list)
thenmatrix = to_matrix_operator(qubit_op).dense_matrix
upon diagonalization produces correct expected eigenvalues.Then, when switching
to_opflow()
, withqubit_op_opflow = qubit_op.to_opflow()
thenqubit_op_opflow_matrix = qubit_op_opflow.to_matrix()
the matrix and eigenvalues are modified.What is the expected behavior?
The spectrum of an operator (given as Pauli strings and their coefficients) should not change upon switching
to_opflow()
.Suggested solutions
Inspect the
to_opflow()
method and Pauli label to Pauli object converter.The text was updated successfully, but these errors were encountered: