Comments (6)
Hey @breandan , I am new to Kotlin and would like to learn more of it. Can i try on this one? Do this project have any slack or discord?
from kotlingrad.
Hi @therealansh, welcome to the Kotlin community! PRs are certainly welcome. You might have a look at the Rewriter.kt
or PrefAttach.kt
demos in Kaliningraph and try to reproduce it using the Kotlin∇ computation graph. We don't have a dedicated Slack or Discord, but I try to be responsive on GitHub and often hang out on the #mathematics
channel of the Kotlin Slack. Feel free to ping me wherever if you have any questions.
from kotlingrad.
Hey @breandan where should I implement these files? Any specific directory?
from kotlingrad.
You will need to make changes to the core
API. In particular, when DEBUG
mode (cf. EAGER
mode) is enabled, each recursive call to df()
and apply(vararg xs: Fun<X>)
could pause execution, append toGraph()
to the debugger stack and await the → key to be pressed. If pausing execution is too complicated, I would just write the intermediate graphs to a stack and return immediately.
You could add a demo for the debugger to samples
, e.g. something like this:
fun main() {
DEBUG = true
val x by DReal.Var()
val y by DReal.Var()
val f = x * (-sin(x * y) + y) * 4
f(x to 0, y to 1) // This should open a browser window with the debugger stack navigable using ←/→ keys
}
If you're feeling ambitious, it would be nice to improve the graph visualization algorithm somehow, instead of just displaying the static graph, it would be nice to see edges labeled with values flowing across them (e.g. see the reduction semantics). For that, you may need to modify Kaliningraph's implementation to make UnlabeledEdge
a LabeledEdge
and update render()
.
Again, feel free to ping me if you have questions about any of this. Thanks!
from kotlingrad.
Hey @breandan So i have a couple of questions. So as i can see in the PrefAttach
and Rewrite
there is a animate
function which seems to be missing in main but present in test which actually opens the web using KWeb. Do we have to re-implement this function in KotlinGrad api or should we also implement this in Kaliningraph main src.
Also what i have understood is that we have to call toGraph() in the function as
fun apply(vararg xs: Fun<X>): SFun<X>{
if(EAGER){stack??.push(toGraph()}
when (op) {
Monad.id -> this
Monad.sin -> (xs[0] as SFun<X>).sin()
Monad.cos -> (xs[0] as SFun<X>).cos()
Monad.tan -> (xs[0] as SFun<X>).tan()
Monad.`-` -> -(xs[0] as SFun<X>)
}
}
Similar with the df() recursive call. Here how can we access the debugger stack by getStackTrace() ? or it will be just an empty stack when we initialise the function. Thanks for helping in advance i am new to this big codebase so might take a few days to get along.
from kotlingrad.
Yep, that’s a good point. We separated the Kweb dependency from the main library to avoid dependency bloat. If you want to use Kweb for your debugger implementation, you can just add a testImplementation
instance to the dependencies section of core/build.gradle.kts
and implement your animate functionality in the test
directory.
I guess the simplest debugger implementation would just accumulate intermediate graphs in a mutable variable, which could be read asynchronously. If you want to define a custom function debugApply
which is called when the DEBUG
flag is set, that would also probably work. A better solution would be to make it functional, i.e. your solution would need to return a Pair<SFun<X>, List<SFun<X>>>
instead of writing to some separate data structure.
from kotlingrad.
Related Issues (20)
- Typo in installation guide HOT 1
- Scala DSL HOT 23
- Establish the connection with GF(2) HOT 1
- Compile to Kaliningraph IR
- Migrate to context-free grammar HOT 1
- unaryPlus overload for group elements HOT 1
- Jar file of 0.3.5 not published on jitpack HOT 1
- Gradual typing
- Publish Dokka generated API documentation
- Update Viktor to 1.1.0
- Port the library to Kotlin/Multiplatform HOT 3
- Add `.idea/codeStyles` to the repository HOT 1
- The deployed Dokka HTML is empty HOT 4
- Possible collaboration with Facebook? HOT 1
- Unable to resolve dependencies HOT 8
- java.lang.module.ResolutionException in dependencies HOT 2
- Formulas and diagrams in README not visible in dark mode
- Cross-compilation support for Java & OpenJDK 8 HOT 3
- Publish roadmap and contributing doc? HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlingrad.