mathnet / mathnet-symbolics

Math.NET Symbolics
http://symbolics.mathdotnet.com
MIT License
341 stars 66 forks source link

Compile module #37

Closed frabert closed 6 years ago

frabert commented 6 years ago

This PR adds a Compile module which allows Symbolics expressions to be compiled into delegates using Linq expressions. This is can be used when repeated evaluation of an expression is needed, in which case the existing solution is too slow.

NOTE: Still a WIP

cdrnet commented 6 years ago

Great, this has been on my wish list for a while!

Could you rebase on current master? Repeated back-merges like this lead to a history that is hard to follow. (Or I can rebase later when accepting the PR.)

cdrnet commented 6 years ago

I wonder whether it would be feasible to isolate a Linq.format dual to the existing (incomplete) Linq.parse, similar to those for Infix and MathML (and F# quotations). Compiling the LINQ expression to a delegate would then be a separate step. Convenience functions could then combine both to go from expression to delegate in one call.

frabert commented 6 years ago

I think that could be done! The only thing is that its interface would be quite different from the other "format" modules, in that it can fail and it requires a list of symbols to act as parameters, and is the original reason I decided to go the separate module route.

Regarding the rebase, I am not very confident with such Git mechanisms but I will look into it and see if I can do it without wrecking too much havoc :)

cdrnet commented 6 years ago

No worries about the rebase, I can do it when accepting the PR.

frabert commented 6 years ago

I'm closing this, I'm starting the PR over due to moved files and general cleanup