Skip to content

Commit cdb65fc

Browse files
Merge pull request #518 from PowerGridModel/fix/numpy-array-indptr-datatype
Specified the datatype of `indptr` in all mentioned places to be `int64`
2 parents 6ed3abe + 2547c91 commit cdb65fc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/power_grid_model/core/power_grid_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def calculate_power_flow(
399399
- Dimension 1: Each updated element per batch for this component type.
400400
- For inhomogeneous update batch (a dictionary containing two keys):
401401
402-
- indptr: A 1D integer numpy array with length n_batch + 1. Given batch number k, the
402+
- indptr: A 1D numpy int64 array with length n_batch + 1. Given batch number k, the
403403
update array for this batch is data[indptr[k]:indptr[k + 1]]. This is the concept of
404404
compressed sparse structure.
405405
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html
@@ -479,7 +479,7 @@ def calculate_state_estimation(
479479
- Dimension 1: Each updated element per batch for this component type.
480480
- For inhomogeneous update batch (a dictionary containing two keys):
481481
482-
- indptr: A 1D integer numpy array with length n_batch + 1. Given batch number k, the
482+
- indptr: A 1D numpy int64 array with length n_batch + 1. Given batch number k, the
483483
update array for this batch is data[indptr[k]:indptr[k + 1]]. This is the concept of
484484
compressed sparse structure.
485485
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html
@@ -549,7 +549,7 @@ def calculate_short_circuit(
549549
- Dimension 1: each updated element per batch for this component type
550550
- For inhomogeneous update batch (a dictionary containing two keys):
551551
552-
- indptr: A 1D integer numpy array with length n_batch + 1. Given batch number k, the
552+
- indptr: A 1D numpy int64 array with length n_batch + 1. Given batch number k, the
553553
update array for this batch is data[indptr[k]:indptr[k + 1]]. This is the concept of
554554
compressed sparse structure.
555555
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html

src/power_grid_model/data_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"""
1818
A sparse batch array is a dictionary containing the keys `indptr` and `data`.
1919
20-
- indptr: a one-dimensional numpy int32 array
20+
- indptr: a one-dimensional numpy int64 array
2121
- data: a one-dimensional structured numpy array. The exact dtype depends on the type of component.
2222
- Example: {"indptr": <1d-array>, "data": <1d-array>}
2323
"""

0 commit comments

Comments
 (0)