ghorn / dvda Goto Github PK
View Code? Open in Web Editor NEW(deprecated) Symbolic expressions and algorithmic differentiation in Haskell.
(deprecated) Symbolic expressions and algorithmic differentiation in Haskell.
cabal test gives:
Preprocessing test suite 'test' for dvda-0.4...
TestMain.hs:9:8:
Could not find module ‘Dvda.Tests.Unary’
Use -v to see a list of the files searched for.
There are some O[n^2] operations which could be O[log(n)] if Data.Map or Data.IntMap was used, like the use of elem
to see if an expression is repeated.
GNode may use Ord for topsort already, so change to sortBy
there's a runtime exception hiding in there right now
Complicated because it's easy to get NaN or Infinity, or errors related to TInt overflows.
Current tests are on a restricted subset that will hopefully show some errors. That subset should be grown.
Current tests are on scalars only, need to implement tensors.
Need to implement symbolic variables/substitution tests.
This can all be done automatically with the type system
Capability to specify expressions as "atomic" and generate code once, treat as atomic function like Sin or Multiply. For stuff like rk4 - would generate function that takes in primal and perturbations, outputs primal and perturbations - possible to do this with reverse sensitivities?
Is it possible to implement l'hopital's rule and a limit function, and then derive formulas for differentiation - perhaps may be easier with complex step?
The simplification pruneZeros can work on integer 0 just as well as Zero. This will make other simplifications easier as well.
Instead of maintaining numeric values with lists use some sort of unboxed array.
It would also be nice to use Repa to apply functions natively, instead of zipWith/map.
It'll be interesting to see if this can be made faster than the c backend
replace "error" with Dvda.Errror (error) which prints some standard exception with maybe some fun ascii text
this isn't hard, just low priority
Now that callNative is implemented, it would be great to have simple operators like diff and grad and so on that can be used on your own pure functions to get a derivative. (This will be handy for testing, hint hint :)
If I do CSE right now, I think some nodes are hashed (many) more times than one. If I want hashing, I should probably use something like data HashedExpr a = HashedExpr (Expr a) Int
and hash greedily
Can this be done in a lightweight manner? Must it be integrated into SourceType?
Give symbolic variables their own data type so that functions with symbolic inputs or outputs don't have to pass (Expr a) with runtime error checking.
It's necessary for the ease of use of DVDA to allow expressions to be created from operations on Symbolic types through functional dependencies.
Right now it's just for loops
commutative is already in there
the hash of EBinary Mul x y may be different than the hash of of EBinary Mul x ERef even if ERef is a reference to y
RankNTypes were used to generalize safeBinaryConstruct/safeUnaryConstruct, but I duplicated these functions for Num/Fractional/Floating.
Would this exploit laziness and safe a lot of duplicated and/or unneeded evaluation?
They would be equivalent already except for Add/Sub.
Fix this after (Sub a b) is replaced with (Add a (Neg b))
here's how to reproduce.....
Perform runtime check when toFunction is called asserting that all inputs are present. Warn if too many inputs are present?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.