|
From: Darren D. <dd...@co...> - 2006-02-09 12:04:03
|
On Thursday 09 February 2006 3:21 am, Bill Baxter wrote: > I added some content to the "NumPy/SciPy for Matlab users" page on the > scipy wiki. > > But my knowledge of NumPy/SciPy isn't sufficient to fill in the whole chart > of equivalents that I laid out. > If folks who know both could browse by and maybe fill in a blank or two, > that would be great. I think this will be a helpful "getting started" page > for newbies to NumPy coming from matlab, like me. One of the most > frustrating things is when you sit down and can't figure out how to do the > most basic things that do in your sleep in another environment (like making > a column vector). So hopefully this page will help. > > The URL is : http://www.scipy.org/Wiki/NumPy_for_Matlab_Addicts I filled in a couple of places, where I could. I have a question about upcasting related to this example: a with elements less than 0.5 zeroed out: Matlab: a .* (a>0.5) NumPy: where(a<0.5, 0, a) I think numpy should be able to do a*a>0.5 as well, but instead one must do: a*(a>0.5).astype('i') Is it desireable to upcast bools in this case? I think so, one could always recover the current behavior by doing: (a*(a>0.5)).astype('?') Darren |