Albert Mitjans
Albert Mitjans
@simonpercivall is this issue being worked on?
I believe this will be fixed with the new operator arithmetic: ```python >>> s_prod = qml.s_prod(tf.Variable(0.3), qml.PauliX(0)) >>> qml.matrix(s_prod) ``` However I just realised that we still need to support...
> That's great! Is the above code also differentiable in the expected way? If so, then it's definitely something I can replace in my code to get the behaviour I...
[sc-25912]
> Hi @AlbertMitjans, a fly-by comment: we used to allow this but for certain reasons IIRC including the CV cases we've disallowed it. > > Have we converged to a...
> If a device or a compilation step sees an Identity, it knows that it can just skip over the operation and neglect it. See [`default_qubit.py` line 276](https://github.com/PennyLaneAI/pennylane/blob/0cb8197e64295b967ed0b8e9f04983b231f6c549/pennylane/devices/default_qubit.py#L276) as an...
> Could it be an option to make qml.Identity([0, 1, 2]) resolve to qml.prod(qml.Identity(0), qml.Identity(1), qml.Identity(2)) (or the other way round)`? One thing I was planning to do was resolving...
> We can always make this change and then revert it later if it ends up being problematic and buggy. > > We can add a `decomposition`, so that: >...
> > Duplicated behaviour is very common in operator arithmetic (e.g. qml.sum(qml.PauliX(0), qml.PauliX(0)) is the same as qml.s_prod(2, qml.PauliX(0))...) . I think it's fine as long as after simplification we...
I just realised that the identity simplification already works! I love when this happens hahaha: ```pycon >>> id_op = qml.prod(qml.Identity(0), qml.Identity(1), qml.Identity(2)) >>> qml.simplify(id_op) Identity(wires=[0, 1, 2]) ```