[SciPy-user] LiberMate was Re: Automating Matlab

Eric Schug schugschug@gmail....
Mon Feb 23 22:15:52 CST 2009

Thanks everyone for you comments.
I will try to address them.

> * translation of integers to floats, e.g. for array indices or for arange

Rational for cast if int to float.
Matlab always uses float data type, for most expressions

e.g. try
format long e

This is mostly a problem for division, integer division would be used in some cases 
yielding the wrong results. e.g.
would give 0 and not 0.5 as it does in Matlab. An alternative method would be 
to use 
from __future__ import division

I think the best would be to have this be a command line option, so that various translation rules could be enabled or disabled. 

> * multiplication of scalar with array is translated with dot, eg
>   m:  randn(n,k-1)*10 ->  py: = dot(randn(n, k-1.), 10.)

Matrix multiplication in matlab is * -> dot in Numpy but with scalars should use more readable *

> string array in matlab came out as empty numpy array
> m:
> vnames=['yvar',
>         'iota',
>         'x1  ',
>         'x2  '];
> -> py:
> vnames = array(r_[])

> Importing everything is a source of possible errors (e.g. pylab
> overwrites numpy names)
> from numpy import *
> import scipy
> # if available import pylab (from matlibplot)
> try:
>     from pylab import *
> except ImportError:
>    pass

need to cross reference numpy functions.

I've added the rest to tracker at SourceForge. Although, still learning to use Source forge tools.


More information about the SciPy-user mailing list