PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
When calling qml.matrix on a qutrit qnode the resulting matrix should be (3^n x 3^n) (n is the number of wires).
For example when there are two wires the resulting matrix should be 9x9.
Actual behavior
When calling qml.matrix on a qutrit qnode with only single-qubit gates gives a matrix with shape (3(2^(n-1)) x 3(2^(n-1))) (n is the number of wires). It doesn't matter if there are gates on one or more wires.
When calling qml.matrix on a qutrit qnode with only two-qubit gates gives a matrix with shape (9(2^(n-2)) x 9(2^(n-2))) (n is the number of wires).
Calling qml.matrix on a qnode with a two-qutrit and one-qutrit gate is causing an error due to the different sized matrices that are produced.
Expected behavior
When calling qml.matrix on a qutrit qnode the resulting matrix should be (3^n x 3^n) (n is the number of wires).
For example when there are two wires the resulting matrix should be 9x9.
Actual behavior
When calling qml.matrix on a qutrit qnode with only single-qubit gates gives a matrix with shape (3(2^(n-1)) x 3(2^(n-1))) (n is the number of wires). It doesn't matter if there are gates on one or more wires.
When calling qml.matrix on a qutrit qnode with only two-qubit gates gives a matrix with shape (9(2^(n-2)) x 9(2^(n-2))) (n is the number of wires).
Calling qml.matrix on a qnode with a two-qutrit and one-qutrit gate is causing an error due to the different sized matrices that are produced.
Additional information
Circuits run correctly.
Source code
Tracebacks
No response
System information
Existing GitHub issues