Skip to content

Commit

Permalink
Merge pull request #288 from yannick-couzinie/patch-1
Browse files Browse the repository at this point in the history
Fix MeasureMulti*PauliSum
  • Loading branch information
01110011011101010110010001101111 authored Nov 18, 2024
2 parents 8555b83 + 46aa4e0 commit 79ce996
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ Researchers on quantum algorithm design, parameterized quantum circuit training,
Dynamic computation graph, automatic gradient computation, fast GPU support, batch model tensorized processing.

## News
- Torchquantum is used in the winning team for ACM Quantum Computing for Drug Discovery Challenge.
- Torchquantum is highlighted in [UnitaryHack](https://unitaryhack.dev/projects/torchquantum/).
- TorchQuantum received [UnitaryFund](https://unitary.fund/).
- TorchQuantum is integrated to [IBM Qiskit Ecosystem](https://qiskit.github.io/ecosystem/).
- TorchQuantum is integrated to [PyTorch Ecosystem](https://pytorch.org/ecosystem/).
- v0.1.8 Available!
- Check the [dev branch](https://github.com/mit-han-lab/torchquantum/tree/dev) for new latest features on quantum layers and quantum algorithms.
- Join our [Slack](https://join.slack.com/t/torchquantum/shared_invite/zt-1ghuf283a-OtP4mCPJREd~367VX~TaQQ) for real time support!
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dill==0.3.4
matplotlib>=3.3.2
nbsphinx
numpy>=1.19.2
numpy>=1.19.2,<2

opt_einsum
pathos>=0.2.7
Expand Down
7 changes: 4 additions & 3 deletions torchquantum/measurement/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def __init__(self, obs_list, v_c_reg_mapping=None):
)

def forward(self, qdev: tq.QuantumDevice):
res_all = self.measure_multiple_times(qdev)
res_all = self.measure_multiple_times(qdev).prod(-1)

return res_all.sum(-1)

Expand Down Expand Up @@ -449,8 +449,9 @@ def __init__(self, obs_list, v_c_reg_mapping=None):
)

def forward(self, qdev: tq.QuantumDevice):
res_all = self.measure_multiple_times(qdev)
return (res_all * self.obs_list[0]["coefficient"]).sum(-1)
res_all = self.measure_multiple_times(qdev).prod(-1)

return (res_all * torch.tensor(self.obs_list[0]["coefficient"])).sum(-1)


if __name__ == '__main__':
Expand Down

0 comments on commit 79ce996

Please sign in to comment.