Skip to content

Commit b32f04e

Browse files
committed
Use math.prod for painless typecheck
1 parent c4966f9 commit b32f04e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cirq-core/cirq/ops/projector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# pylint: disable=wrong-or-nonexistent-copyright-notice
22
import itertools
3+
import math
34
from typing import Any, Dict, Iterable, List, Mapping, Optional, Union
45

56
import numpy as np
@@ -61,7 +62,7 @@ def matrix(self, projector_qids: Optional[Iterable[raw_types.Qid]] = None) -> cs
6162
for qid in projector_qids
6263
]
6364

64-
total_d = np.prod([qid.dimension for qid in projector_qids], dtype=np.int64).item()
65+
total_d = math.prod(qid.dimension for qid in projector_qids)
6566

6667
ones_idx = []
6768
for idx in itertools.product(*idx_to_keep):

0 commit comments

Comments
 (0)