Skip to content

Commit f9b6701

Browse files
committed
Safe conversion for 4.7
1 parent 23eacac commit f9b6701

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/qutip_qip/operations/gates.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,10 @@ def expand_operator(
13261326
for i, ind in enumerate(rest_pos):
13271327
new_order[ind] = rest_qubits[i]
13281328
id_list = [identity(dims[i]) for i in rest_pos]
1329-
return tensor([oper] + id_list).permute(new_order).to(dtype)
1329+
out = tensor([oper] + id_list).permute(new_order)
1330+
if parse_version(qutip.__version__) >= parse_version("5.dev"):
1331+
out = out.to(dtype)
1332+
return out
13301333

13311334

13321335
def gate_sequence_product(

0 commit comments

Comments
 (0)