Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MeasureMulti*PauliSum #288

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 tersorized 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 @@ -424,7 +424,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 @@ -452,8 +452,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
Loading