[Numpy-discussion] The idiom for supporting matrices and arrays in a function

Bill Baxter wbaxter at gmail.com
Thu Mar 2 17:23:23 CST 2006


Thanks for all the info folks.  This all sounds a little more complicated
than is warranted for the "Numpy for Matlab Users" wiki page, though.  So I
think I'll just comment on the presence of asarray, asanyarray, and asmatrix
for type conversions.

--bb

On 3/3/06, Alan G Isaac <aisaac at american.edu> wrote:
>
> On Thu, 02 Mar 2006, "Colin J. Williams" apparently wrote:
> > How does asanyyarray() differ from asarray()?
>
> It leaves alone subclasses of ndarray.  See example below.
> Cheers,
> Alan Isaac
>
> Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy as N
> >>> y=N.mat([[1,2],[3,4]])
> >>> z1=N.asarray(y)
> >>> z2=N.asanyarray(y)
> >>> z1
> array([[1, 2],
>        [3, 4]])
> >>> z2
> matrix([[1, 2],
>        [3, 4]])
> >>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> language
> that extends applications into web and mobile media. Attend the live
> webcast
> and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>



--
William V. Baxter III
OLM Digital
Kono Dens Building Rm 302
1-8-8 Wakabayashi Setagaya-ku
Tokyo, Japan  154-0023
+81 (3) 3422-3380
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060302/4a6f637d/attachment.html 


More information about the Numpy-discussion mailing list