mattja / sdeint

Numerical integration of Ito or Stratonovich SDEs
GNU General Public License v3.0
154 stars 25 forks source link

automatically check the function input #12

Closed gxli closed 6 years ago

gxli commented 6 years ago

Hi,

thanks for the cool package. However, there seems to be a small issue with the return value of the input function

if I return lists in function f and function G, the integrator seems to be confused and then allocate a huge amount of memory. After manually converting my return values into numpy.array, the problem is solved. It took me an hour to figure this out.

Therefore, it would be easier if the integrator automatically checks the return values of the input function, to avoid confusing the reader.

Thanks!

mattja commented 6 years ago

Thanks for raising this. At the very least itoint() and stratint() should have proper docstrings that explain the requirements for f and G. I'll fix them.

I can't quite replicate the behavior you describe though. If I return lists in function f and G, it fails cleanly throwing AttributeError: 'list' object has no attribute 'ndim' Could you please show me the input you used to make it fail badly?

gxli commented 6 years ago

Hi Mattew,

many thanks for the reply. Unfortunately I could not find the old version of the code, and indeed now it throws "AttributeError: 'list' object has no attribute ‘ndim’”.

thanks for the nice work and please remove the issue since I can not reproduce it.

Cheers, G

many On 18. Oct 2017, at 09:27, Matthew Aburn notifications@github.com wrote:

Thanks for raising this. At the very least itoint() and stratint() should have proper docstrings that explain the requirements for f and G. I'll fix them.

I can't quite replicate the behavior you describe though. If I return lists in function f and G, it fails cleanly throwing AttributeError: 'list' object has no attribute 'ndim' Could you please show me the input you used to make it fail badly?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattja/sdeint/issues/12#issuecomment-337484431, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqTrfuVj-1t9pReSW9JkC_tXb5HFnkFks5stahwgaJpZM4P8PTL.