QuESTlink icon indicating copy to clipboard operation
QuESTlink copied to clipboard

further simplification of CalcCircuitMatrix and CalcPauliTransferMatrix outputs

Open TysonRayJones opened this issue 1 year ago • 2 comments

The superoperators and PTMs returned by these two functions can often be simplified by forcing separation of the real and imaginary components of their parameters, especially (but not exclusively) when AssertValidChannels -> False.

For instance:

image

Thankfully, I so far haven't seen CalcPauliTransferMatrix return an unsimplified element which would otherwise simplify to 0 (which would be very important to address). But it still remains useful to simplify per gate, even if we do not attempt to simplify the matrix resulting from an entire circuit. Note when changing CalcPauliTransferMatrix, the component substitution will be performed upon a sparse array.

Note that the Ph gate needs specific attention; the posteriori FullSimplify[] traps it into a bad simplification, re-combining the components for some elements. Grr!

The affected functions would be:

  • CalcCircuitMatrix[] (only when AsSuperoperator->True)
  • CalcPauliTransferMatrix[] etc

TysonRayJones avatar Apr 07 '24 11:04 TysonRayJones

During that change, perform checks that assumption enforcement is compatible with gate args, the way that channels like Damp currently do.

So that a user doing...

CalcCircuitMatrix[ Rx[ 1 + I ], AssertValidChannels->True]

would encounter an error. Otherwise, they will get a result which is silently, mathematically wrong; complex substitution into an expression obtained through a simplification under the assumption the variable was real.

Of course this doesn't prevent the user error of

CalcCircuitMatrix[ Rx[x] , AssertValidChannels->True ]
% /. x -> 1 + I

but that's uncatchable ¯\_(ツ)_/¯

TysonRayJones avatar Apr 07 '24 12:04 TysonRayJones

Note it will affect downstream functions like ApplyPauliTransferMap, which will need extended validation testing

TysonRayJones avatar Apr 07 '24 13:04 TysonRayJones