SWIG for MATLAB: An update and call for collaboration

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

SWIG for MATLAB: An update and call for collaboration

Joel Andersson-2
Hi all!

As you may know if you've been following this mailing list, there is an ongoing effort to write a MATLAB module to SWIG. Since many of you probably are not also following the swig-devel mailing list, I thought it would make sense make a short update on this list.

After great contributions from in particular Kris Thielemans, the module has now reached a state where it is actually mature enough to be used for major projects. I've successfully used it to generate MATLAB bindings for our project CasADi (http://casadi.org) and Ian Bell reported to have used it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).

If you want to try out the module, now might be the time. Both Kris Thielemans and I have limited time for working on this, so consider contributing if you want to see the module finished soon. Otherwise it might take time before it's mature enough to be merged into the master branch of SWIG. I'm personally (don't know about Kris) also willing to work on the MATLAB module (or its usage) on a commercial basis. Feel free to contact me about that.

Here is how you can obtain the module (adapted from Ian Bell's mail):

 * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in sync, so it shouldn't matter which.
 * Clone your fork (replace "myusername"): 
  >> git clone -b matlab https://github.com/myusername/swig swig-matlab
* Add the mine and Kris' forks as remote to be able to keep up to date with development:
  >> git remote add joel https://github.com/jaeandersson/swig
  >> git remote add kris https://github.com/KrisThielemans/swig
* Compile SWIG
  >> cd swig-matlab/
  >> ./autogen.sh 
  >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab --prefix=/home/ian/swig-matlab
  >> make
  >> make install
* If you fix or improve something, commit and push to your fork and then make a pull request in Github.


Best regards,
Joel



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Ruben De Smet
On 09/02/2014 12:31 PM, Joel Andersson wrote:

> Hi all!
>
> As you may know if you've been following this mailing list, there is an
> ongoing effort to write a MATLAB module to SWIG. Since many of you probably
> are not also following the swig-devel mailing list, I thought it would make
> sense make a short update on this list.
>
> After great contributions from in particular Kris Thielemans, the module
> has now reached a state where it is actually mature enough to be used for
> major projects. I've successfully used it to generate MATLAB bindings for
> our project CasADi (http://casadi.org) and Ian Bell reported to have used
> it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).
>
> If you want to try out the module, now might be the time. Both Kris
> Thielemans and I have limited time for working on this, so consider
> contributing if you want to see the module finished soon. Otherwise it
> might take time before it's mature enough to be merged into the master
> branch of SWIG. I'm personally (don't know about Kris) also willing to work
> on the MATLAB module (or its usage) on a commercial basis. Feel free to
> contact me about that.
>
> Here is how you can obtain the module (adapted from Ian Bell's mail):
>
>  * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (
> https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in
> sync, so it shouldn't matter which.
>  * Clone your fork (replace "myusername"):
>   >> git clone -b matlab https://github.com/myusername/swig swig-matlab
> * Add the mine and Kris' forks as remote to be able to keep up to date with
> development:
>   >> git remote add joel https://github.com/jaeandersson/swig
>   >> git remote add kris https://github.com/KrisThielemans/swig
> * Compile SWIG
>   >> cd swig-matlab/
>   >> ./autogen.sh
>   >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab
> --prefix=/home/ian/swig-matlab
>   >> make
>   >> make install
> * If you fix or improve something, commit and push to your fork and then
> make a pull request in Github.
>
>
> Best regards,
> Joel
>
Quick question: what about GNU Octave? Have they some shared binary
interface?
If not, how easily would it be ported?

Thank you guys for the effort anyways!
Ruben



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Joel Andersson-2
Hi Ruben!

The MATLAB module is loosely based on the Octave module, but the way it works is very different. The Octave module uses the C++ API of Octave, and there is no correspondence to that in MATLAB. In contrast, the MATLAB module builds up a hierarchy of classes and functions as MATLAB .m files. All function calls are then directed to a MEX-file.

You have to be prepared to rewrite all custom typemaps and other Octave specific code. For all practical purposes, it's a different language. Like going from Octave to Python.

Best regards,
Joel


2014-09-02 12:45 GMT+02:00 Ruben De Smet <[hidden email]>:
On 09/02/2014 12:31 PM, Joel Andersson wrote:
> Hi all!
>
> As you may know if you've been following this mailing list, there is an
> ongoing effort to write a MATLAB module to SWIG. Since many of you probably
> are not also following the swig-devel mailing list, I thought it would make
> sense make a short update on this list.
>
> After great contributions from in particular Kris Thielemans, the module
> has now reached a state where it is actually mature enough to be used for
> major projects. I've successfully used it to generate MATLAB bindings for
> our project CasADi (http://casadi.org) and Ian Bell reported to have used
> it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).
>
> If you want to try out the module, now might be the time. Both Kris
> Thielemans and I have limited time for working on this, so consider
> contributing if you want to see the module finished soon. Otherwise it
> might take time before it's mature enough to be merged into the master
> branch of SWIG. I'm personally (don't know about Kris) also willing to work
> on the MATLAB module (or its usage) on a commercial basis. Feel free to
> contact me about that.
>
> Here is how you can obtain the module (adapted from Ian Bell's mail):
>
>  * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (
> https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in
> sync, so it shouldn't matter which.
>  * Clone your fork (replace "myusername"):
>   >> git clone -b matlab https://github.com/myusername/swig swig-matlab
> * Add the mine and Kris' forks as remote to be able to keep up to date with
> development:
>   >> git remote add joel https://github.com/jaeandersson/swig
>   >> git remote add kris https://github.com/KrisThielemans/swig
> * Compile SWIG
>   >> cd swig-matlab/
>   >> ./autogen.sh
>   >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab
> --prefix=/home/ian/swig-matlab
>   >> make
>   >> make install
> * If you fix or improve something, commit and push to your fork and then
> make a pull request in Github.
>
>
> Best regards,
> Joel
>

Quick question: what about GNU Octave? Have they some shared binary
interface?
If not, how easily would it be ported?

Thank you guys for the effort anyways!
Ruben





--
--
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat, Spain
Home: +34-93-6034011
Mobile: +32-486-672874 (Belgium) / +34-63-4408800 (Spain) / +46-707-360512
(Sweden)


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Ruben De Smet
On 09/02/2014 01:11 PM, Joel Andersson wrote:

> Hi Ruben!
>
> The MATLAB module is loosely based on the Octave module, but the way it
> works is very different. The Octave module uses the C++ API of Octave, and
> there is no correspondence to that in MATLAB. In contrast, the MATLAB
> module builds up a hierarchy of classes and functions as MATLAB .m files.
> All function calls are then directed to a MEX-file.
>
> You have to be prepared to rewrite all custom typemaps and other Octave
> specific code. For all practical purposes, it's a different language. Like
> going from Octave to Python.
>
> Best regards,
> Joel
Oh, didn't know there was an octave module. Great :) Sorry bothering you
with my uninformed behavior ;)

Ruben


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user

signature.asc (484 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Ian Bell-5
In reply to this post by Joel Andersson-2
I got everything building, and most of my code works, but for some reason, my function with a prototype like

double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);

is returning 0 always, even though I can debug internally and see that it is calculating the correct (non-zero) value.  I know you were playing with the avoiding the ans output at one point, but perhaps it was too aggressive?


On Tue, Sep 2, 2014 at 12:31 PM, Joel Andersson <[hidden email]> wrote:
Hi all!

As you may know if you've been following this mailing list, there is an ongoing effort to write a MATLAB module to SWIG. Since many of you probably are not also following the swig-devel mailing list, I thought it would make sense make a short update on this list.

After great contributions from in particular Kris Thielemans, the module has now reached a state where it is actually mature enough to be used for major projects. I've successfully used it to generate MATLAB bindings for our project CasADi (http://casadi.org) and Ian Bell reported to have used it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).

If you want to try out the module, now might be the time. Both Kris Thielemans and I have limited time for working on this, so consider contributing if you want to see the module finished soon. Otherwise it might take time before it's mature enough to be merged into the master branch of SWIG. I'm personally (don't know about Kris) also willing to work on the MATLAB module (or its usage) on a commercial basis. Feel free to contact me about that.

Here is how you can obtain the module (adapted from Ian Bell's mail):

 * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in sync, so it shouldn't matter which.
 * Clone your fork (replace "myusername"): 
  >> git clone -b matlab https://github.com/myusername/swig swig-matlab
* Add the mine and Kris' forks as remote to be able to keep up to date with development:
  >> git remote add joel https://github.com/jaeandersson/swig
  >> git remote add kris https://github.com/KrisThielemans/swig
* Compile SWIG
  >> cd swig-matlab/
  >> ./autogen.sh 
  >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab --prefix=/home/ian/swig-matlab
  >> make
  >> make install
* If you fix or improve something, commit and push to your fork and then make a pull request in Github.


Best regards,
Joel



------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user



------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Joel Andersson-2
Hmm, spontaneously I don't see how it could be related to 'ans'. Unfortunately, I can't help you to debug at the moment. Joel

2014-09-15 18:52 GMT+02:00 Ian Bell <[hidden email]>:
I got everything building, and most of my code works, but for some reason, my function with a prototype like

double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);

is returning 0 always, even though I can debug internally and see that it is calculating the correct (non-zero) value.  I know you were playing with the avoiding the ans output at one point, but perhaps it was too aggressive?


On Tue, Sep 2, 2014 at 12:31 PM, Joel Andersson <[hidden email]> wrote:
Hi all!

As you may know if you've been following this mailing list, there is an ongoing effort to write a MATLAB module to SWIG. Since many of you probably are not also following the swig-devel mailing list, I thought it would make sense make a short update on this list.

After great contributions from in particular Kris Thielemans, the module has now reached a state where it is actually mature enough to be used for major projects. I've successfully used it to generate MATLAB bindings for our project CasADi (http://casadi.org) and Ian Bell reported to have used it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).

If you want to try out the module, now might be the time. Both Kris Thielemans and I have limited time for working on this, so consider contributing if you want to see the module finished soon. Otherwise it might take time before it's mature enough to be merged into the master branch of SWIG. I'm personally (don't know about Kris) also willing to work on the MATLAB module (or its usage) on a commercial basis. Feel free to contact me about that.

Here is how you can obtain the module (adapted from Ian Bell's mail):

 * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in sync, so it shouldn't matter which.
 * Clone your fork (replace "myusername"): 
  >> git clone -b matlab https://github.com/myusername/swig swig-matlab
* Add the mine and Kris' forks as remote to be able to keep up to date with development:
  >> git remote add joel https://github.com/jaeandersson/swig
  >> git remote add kris https://github.com/KrisThielemans/swig
* Compile SWIG
  >> cd swig-matlab/
  >> ./autogen.sh 
  >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab --prefix=/home/ian/swig-matlab
  >> make
  >> make install
* If you fix or improve something, commit and push to your fork and then make a pull request in Github.


Best regards,
Joel



------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user





--
--
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat, Spain
Home: +34-93-6034011
Mobile: +32-486-672874 (Belgium) / +34-63-4408800 (Spain) / +46-707-360512
(Sweden)


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Ian Bell-5
This code did used to work fine though, so its a regression introduced in the last month or so.  I need to get my buildbot up and running so I can track regressions better.

Ian

On Mon, Sep 15, 2014 at 7:54 PM, Joel Andersson <[hidden email]> wrote:
Hmm, spontaneously I don't see how it could be related to 'ans'. Unfortunately, I can't help you to debug at the moment. Joel

2014-09-15 18:52 GMT+02:00 Ian Bell <[hidden email]>:
I got everything building, and most of my code works, but for some reason, my function with a prototype like

double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);

is returning 0 always, even though I can debug internally and see that it is calculating the correct (non-zero) value.  I know you were playing with the avoiding the ans output at one point, but perhaps it was too aggressive?


On Tue, Sep 2, 2014 at 12:31 PM, Joel Andersson <[hidden email]> wrote:
Hi all!

As you may know if you've been following this mailing list, there is an ongoing effort to write a MATLAB module to SWIG. Since many of you probably are not also following the swig-devel mailing list, I thought it would make sense make a short update on this list.

After great contributions from in particular Kris Thielemans, the module has now reached a state where it is actually mature enough to be used for major projects. I've successfully used it to generate MATLAB bindings for our project CasADi (http://casadi.org) and Ian Bell reported to have used it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).

If you want to try out the module, now might be the time. Both Kris Thielemans and I have limited time for working on this, so consider contributing if you want to see the module finished soon. Otherwise it might take time before it's mature enough to be merged into the master branch of SWIG. I'm personally (don't know about Kris) also willing to work on the MATLAB module (or its usage) on a commercial basis. Feel free to contact me about that.

Here is how you can obtain the module (adapted from Ian Bell's mail):

 * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in sync, so it shouldn't matter which.
 * Clone your fork (replace "myusername"): 
  >> git clone -b matlab https://github.com/myusername/swig swig-matlab
* Add the mine and Kris' forks as remote to be able to keep up to date with development:
  >> git remote add joel https://github.com/jaeandersson/swig
  >> git remote add kris https://github.com/KrisThielemans/swig
* Compile SWIG
  >> cd swig-matlab/
  >> ./autogen.sh 
  >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab --prefix=/home/ian/swig-matlab
  >> make
  >> make install
* If you fix or improve something, commit and push to your fork and then make a pull request in Github.


Best regards,
Joel



------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user





--
--
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat, Spain
Home: <a href="tel:%2B34-93-6034011" value="+34936034011" target="_blank">+34-93-6034011
Mobile: <a href="tel:%2B32-486-672874" value="+32486672874" target="_blank">+32-486-672874 (Belgium) / +34-63-4408800 (Spain) / +46-707-360512
(Sweden)



------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: SWIG for MATLAB: An update and call for collaboration

Ian Bell-5
Sorry - I am 99% sure that this is entirely my having done something stupid.  I can't test it for another week, but I think I made a stupid change in my function that suppressed the output (made it 0). Sorry for the noise.  I should not send bug reports late at night/early morning.

Ian



On Mon, Sep 15, 2014 at 7:57 PM, Ian Bell <[hidden email]> wrote:
This code did used to work fine though, so its a regression introduced in the last month or so.  I need to get my buildbot up and running so I can track regressions better.

Ian

On Mon, Sep 15, 2014 at 7:54 PM, Joel Andersson <[hidden email]> wrote:
Hmm, spontaneously I don't see how it could be related to 'ans'. Unfortunately, I can't help you to debug at the moment. Joel

2014-09-15 18:52 GMT+02:00 Ian Bell <[hidden email]>:
I got everything building, and most of my code works, but for some reason, my function with a prototype like

double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);

is returning 0 always, even though I can debug internally and see that it is calculating the correct (non-zero) value.  I know you were playing with the avoiding the ans output at one point, but perhaps it was too aggressive?


On Tue, Sep 2, 2014 at 12:31 PM, Joel Andersson <[hidden email]> wrote:
Hi all!

As you may know if you've been following this mailing list, there is an ongoing effort to write a MATLAB module to SWIG. Since many of you probably are not also following the swig-devel mailing list, I thought it would make sense make a short update on this list.

After great contributions from in particular Kris Thielemans, the module has now reached a state where it is actually mature enough to be used for major projects. I've successfully used it to generate MATLAB bindings for our project CasADi (http://casadi.org) and Ian Bell reported to have used it to generate MATLAB bindings to CoolProp (http://www.coolprop.org).

If you want to try out the module, now might be the time. Both Kris Thielemans and I have limited time for working on this, so consider contributing if you want to see the module finished soon. Otherwise it might take time before it's mature enough to be merged into the master branch of SWIG. I'm personally (don't know about Kris) also willing to work on the MATLAB module (or its usage) on a commercial basis. Feel free to contact me about that.

Here is how you can obtain the module (adapted from Ian Bell's mail):

 * In Github, fork mine (https://github.com/jaeandersson/swig) or Kris' (https://github.com/KrisThielemans/swig) fork of SWIG. They are currently in sync, so it shouldn't matter which.
 * Clone your fork (replace "myusername"): 
  >> git clone -b matlab https://github.com/myusername/swig swig-matlab
* Add the mine and Kris' forks as remote to be able to keep up to date with development:
  >> git remote add joel https://github.com/jaeandersson/swig
  >> git remote add kris https://github.com/KrisThielemans/swig
* Compile SWIG
  >> cd swig-matlab/
  >> ./autogen.sh 
  >> ./configure --with-matlab=/usr/local/MATLAB/R2014a/bin/matlab --prefix=/home/ian/swig-matlab
  >> make
  >> make install
* If you fix or improve something, commit and push to your fork and then make a pull request in Github.


Best regards,
Joel



------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user





--
--
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat, Spain
Home: <a href="tel:%2B34-93-6034011" value="+34936034011" target="_blank">+34-93-6034011
Mobile: <a href="tel:%2B32-486-672874" value="+32486672874" target="_blank">+32-486-672874 (Belgium) / +34-63-4408800 (Spain) / +46-707-360512
(Sweden)




------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user