Integrate Octave Code To A Mean-stack Website
Solution 1:
You have several options. From a backend point of view:
- use standard cgi solutions. Octave has a cgi package you can use. This would be my best bet.
- more generally, use server-side 'system' calls to run particular scripts on your server, capture the output in files etc, and read those files back in your web-session
- try to communicate with an open octave session and execute commands via sockets (would require more substantial programming)
- try to find a third-party javascript-octave bridge / interface (not sure one exists - this appears on github but no idea if it works)
From a front-end point of view, you may have some luck finding online code execution services, I can't remember nor recommend actual names at the moment, but I've definitely seen such services advertised in the past.
Solution 2:
Given the lack of direct JS-Octave bridges on npm, and that you probably mainly use octave to do linear algebra operations (matrix operations, etc.) one option is to use the math.js library, which has all of those operations.
Yes, it'd mean you'd have to convert your Octave scripts to JavaScript, but if you understand what they're doing that won't be too hard. There's a great blog post by Robin Wieruch called Linear Algebra in JavaScript with Matrix Operations showing how to do just this.
Or else just go straight to Tensorflow, which has Octave-like matrix (tensors) operations built-in as well.
If you're in the MEAN stack it seems to me it's more important to use a JS library, and not try to integrate external Octave files. Tensorflow works in Node and in the browser, so you have everything you need there.
Solution 3:
For those of you that may eventually find this question, now we have TensorFlow.js, that can be used alongside MEAN stack. I am still looking for Octave based solution for JavaScript, no luck so far, decided to implement my own. Thus, for machine learning, we have TensorFlow.js, for numerical simulations, you need to implement. The solution given is not straighforward, I want something ready to use!
Post a Comment for "Integrate Octave Code To A Mean-stack Website"