[IPOL discuss] matlab to C/C++ translation tools

Nicolas Limare nicolas.limare at cmla.ens-cachan.fr
Sat Mar 23 18:55:14 CET 2013


Hi, (one message for two answers)

Jean-Michel Morel wrote:
> -will such a C++ code be readable? I gather that still it will be
> better to review the original Matlab code

I do not know if it will be readable, but it is not excluded. Code
generation tools are improving, and if the C++ code uses the same
variable names, comments and code structure as the MATLAB version, it
could be as readable. Be we can can only know more if we try it.

> -what about the functions in Matlab whose code is not public? How
> could they possibly be translated?

Here again, I do not know. I see a few possibilities. They could use
the functions from MATLAB binary libraries, without disclosing the
implementation. They couls call functions in other binary libraries
designed by the translation tool vendor to reproduce MATLAB
results. Or they could use functions available in source code, either
from the translation tool vendor or using existing open-source
libraries.

Miguel Colom wrote:
> Mathworks (the Matlab company) sells also a product called "Matlab
> coder" that creates ANSI C/C++ code [1].
> 
> If we had to chose one, using the product from the company that
> sells Matlab is the clearly the best option over third-party
> solutions, for long-term maintenance reasons.

It depends on how it works. If these translators produce 100% source
code versions, there is no maintenance problem since after the
translation we only need to manipulate C++ code. If the translated
code uses MATLAB libraries, then yes the MATLAB product looks more
safe.

But I read that in "some cases", the MATLAB products fails to
translate while the other products can succeed. And the two other
companies are interested in academic collaborations, so it could be
more flexible than just buying a Mathworks product.

> As Jean-Michel pointed out, there's some problems with these kind of
> tools. Users prefer Matlab because they can use black-boxed
> libraries and Matlab build-in types. The black-boxes will simply be
> called from the C/C++ code and therefore the requirement of knowing
> exactly what the code can't be accomplished. And for the build-in
> types, it's the same problem.

Yes, the MATLAB Coder page[1] states that it produces MEX functions,
so yes, clearly, they still need to be used with MATLAB and call the
same black box internal libraries. The only benefit is better speed
performance.

[1] http://www.mathworks.fr/products/matlab-coder/

But if I understood correctly, the two other tools may produce real
C++ programs, at least usable without the MATLAB run-time interface
(and maybe without MATLAB libraries).

If you are interested (or anyone else using MATLAB here), I can give
you contacts of people at Silkan and Metascale to evaluate their tool
and compare with MATLAB Coder.

Best,

-- 
Nicolas LIMARE - CMLA - ENS Cachan         http://limare.perso.math.cnrs.fr/
IPOL - image processing on line                          http://www.ipol.im/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://tools.ipol.im/mailman/archive/discuss/attachments/20130323/d707d309/attachment.pgp>


More information about the discuss mailing list