Attenuator not being applied to state
Closed this issue · 2 comments
elib20 commented
Before posting a bug report
- I have searched exisisting GitHub issues to make sure the issue does not already exist.
Expected behavior
If I apply an Attenuator to a state, I would expect the output state to be mixed and to have had loss applied to it.
Actual behavior
The state does not seem to be affected by the Attenuator.
Reproduces how often
Always.
System information
Mr Mustard: a differentiable bridge between phase space and Fock space.
Copyright 2018-2021 Xanadu Quantum Technologies Inc.
Python version: 3.10.4
Mr Mustard version: 0.3.0-dev
Numpy version: 1.21.6
Numba version: 0.55.1
Scipy version: 1.8.0
The Walrus version: 0.19.0
TensorFlow version: 2.9.1
Torch version: None
Source code
state = Vacuum(2) >> Sgate(1.15,modes=[0,1]) >> Rgate(np.pi/2,modes=[1]) >> BSgate(np.pi/4,modes=[0,1]) << Fock(4)
state = state >> Attenuator(0.5, modes=[0])
state.is_pure ##returns True but should be False
Tracebacks
No response
Additional information
No response
ziofil commented
oh wow. it seems like channels are not applied correctly when a state is in fock representation:
Fock(10) >> Attenuator(0.5)
only affects the norm
ziofil commented
Found the reason: there was a mismatch between is_unitary
and _is_unitary
. fixing it now