Forums

prototyping and migrating code to production: MATLAB, C, C++, asm

Started by robert bristow-johnson September 26, 2013
okay guys, what do you do, if you start with an alg that works pretty 
good in MATLAB/Octave/MathCad/Mathematica/whatever, and you wanna make 
production code out of it.  let's pretend the production code will be C. 
  what do you do?

rewrite it yourself, line by line?

use http://www.mathworks.com/products/matlab-coder/ ?

something else? (i guess i would also be interested in hearing from Vlad 
about what he does instead of what the silly Matlabies do.)

thanks for opinions.

-- 

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."


On Thu, 26 Sep 2013 16:01:59 -0700, robert bristow-johnson
<rbj@audioimagination.com> wrote:

> >okay guys, what do you do, if you start with an alg that works pretty >good in MATLAB/Octave/MathCad/Mathematica/whatever, and you wanna make >production code out of it. let's pretend the production code will be C. > what do you do? > >rewrite it yourself, line by line?
Yup. And possibly use or compare test vectors from the Matlab/Octave/Mathcad development for verification.
>use http://www.mathworks.com/products/matlab-coder/ ?
No.
>something else? (i guess i would also be interested in hearing from Vlad >about what he does instead of what the silly Matlabies do.) > >thanks for opinions. > >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Thu, 26 Sep 2013 16:01:59 -0700, robert bristow-johnson wrote:

> okay guys, what do you do, if you start with an alg that works pretty > good in MATLAB/Octave/MathCad/Mathematica/whatever, and you wanna make > production code out of it. let's pretend the production code will be C. > what do you do? > > rewrite it yourself, line by line? > > use http://www.mathworks.com/products/matlab-coder/ ? > > something else? (i guess i would also be interested in hearing from Vlad > about what he does instead of what the silly Matlabies do.)
I rewrite. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
robert bristow-johnson <rbj@audioimagination.com> wrote:
 
> okay guys, what do you do, if you start with an alg that works pretty > good in MATLAB/Octave/MathCad/Mathematica/whatever, and you wanna make > production code out of it. let's pretend the production code will be C. > what do you do?
> rewrite it yourself, line by line?
Usually. There are too many things to get right otherwise. Matlab does its memory allocation automatically, and not always as efficient as you would need, for one. -- glen
robert bristow-johnson <rbj@audioimagination.com> writes:

> okay guys, what do you do, if you start with an alg that works pretty > good in MATLAB/Octave/MathCad/Mathematica/whatever, and you wanna make > production code out of it. let's pretend the production code will be > C. what do you do? > > rewrite it yourself, line by line? > > use http://www.mathworks.com/products/matlab-coder/ ? > > something else? (i guess i would also be interested in hearing from > Vlad about what he does instead of what the silly Matlabies do.) > > thanks for opinions.
Ditto Eric, Tim and Glen: rewrite. And what Eric said - use test vectors. That is, I create input test vectors, then run them through matlab to generate the result vectors, which I call the reference vectors. Then I run the same input test vectors through the C (or whatever) code and compare its result vectors to the reference vectors. Should be close to, if not, bit-exact. Pretty standard stuff. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Script. There is a "properties" object for every data "token" that is then
mapped to some variable or hardware register. All the fixed-point clutter
is generated. 
Not saying I use this all of the time, but sometimes.  	 

_____________________________		
Posted through www.DSPRelated.com
Hi r b-j,

First you need to write your C code using the Matlab code as reference. If
the C code is automatically generated then (of course) that code is not
going to be very efficient. Another reason why you probably do not want to
have your code automatically generated is that you want your code to have a
certain interface and maybe a certain structure and you want your algorithm
to make good use of the codebase you already have available. I could
mention other reasons. However, a big part of getting code production ready
is testing. And when it comes to testing Matlab can help I believe. I am
aware of two big companies that use simulink in their test and release
phase.
cheers


>r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > > >
_____________________________ Posted through www.DSPRelated.com
forgot to thank you all.  it was mostly to inform a software manager and 
you guys 100% reinforced what i was saying to him.

i would still be interested in hearing from Vlad what he does going 
sorta "MATLAB commando".  no tools other than the ones you make 
yourself, Vlad?  (i actually sorta did that previous to the mid 90's, 
but my homemade tools were crude.  i could draw graphs, load and display 
and playback simple AIFF and WAV files and write them, do basic 
elementary functions, and had a crude homemade Remez exchange alg and 
crude homemade matrix operations.)


-- 

r b-j                  rbj@audioimagination.com

"Imagination is more important than knowledge."


On Sat, 28 Sep 2013 19:49:13 -0700, robert bristow-johnson
<rbj@audioimagination.com> wrote:

> >forgot to thank you all. it was mostly to inform a software manager and >you guys 100% reinforced what i was saying to him. > >i would still be interested in hearing from Vlad what he does going >sorta "MATLAB commando". no tools other than the ones you make >yourself, Vlad? (i actually sorta did that previous to the mid 90's, >but my homemade tools were crude. i could draw graphs, load and display >and playback simple AIFF and WAV files and write them, do basic >elementary functions, and had a crude homemade Remez exchange alg and >crude homemade matrix operations.)
You could get away with that back then when the important part was just having the expertise, since nobody else had good tools, either. Nowadays, not so much unless you're doing relatively simple tasks in an environment where the developmental inefficiency isn't important.
> >-- > >r b-j rbj@audioimagination.com > >"Imagination is more important than knowledge." > >
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
>> to inform a software manager
I've seen too many proprietary software tools that give a very polished _illusion_ of making problems disappear, when in reality they are just hidden or postponed. I would take a late-adopter attitude, stay clear of non-proven tools or methodologies. Spinning your own tools isn't good for pretty powerpoint slides but usually gets the job done. And you have the competence (=consultants) in-house. _____________________________ Posted through www.DSPRelated.com