Timeline for Compile with function definition inside
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:55 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Jun 22, 2016 at 3:37 | vote | accept | Al Guy | ||
Jun 19, 2016 at 19:00 | history | tweeted | twitter.com/StackMma/status/744605797489979392 | ||
Jun 19, 2016 at 16:17 | comment | added | Daniel Lichtblau |
Other tricks/tactics include injecting the definition and evaluating it inside; cfunc = With[{gg = g}, Compile[{{x, _Real}}, Evaluate[gg[x]]]]; .This falls into the macro category as noted above. I think it was the main way to do this sort of thing prior to the introduction of InlineExternalDefinitions .
|
|
Jun 19, 2016 at 3:25 | comment | added | Oleksandr R. | If the function can be inlined, it will be compiled as fully as it would be if it were specified directly as part of the outer function body. | |
Jun 19, 2016 at 3:23 | answer | added | Oleksandr R. | timeline score: 8 | |
Jun 19, 2016 at 3:22 | answer | added | vapor | timeline score: 10 | |
Jun 19, 2016 at 3:21 | comment | added | Al Guy |
@OleksandrR. will the inlining mean the the body of the compiled function will call MainEvaluate ?
|
|
Jun 19, 2016 at 3:10 | comment | added | Oleksandr R. | Can't do it without using tricks to preprocess (rewrite) the input. Just define it externally, either as a compiled definition or otherwise, and set appropriate options to inline it into the parent function. | |
Jun 18, 2016 at 23:46 | comment | added | Al Guy | @J.M. I trying to minimize all overheads of calling various pieces, by putting everything in a big compiled function. | |
Jun 18, 2016 at 23:44 | comment | added | J. M.'s missing motivation♦ |
Why can't you just define g as a separate function instead of making the definition within Compile[] ?
|
|
Jun 18, 2016 at 23:38 | history | asked | Al Guy | CC BY-SA 3.0 |