Skip to content

Commit f8df3ba

Browse files
Fix dtype and XOR
1 parent c22bee0 commit f8df3ba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

qsimcirq/qsim_simulator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,7 @@ def _sample_measure_results(
380380
meas_indices = [qubit_map[qubit] for qubit in op.qubits]
381381
invert_mask = op.gate.full_invert_mask()
382382
# Apply invert mask to re-ordered results
383-
results[key] = np.logical_xor(
384-
full_results[:, meas_indices], invert_mask
385-
)
383+
results[key] = full_results[:, meas_indices] ^ invert_mask
386384

387385
else:
388386
options["c"] = self._translate_circuit(
@@ -394,15 +392,16 @@ def _sample_measure_results(
394392
shape=(
395393
repetitions,
396394
sum(cirq.num_qubits(op) for op in meas_ops.values()),
397-
)
395+
),
396+
dtype=int,
398397
)
399398
for i in range(repetitions):
400399
options["s"] = self.get_seed()
401400
measurements[i] = sampler_fn(options)
402401

403402
for key, (start, end) in bounds.items():
404403
invert_mask = meas_ops[key].gate.full_invert_mask()
405-
results[key] = np.logical_xor(measurements[:, start:end], invert_mask)
404+
results[key] = measurements[:, start:end] ^ invert_mask
406405

407406
return results
408407

0 commit comments

Comments
 (0)