Skip to content

Commit

Permalink
Remove MeasureMultiPauliSum (not correctly implemented)
Browse files Browse the repository at this point in the history
  • Loading branch information
yannick-couzinie committed Nov 20, 2024
1 parent 1da8350 commit e2bff08
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions torchquantum/measurement/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"expval",
"MeasureAll",
"MeasureMultipleTimes",
"MeasureMultiPauliSum",
"MeasureMultiQubitPauliSum",
"gen_bitstrings",
"measure",
Expand Down Expand Up @@ -396,37 +395,6 @@ def set_v_c_reg_mapping(self, mapping):
self.v_c_reg_mapping = mapping


class MeasureMultiPauliSum(tq.QuantumModule):
"""
similar to qiskit.opflow PauliSumOp
obs list:
list of dict: example
[{'wires': [0, 2, 3, 1],
'observables': ['x', 'y', 'z', 'i'],
'coefficient': [1, 0.5, 0.4, 0.3]
},
{'wires': [0, 2, 3, 1],
'observables': ['x', 'y', 'z', 'i'],
'coefficient': [1, 0.5, 0.4, 0.3]
},
]
"""

def __init__(self, obs_list, v_c_reg_mapping=None):
super().__init__()
self.obs_list = obs_list
self.v_c_reg_mapping = v_c_reg_mapping
self.measure_multiple_times = MeasureMultipleTimes(
obs_list=obs_list, v_c_reg_mapping=v_c_reg_mapping
)

def forward(self, qdev: tq.QuantumDevice):
# returns batch x len(obs_list) object, return sum
res_all = self.measure_multiple_times(qdev)

return res_all.sum(-1)


class MeasureMultiQubitPauliSum(tq.QuantumModule):
"""obs list:
list of dict: example
Expand Down

0 comments on commit e2bff08

Please sign in to comment.