vnegnev / marcos_client

Client (GUI and command-line interfaces) for MaRCoS
GNU General Public License v3.0
11 stars 15 forks source link

Add explicit type conversions for numpy2 compatibility #18

Closed vnegnev closed 3 months ago

vnegnev commented 3 months ago

Numpy 2 changes the way certain type conversions are implicitly handled, and is stricter about overflows - see https://numpy.org/doc/stable/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion and https://numpy.org/neps/nep-0050-scalar-promotion.html#nep50 for detailed info.

As far as MaRCoS is affected, the compiler uses a lot of fixed-width signed and unsigned integers implicitly in some fairly involved logic operations. I've added various casts and conversions to fix the bugs that arose with Numpy 2, however others may remain undetected until specific value ranges are hit in the input data.

@josalggui, @catkira please let me know if these changes cause you any issues/problems in your workflows.

vnegnev commented 3 months ago

No one has reported any issues, so I'm merging the PR.