bmcage / odes

The ODES scikit for ordinary differential and algebraic equations, an extension to scipy
https://scikits-odes.readthedocs.io/
Other
124 stars 44 forks source link

Issue with assigning constraints to IDA solver #159

Open n-rasmussen opened 1 year ago

n-rasmussen commented 1 year ago

In the ida.pyx file constraints_idx is to be specified as an array

https://github.com/bmcage/odes/blob/57466a97a278f687a6b0a92343b767c495834b31/scikits/odes/sundials/ida.pyx#L1025-L1031

However, range cannot be taken of a array.

https://github.com/bmcage/odes/blob/57466a97a278f687a6b0a92343b767c495834b31/scikits/odes/sundials/ida.pyx#L1747-L1752

This line can be changed to this to get the indexes of the constraints

for i, idx in enumerate(constraints_idx):
    constraints_vars[idx] = constraints_type[i]