Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

EntangledMeasurementGrouper (Qiskit-Terra/OperatorFlow) #20

Open
2 of 8 tasks
ikkoham opened this issue Feb 16, 2021 · 12 comments
Open
2 of 8 tasks

EntangledMeasurementGrouper (Qiskit-Terra/OperatorFlow) #20

ikkoham opened this issue Feb 16, 2021 · 12 comments
Assignees
Labels
from coach project topic suggested by hackathon coach group is ready group has more than three members

Comments

@ikkoham
Copy link

ikkoham commented Feb 16, 2021

Abstract

Reduction of the number of measurements is one of the most important topic for variational quantum algorithms. In Qiskit, Abelian grouper was implemented for the evaluations of expectation values by joint measurement of tensor product basis (TPB). This project enhances the grouper by using entangled measurements.

Description

This project aims to implement a part of our research for Qiskit and improve the research.
The number of measurements can be reduced by entangled measurements. For example, Bell measurement is a joint measurement of XX, YY, and ZZ.
image
We use the entangled joint measurements to improve the grouper.
Very recently, I have added the parameter grouping_type for this purpose.https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/opflow/primitive_ops/pauli_sum_op.py#L39

Milestone

  • Fork Qiskit-Terra and make a branch
  • Enhance the grouper
  • Implement the entangled measurement circuits
  • [Optional] Remove the unnecessary measurements
  • [Optional] Experiment with the real quantum devices
  • [Optional] Benchmark the performance
  • [Optional] Improve the algorithms
  • Make a presentation!

References

Members

Deliverable

  • Make Pull Requests to Operator Flow in Qiskit Terra.
  • [Optional] Jupyter notebook or short paper?

GitHub repo

@ikkoham ikkoham added the members wanted looking for more members label Feb 16, 2021
@starktech23 starktech23 added the from coach project topic suggested by hackathon coach label Feb 16, 2021
@ikkoham ikkoham changed the title EntangledMeasurementGrouper EntangledMeasurementGrouper (Qiskit-Terra/OperatorFlow) Feb 16, 2021
@KIMJAEHEE0821
Copy link

Hello, I want to participate in this project. Can I join the team?

@physicman96
Copy link

I'm interested in this project. Could I join this team?

@YubeenKim
Copy link

I am also interested in this project!!

@sky-born
Copy link

It seems very interesting. I want to reduce measurement too. Can I join this project?

@ghost
Copy link

ghost commented Feb 17, 2021

it is very groundbreaking idea! Can i participate?

@veenaiyuri veenaiyuri added group is ready group has more than three members and removed members wanted looking for more members labels Feb 17, 2021
@ikkoham
Copy link
Author

ikkoham commented Feb 18, 2021

Dev Environment

  1. Fork Qiskit-Terra

  2. Make your branch to work

For CLI

git clone https://github.com/Qiskit/qiskit-terra.git
git remote add sky-born https://github.com/sky-born/qiskit-terra
git fetch sky-born
git switch -c qiskit_korea_hackerthon sky-born/qiskit_korea_hackerthon

Launch Jupyter Notebook with dev env

@ikkoham
Copy link
Author

ikkoham commented Feb 18, 2021

It may be better to prepare the molecule for benchmark.

@YubeenKim
Copy link

I saw LiH, BeH2, H2O, NH3, HCl is in the paper. Should we use that??

@ikkoham
Copy link
Author

ikkoham commented Feb 18, 2021

You can choose it. You can use same molecules with the paper, or it may be interesting to study and compare other molecules.
Note that the paper uses Ancillary files in https://arxiv.org/abs/1701.08213. if you want to use Ancillary files, you need to parse the data and make PauliSumOp from them.

@sky-born
Copy link

How can I extract Pauli string from PaulisumOp operator?

@sky-born
Copy link

and SummedOp too, It's not easy to extract Pauli string operators from PaulisumOp and SummedOp class

@ikkoham
Copy link
Author

ikkoham commented Feb 18, 2021

This is a hint for creating Pauli graph.
https://github.com/Qiskit/qiskit-terra/pull/5299/files

Hint for _anti_commutation_graph(ops: PauliSumOp) -> List[Tuple[int, int]]:
For TPB (qubit-wise anti-commutation graph),

# convert a Pauli operator into int vector where {I: 0, X: 2, Y: 3, Z: 1}
mat1 = np.array(
    [op.primitive.table.Z[0] + 2 * op.primitive.table.X[0] for op in observable],
    dtype=np.int8,
)
mat2 = mat1[:, None]
# mat3[i, j] is True if i and j are commutable with TPB
mat3 = (mat1 * mat2) * (mat1 - mat2)
mat4 = (mat3 == 0).all(axis=2)
# return [(i, j) if mat3[i, j] is False and i < j]
return list(zip(*np.where(np.triu(np.logical_not(mat4), k=1))))

For ALL, (general anti-commutation graph),

# convert a Pauli operator into int vector where {I: 0, X: 2, Y: 3, Z: 1}
mat1 = np.array(
    [op.primitive.table.Z[0] + 2 * op.primitive.table.X[0] for op in observable],
    dtype=np.int8,
)
mat2 = mat1[:, None]
# mat3[i, j] is True if i and j are commutable with TPB
mat3 = (mat1 * mat2) * (mat1 - mat2)
mat4 = mat3.copy()
mat4[mat3 == 0] = 1
mat4[mat3 != 0] = -1
mat5 = np.multiply.reduce(mat4, axis=2) == 1
return list(zip(*np.where(np.triu(np.logical_not(mat5), k=1))))

This algorithm is too difficult because I use numpy technique for performance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
from coach project topic suggested by hackathon coach group is ready group has more than three members
Projects
None yet
Development

No branches or pull requests

7 participants