Open albi3ro opened 1 week ago
I would expect to get a matrix of size (3,2,2).
(3,2,2)
traceback below
No response
op = qml.GlobalPhase((1.0, 2.0, 3.0), wires=0) op.matrix()
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[13], line 2 1 op = qml.GlobalPhase((1.0, 2.0, 3.0), wires=0) ----> 2 op.matrix() File /pennylane/pennylane/ops/identity.py:408, in GlobalPhase.matrix(self, wire_order) 406 def matrix(self, wire_order=None): 407 n_wires = len(wire_order) if wire_order else len(self.wires) --> 408 return self.compute_matrix(self.data[0], n_wires=n_wires) File /pennylane/pennylane/ops/identity.py:338, in GlobalPhase.compute_matrix(phi, n_wires) 336 if interface == "tensorflow": 337 return qml.math.exp(-1j * qml.math.cast(phi, complex)) * qml.math.eye(int(2**n_wires)) --> 338 return qml.math.exp(-1j * qml.math.cast(phi, complex)) * qml.math.eye( 339 int(2**n_wires), like=interface 340 ) ValueError: operands could not be broadcast together with shapes (3,) (2,2)
pl master
Expected behavior
I would expect to get a matrix of size
(3,2,2)
.Actual behavior
traceback below
Additional information
No response
Source code
Tracebacks
System information
Existing GitHub issues