Skip to content

Commit e3a5f85

Browse files
fix unitary kraus bug
1 parent f8f741c commit e3a5f85

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
- Improve the efficiency of `sample_expectation_ps` method by using cached state.
1818

19+
### Fixed
20+
21+
- Fixed `unitary_kraus` of Circuit class support for multi-qubit kraus channels, previous implementation fails to reshape the kraus tensor as matrix
22+
1923
## 0.5.0
2024

2125
### Added

tensorcircuit/circuit.py

+1
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ def _unitary_kraus_template(
393393
sites = len(index)
394394
kraus = [k.tensor if isinstance(k, tn.Node) else k for k in kraus]
395395
kraus = [gates.array_to_tensor(k) for k in kraus]
396+
kraus = [backend.reshapem(k) for k in kraus]
396397
if prob is None:
397398
prob = [
398399
backend.real(backend.trace(backend.adjoint(k) @ k) / k.shape[0])

0 commit comments

Comments
 (0)