Hello,

Happy New Year 2023!

I was trying to use qml.matrix() and found that there seems to be a bug! See the two screen captures below.

The two CNOT should have different matrix outputs but it was not the case as shown in the first figure.

Then, test0_mat() and test1_mat() should have the same output but it was not the case as shown in the first figure.

Then, test2_mat() and test3_mat() should have the same output but it was not the case as shown in the 2nd figure.

Not sure whether I use it in the wrong way. Version information is given below. Thanks!

import numpy as np

from pennylane.optimize import AdamOptimizer

from pennylane import numpy as qml_np

import pennylane as qml

qml.about()

Name: PennyLane

Version: 0.28.0

Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.

Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.

Author:

Author-email:

License: Apache License 2.0

Location: c:\users\user\anaconda3\envs\py310penl028\lib\site-packages

Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, retworkx, scipy, semantic-version, toml

Required-by: PennyLane-Lightning

Platform info: Windows-10-10.0.19045-SP0

Python version: 3.10.8

Numpy version: 1.23.5

Scipy version: 1.9.3

Installed devices:

- default.gaussian (PennyLane-0.28.0)
- default.mixed (PennyLane-0.28.0)
- default.qubit (PennyLane-0.28.0)
- default.qubit.autograd (PennyLane-0.28.0)
- default.qubit.jax (PennyLane-0.28.0)
- default.qubit.tf (PennyLane-0.28.0)
- default.qubit.torch (PennyLane-0.28.0)
- default.qutrit (PennyLane-0.28.0)
- null.qubit (PennyLane-0.28.0)
- lightning.qubit (PennyLane-Lightning-0.28.0)