Clone this wiki locally
SWIG, Matlab, and modular interfaces
Shogun's maybe biggest strength is that it supports a wide range of interfacing languages. This project is about polishing the interfaces, and extending them. In addition, we will clean up the testing framework.
- Viktor Gal (github: vigsterkr, IRC: wiking)
- Heiko (github: karlnapf, IRC: HeikoS)
- Sergey (github: lisitsyn, IRC: lisitsyn)
Difficulty & Requirements
You need to know about
- Shogun's modular interface framework
- Shogun's testing framework
This project is about adding Matlab to Shogun's modular interfaces. Since Matlab is the last language that we do not support via SWIG, we can then get ride of the static interfaces and migrate all code examples and tests. This leads to a huge reduction in Shogun's code base and therefore perfectly fits out this year's GSoC focus.
Shogun over the years changed its face: we first only had static interfaces. Those are hand-crafted and every new algorithm needs to be added by hand. This is cumbersome and leads to many parts not being visible from outside C++. Then the world became a better place and we started using SWIG. SWIG allows to automatically generate interfaces to a large range of target languages automatically. Every class added to Shogun is exposed to all languages with adding one line to the interface file. Magic.
R was made working recently, Matlab is next. There is evidence that SWIG and Matlab now work together, we exchanged some emails with the SWIG developers to verify. See below. Adding Matlab means writing typemaps for Matlab. Those are C code that maps memory representations of Matlab to those of Shogun. Since there are many existing typemaps, this should not be too hard. All typemaps should be unit tested. This includes existing ones.
Once Matlab bindings do work, we want to get rid of the static interfaces. This involves identifying examples and tests (which is nontrivial as they are all over the place) and migrating them first. Then, we need to clean up the (cmake) build.
Finally, we want to drop integration tests. This means we would like to migrate all static tests into c++ unit tests. Since we now have unit tests for the typemaps, we make sure that code run from say Python returns the same result as code run in C++. No need to test the results of the modular interfaces. We need only run them in order to check whether they work.
Waypoints and initial work
- Add Matlab to SWIG
- Migrate static examples and tests
- Unit test typemaps
- Remove testing of results of modular examples
Why this is cool
Everyone wants Matlab, you will be a star! Cleaning up Shogun's build is essential for its future maintainability. De-convolving our internals is essential for people to get an easier start into Shogun. For you, this project is cool as you will learn a lot about SWIG (which is amazing), software testing, and internals of Shogun's biggest strength of automagic interfacing to all languages.
- SWIG and Matlab example https://github.com/CoolProp/CoolProp/blob/master/CMakeLists.txt and http://coolprop.sourceforge.net/coolprop/wrappers/MATLAB/index.html#matlab
- Project that uses SWIG and Matlab http://stir.sourceforge.net/
github issues (partly outdated)