Skip to content

Commit 79ce996

Browse files
Merge pull request #288 from yannick-couzinie/patch-1
Fix MeasureMulti*PauliSum
2 parents 8555b83 + 46aa4e0 commit 79ce996

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Researchers on quantum algorithm design, parameterized quantum circuit training,
5858
Dynamic computation graph, automatic gradient computation, fast GPU support, batch model tensorized processing.
5959

6060
## News
61+
- Torchquantum is used in the winning team for ACM Quantum Computing for Drug Discovery Challenge.
62+
- Torchquantum is highlighted in [UnitaryHack](https://unitaryhack.dev/projects/torchquantum/).
63+
- TorchQuantum received [UnitaryFund](https://unitary.fund/).
64+
- TorchQuantum is integrated to [IBM Qiskit Ecosystem](https://qiskit.github.io/ecosystem/).
65+
- TorchQuantum is integrated to [PyTorch Ecosystem](https://pytorch.org/ecosystem/).
6166
- v0.1.8 Available!
6267
- Check the [dev branch](https://github.com/mit-han-lab/torchquantum/tree/dev) for new latest features on quantum layers and quantum algorithms.
6368
- Join our [Slack](https://join.slack.com/t/torchquantum/shared_invite/zt-1ghuf283a-OtP4mCPJREd~367VX~TaQQ) for real time support!

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
dill==0.3.4
33
matplotlib>=3.3.2
44
nbsphinx
5-
numpy>=1.19.2
5+
numpy>=1.19.2,<2
66

77
opt_einsum
88
pathos>=0.2.7

torchquantum/measurement/measurements.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def __init__(self, obs_list, v_c_reg_mapping=None):
421421
)
422422

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

426426
return res_all.sum(-1)
427427

@@ -449,8 +449,9 @@ def __init__(self, obs_list, v_c_reg_mapping=None):
449449
)
450450

451451
def forward(self, qdev: tq.QuantumDevice):
452-
res_all = self.measure_multiple_times(qdev)
453-
return (res_all * self.obs_list[0]["coefficient"]).sum(-1)
452+
res_all = self.measure_multiple_times(qdev).prod(-1)
453+
454+
return (res_all * torch.tensor(self.obs_list[0]["coefficient"])).sum(-1)
454455

455456

456457
if __name__ == '__main__':

0 commit comments

Comments
 (0)