Skip to content

Commit fb8f418

Browse files
committed
Make SystemY return sparse array directly; make some other scripts actual "tests"
1 parent 5f95b76 commit fb8f418

File tree

4 files changed

+305
-279
lines changed

4 files changed

+305
-279
lines changed

altdss/AltDSS.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,12 @@ def SystemY(self, dense=False) -> ComplexArray:
273273
res = None
274274
else:
275275
# return as (data, indices, indptr) that can fed into scipy.sparse.csc_matrix
276-
res = (
276+
from scipy.sparse import csc_matrix
277+
return csc_matrix((
277278
np.frombuffer(ffi.buffer(cValsPtr[0], nNz[0] * 16), dtype=complex).copy(),
278279
np.frombuffer(ffi.buffer(RowIdxPtr[0], nNz[0] * 4), dtype=np.int32).copy(),
279280
np.frombuffer(ffi.buffer(ColPtr[0], (nBus[0] + 1) * 4), dtype=np.int32).copy()
280-
)
281+
))
281282

282283
self._lib.DSS_Dispose_PInteger(ColPtr)
283284
self._lib.DSS_Dispose_PInteger(RowIdxPtr)

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ relevant. See [DSS C-API's repository](https://github.com/dss-extensions/dss_cap
55

66
## 0.2.2
77

8+
- SystemY: in `AltDSS.SystemY`, return the matrix as a SciPy sparse matrix directly.
89
- CircuitElement/CircuitElementBatch: Complement doc strings; fix some type hints.
910
- CircuitElementBatch:
1011
- Fix `MaxCurrent`. This will require the backend to be updated to v0.14.3.

0 commit comments

Comments
 (0)