Skip to content

Commit

Permalink
Neaten up construction of block_rows, block_cols and block_ops arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed Mar 21, 2023
1 parent 0a41dab commit c815c52
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions qutip/solver/heom/bofin_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,19 +1299,12 @@ def gather(self):
A combined matrix of shape ``(block * nhe, block * ne)``.
"""
self._ops.sort()
block_rows = np.array(
[op[0] for op in self._ops],
dtype=_data.base.idxint_dtype,
)
block_cols = np.array(
[op[1] for op in self._ops],
dtype=_data.base.idxint_dtype,
)
block_ops = np.array(
[op[2] for op in self._ops],
dtype=object,
)
ops = np.array(self._ops, dtype=[
("row", _data.base.idxint_dtype),
("col", _data.base.idxint_dtype),
("op", object),
])
return _csr._from_csr_blocks(
block_rows, block_cols, block_ops,
ops["row"], ops["col"], ops["op"],
self._n_blocks, self._block_size,
)

0 comments on commit c815c52

Please sign in to comment.