Skip to content

Commit d58a82d

Browse files
authored
Merge pull request #273 from Ericgig/bug.expand_dtype
Ensure `expand_operator` output dtype
2 parents 68789f4 + f9b6701 commit d58a82d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/qutip_qip/operations/gates.py

Lines changed: 4 additions & 1 deletion
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)
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)