-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The Kraus[] operator accepts a list of matrices, e.g.
Kraus[ { {{a,b},{c,d}}, {{e,f},{g,h}} } ]
The passed structure depth must be 3. It is invalid to neglect the outer list, and pass e.g.
Kraus[ {{a,b},{c,d}}, {{e,f},{g,h}} ]
or
Kraus[ {{a,b},{c,d}} ]
Validation is not performed when the Kraus expression is formed, and is instead deferred to evaluation of functions ApplyCircuit (necessary for e.g. device specifications and circuit recompilation hijinks).
While functions like ApplyCircuit and DrawCircuit will fail when given the above invalid depth-2 Kraus arguments, other functions like CalcCircuitMatrix and CalcPauliTransferMatrix will proceed and silently output incorrect results! For example...
a = {{1, 2}, {3, 4}};
CalcCircuitMatrix[Subscript[Kraus, 0] @ a] (* invalid *)
CalcCircuitMatrix[Subscript[Kraus, 0] @ {a}] (* valid *)
will respectively output
{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 10, 14}, {0, 0, 14, 20}}
{{1, 2, 2, 4}, {3, 4, 6, 8}, {3, 6, 4, 8}, {9, 12, 12, 16}}
The first is a silent error, eep!
Fix this! I would seek to make the depth 2 input valid, so that the outer list is completely optional, and the Kraus symbol can accept multiple arguments (as the distinct matrices).