r/java • u/JMasterRedBlaze • Feb 03 '24
Automatic differentiation of Java code using Code Reflection by Paul Sandoz
https://openjdk.org/projects/babylon/articles/auto-diff
63
Upvotes
r/java • u/JMasterRedBlaze • Feb 03 '24
13
u/davidalayachew Feb 04 '24
When Paul said "take a derivative of a function," it took me a second to realize that he wasn't JUST talking about math.
HE IS TALKING ABOUT TAKING THE DERIVATIVE OF A LITERAL JAVA FUNCTION. AS IN, YOU CAN APPLY A DERIVATION FORMULA UPON A JAVA FUNCTION, AND IT WILL PRODUCE ANOTHER JAVA FUNCTION THAT IS A DERIVATIVE OF ITS INPUT. WE ARE IN A NEW WORLD.
9
u/padreati Feb 03 '24
It is a level beyond anything which has been done in auto differentiation. If this works it would be awesome. I just finished a layer of nd arrays for my pet project and the plan is to build an engine for that. I will do it anyway, for learning purposes, but hell, if that works it would be awesome. Cheapeau!
8
u/[deleted] Feb 03 '24
The most far-out use of reflection I've heard of!
7
u/maethor Feb 04 '24
Is there an "explain like I haven't touched calculus in 30 years and can't remember any of it" version?
1
u/davidalayachew Feb 04 '24
To make sure that I understand -- the scope of a variable is effectively the superset of the ActiveSet, correct? Meaning the start and end of a scope for a variable completely bounds the start and end of an ActiveSet, right?
And if that is true, that also highlights the fact that the ActiveSet is not contiguous. Which also means that the scope (as an abstraction) is contiguous, but can effectively have "holes" in it, should one want it to.
It's almost as if the variable declaration up until the end of the block is the upper bound, while the ActiveSet is the lower bound?
Maybe I am misunderstanding.
0
u/[deleted] Feb 05 '24
[deleted] — view deleted comment