Conversation
…t for scipy methods
rocky
left a comment
There was a problem hiding this comment.
Overall I like this! Thanks!
On additional suggestion is to change CompiledCode#str to report which variation of compilation was used now that several methods are tried.
| >> Compile[{{a, _Integer}, {b, _Integer}}, While[b != 0, {a, b} = {b, Mod[a, b]}]; a] (* GCD of a, b *) | ||
| : Expression While[b != 0, {a, b} = {b, Mod[a, b]}] ; a could not be compiled. | ||
| = Function[{Global`a, Global`b}, While[b != 0, {a, b} = {b, Mod[a, b]}] ; a] | ||
| = CompiledFunction[{a, b}, a, -CompiledCode-] |
There was a problem hiding this comment.
When I assign this to a variable and run that on anythng anything other than 0 as the b argument this hangs. I am guessing this definition isn't quite right?
There was a problem hiding this comment.
One other thing I note is that when I look compilation.py pyflakes is reporting a number of small lint notes involving unused variables and imports.
There was a problem hiding this comment.
Yes to both things: we need at some point to review the implementation of Compile in a closer way. However, this is a task for a couple of weekends. What motivated me to dig into this right now is that I needed this work for the NIntegrate implementation.
Thanks! This last commit should attend to your suggestion. |
96ec58b to
e8a5440
Compare
Here it is a basic implementation of NIntegrate, working both on intervals and d-dimensional regions.
If scipy.integrate is available, uses quad as a default integrator, and allows to call other routines (romberg, and nquad, but others can be included later). Otherwise, or if these routines fails, a native Simpson's rule adaptative routine is included, and set as default if scipy is not available.
With #1161, I expect that this also works for complex valued functions.