Skip to content

Commit

Permalink
Align with the dtype setting in main qutip
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxiLi committed Apr 2, 2024
1 parent b2fbba8 commit 15c4f1d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/qutip_qip/operations/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ def expand_operator(
The indices of subspace that are acted on.
Permutation can also be realized by changing the orders of the indices.
N : int
Deprecated. Number of qubits. Please use `dims`.
Deprecated. Number of qubits. Please use `dims`.
cyclic_permutation : boolean, optional
Deprecated.
Expand for all cyclic permutation of the targets.
Expand Down Expand Up @@ -1281,11 +1281,9 @@ def expand_operator(
[0. 0. 0. 1. 0. 0. 0. 0.]]
"""
if parse_version(qutip.__version__) >= parse_version("5.dev"):
if dtype is None:
if isinstance(oper.data, qutip.data.Dense):
oper = oper.to("csr")
else:
oper = oper.to(dtype)
# If no data type specified, use CSR
dtype = dtype or qutip.settings.core["default_dtype"] or qutip.data.CSR
oper = oper.to(dtype)
if N is not None:
warnings.warn(
"The function expand_operator has been generalized to "
Expand Down

0 comments on commit 15c4f1d

Please sign in to comment.