You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: Alan G I. <ai...@am...> - 2006-05-21 13:05:08
|
On Sun, 21 May 2006, Bryan Cole apparently wrote: > another way to get going is to convert your numpy array > directly to a VTK data file using a pure python script. For which http://cens.ioc.ee/projects/pyvtk/ may be useful. Cheers, Alan Isaac |
From: Bryan C. <br...@co...> - 2006-05-21 07:39:20
|
On Sat, 2006-05-20 at 22:57 +0200, Emanuele Olivetti wrote: > I need to use a 3D visualization toolkit together with the > amazing numpy. On the scipy website mayavi/VTK are suggested but > as far as I tried, mayavi uses only Numeric and doesn't like > numpy arrays (and mayavi, last release, dates 13 September 2005 > so a bit earlier for numpy). You can safely install Numeric along side numpy; you'll need to do this in order to run mayavi. Alternatively, you could try Paraview (http://www.paraview.org). Like mayavi, Paraview is based on VTK, but it's written in Tcl/Tk rather than python. It's more feature complete than mayavi and easier to use, in my view. I quick test shows that VTK-5 is happy to accept numpy arrays as "Void Pointers" for its vtkDataArrays. Using this method, you can construct any vtkDataObject from numpy arrays. If you just want to turn your 3D array into vtkImageData, you can use the vtkImageImport filter. Once you've got a vtkDataSet (vtkImageData or some other form), you can save this as a .vtk file, which either mayavi or paraview can then open. If you're not already familiar with VTK programming, then another way to get going is to convert your numpy array directly to a VTK data file using a pure python script. The file formats are documented at http://www.vtk.org/pdf/file-formats.pdf and the can be written in either binary or ascii form. The 'legacy' .vtk formats and are quite simple to construct. If you want to use mayavi from a script, then you need to convert your numpy arrays to Numeric arrays (using the Numeric.asarray function) for transfer to mayavi as needed. HTH Bryan > Do you know something about it or > could suggest alternative 3D visualization packages? > Basically my needs are related to this task: I've 3D matrices > and I'like to see them not only as 2D slices. > > Thanks in advance, > > Emanuele > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 |
From: Travis O. <oli...@ie...> - 2006-05-21 03:27:00
|
Simon Burton wrote: >>>> a=numpy.array([1,2,3],numpy.Int8) >>>> a >>>> > array([1, 2, 3], dtype=int8) > >>>> a*2 >>>> > array([2, 4, 6], dtype=int16) > > > My little 2 lives happily as an int8, so why is the int8 array > cast to an int16 ? > Thanks for catching this bug in the logic of scalar upcasting. It should only affect this one case. It's now been fixed. -Travis |
From: Simon B. <si...@ar...> - 2006-05-21 02:44:30
|
On Sun, 21 May 2006 12:28:10 +0100 Simon Burton <si...@ar...> wrote: > > >>> a=numpy.array([1,2,3],numpy.Int8) > >>> a > array([1, 2, 3], dtype=int8) > >>> a*2 > array([2, 4, 6], dtype=int16) > >>> > > My little 2 lives happily as an int8, so why is the int8 array > cast to an int16 ? As a workaround, i found this: >>> a*=2 >>> a array([2, 4, 6], dtype=int8) Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com |
From: Simon B. <si...@ar...> - 2006-05-21 02:42:51
|
>>> a=numpy.array([1,2,3],numpy.Int8) >>> a array([1, 2, 3], dtype=int8) >>> a*2 array([2, 4, 6], dtype=int16) >>> My little 2 lives happily as an int8, so why is the int8 array cast to an int16 ? I spent quite a while finding this bug. Furthermore, this works: >>> a*a array([1, 4, 9], dtype=int8) but not this: >>> a*numpy.array(2,dtype=numpy.Int8) array([2, 4, 6], dtype=int16) >>> print numpy.__version__ 0.9.9.2533 Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com |
From: Travis O. <oli...@ie...> - 2006-05-20 22:25:36
|
jo...@st... wrote: > For your information: I just created a small cookbook document > http://scipy.org/Cookbook/InputOutput > where it is explained how one can read and write Numpy arrays in human > readable (ascii) format. > > > The document describes how one can use read_array/write_array if SciPy > is installed, or how one can use load/save if Matplotlib is installed. > When neither of these two packages is installed, one basically has no > other choice then to improvise, so I also give here a few examples how > one could do this. > > Imho, there is something unsatisfactorily about this need to improvise. > Ascii input/output of numpy arrays seems to me a very basic need. Even > when one defines Numpy crudely as the N-dimensional array object, and > Scipy as the science you can do with these array objects, then I would > intuitively still expect that ascii input/output would belong to Numpy > rather than to Scipy. There are Numpy support functions for binary format, > and for pickled format, but strangely enough not really for ascii format. > tofile() and fromfile() do not preserve the shape of a 2d array, and are > in practice therefore hardly usable. > > There may be a signficant fraction of Numpy users that do not need SciPy > for their work, and have only Numpy installed. My guess is that the > read_array and write_array functions have already been re-invented many > many times by these users. Imho, I therefore think that Numpy deserves > its own read_array/write_array method. Does anyone else have this feeling, > or am I the only one? :o) > I think you are correct. I'd like to see better ascii input-output. That's why it's supported on a fundamental level in tofile and fromfile. SciPy's support for ascii reading and writing is rather slow as it has a lot of features. Something a little-less grandiose, but still able to read and write simple ascii tables would be a good thing to bring into NumPy. General-purpose parsing can be very difficult, but a simple parser for 2-d arrays would probably be very useful. On the other hand, I've found that even though it understands only one separator at this point, fromfile is still pretty useful for table processing as long as you know the shape of what you want. -Travis > Joris > > > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: <jo...@st...> - 2006-05-20 22:14:07
|
For your information: I just created a small cookbook document http://scipy.org/Cookbook/InputOutput where it is explained how one can read and write Numpy arrays in human readable (ascii) format. The document describes how one can use read_array/write_array if SciPy is installed, or how one can use load/save if Matplotlib is installed. When neither of these two packages is installed, one basically has no other choice then to improvise, so I also give here a few examples how one could do this. Imho, there is something unsatisfactorily about this need to improvise. Ascii input/output of numpy arrays seems to me a very basic need. Even when one defines Numpy crudely as the N-dimensional array object, and Scipy as the science you can do with these array objects, then I would intuitively still expect that ascii input/output would belong to Numpy rather than to Scipy. There are Numpy support functions for binary format, and for pickled format, but strangely enough not really for ascii format. tofile() and fromfile() do not preserve the shape of a 2d array, and are in practice therefore hardly usable. There may be a signficant fraction of Numpy users that do not need SciPy for their work, and have only Numpy installed. My guess is that the read_array and write_array functions have already been re-invented many many times by these users. Imho, I therefore think that Numpy deserves its own read_array/write_array method. Does anyone else have this feeling, or am I the only one? :o) Joris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm |
From: Emanuele O. <oli...@it...> - 2006-05-20 20:57:45
|
I need to use a 3D visualization toolkit together with the amazing numpy. On the scipy website mayavi/VTK are suggested but as far as I tried, mayavi uses only Numeric and doesn't like numpy arrays (and mayavi, last release, dates 13 September 2005 so a bit earlier for numpy). Do you know something about it or could suggest alternative 3D visualization packages? Basically my needs are related to this task: I've 3D matrices and I'like to see them not only as 2D slices. Thanks in advance, Emanuele |
From: Travis O. <oli...@ie...> - 2006-05-20 14:53:41
|
Owners of "Guide to NumPy": I'm a little late with updates. I really apologize for that. It's due to not having a good system in place to allow people to get the updates in a timely manner. The latest version is from March. It includes a bit more information about writing C-extensions and some corrections. I've been sending them to people who urgently need them and request it. I'm working on an update to go along with 0.9.8 release. When it is ready I will send a location and password for people to download it. I expect 2-3 weeks for its release. If you need the March copy earlier than that, please let me know and I'll send you a personal update. Thanks for your patience. I hope to send updates to the manual at major releases of NumPy. Best regards, -Travis Oliphant |
From: Alan G I. <ai...@am...> - 2006-05-20 14:22:14
|
On Sat, 20 May 2006, Sven Schreiber apparently wrote: > I would also kindly like to ask why nobody (?) gets the > updates of the numpy book. I am totally in favor of the > idea to raise funds by selling good documentation, but the > deal was to get the updates when they come out. While you are phrasing this fairly politely, I think you should not *assume* you have not gotten your most recent "update". Rather you should ask: what is the definition of an "update"? You seem to be defining it by the date on the title page, but that need not be Travis's definition. (I would agree that he could reduce some traffic on this list by clarifying that, perhaps by versioning the book.) Personally, I do not care to receive a copy each time a few typos are corrected or some grammar is changed. I'd rather receive a copy each time there are important additions or corrections. I assume that this is Travis's practice. Cheers, Alan Isaac |
From: Sven S. <sve...@gm...> - 2006-05-20 13:39:31
|
Christian Marquardt schrieb: > Mine says February 28, 2006 on the title page. > > As this has come up quite often - is there any kind of mechanism to > obtain the most recent version? > I would also kindly like to ask why nobody (?) gets the updates of the numpy book. I am totally in favor of the idea to raise funds by selling good documentation, but the deal was to get the updates when they come out. Thanks, Sven |
From: Ed S. <sch...@ft...> - 2006-05-20 11:50:07
|
Hi all, I've discovered a bug in my SciPy code for sparse matrix slicing that was caused by the following behaviour of squeeze(): >>> a = array([3]) # array of shape (1,) >>> type(a.squeeze()) <type 'int32scalar'> That is, squeezing a 1-dim array returns an array scalar. Could we change this to return a 0-dim array instead? Another related question is this: >>> b = array(3) # 0-dim array >>> type(a.squeeze()) <type 'int32scalar'> I find this behaviour surprising too; the docstring claims that squeeze eliminates any length-1 dimensions, but a 0-dimensional array has shape (), without any length-1 dimensions. So shouldn't squeeze() leave 0-dimensional arrays alone? -- Ed |
From: <er...@16...> - 2006-05-20 03:42:13
|
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> <style type="text/css"> <!-- .td { font-size: 12px; color: #313131; line-height: 20px; font-family: "Arial", "Helvetica", "sans-serif"; } --> </style> </head> <body leftmargin="0" background="http://bo.sohu.com//images/img20040502/dj_bg.gif"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="31" background="http://igame.sina.com.cn/club/images/topmenu/topMenu_8.gif" class="td"><div align="center"><font color="#FFFFFF">主办单位: 易腾企业管理咨询有限公司</font></div></td> </tr> </table> <br> <table width="684" border="0" align="center" cellpadding="0" cellspacing="0" height="1287"> <tr> <td height="71" bgcolor="#8C8C8C"> <div align="center"> <table width="100%" border="0" cellspacing="1" cellpadding="0" height="76"> <tr> <td height="74" bgcolor="#F3F3F3"><div align="center"> <span lang="zh-cn"><font size="6">运用EXCEL促进市场营销和财务管理</font></span></div></td> </tr> </table> </div></td> </tr> <tr> <td height="1211" bgcolor="#FFFFFF"> <div align="center"> <table width="99%" border="0" cellspacing="0" cellpadding="0" height="48"> <tr> <td width="17%" height="22" bgcolor="#BF0000" class="td"> <div align="center"><font color="#FFFFFF">[课 程 背 景]</font></div></td> <td width="83%" class="td" height="22"> </td> </tr> <tr> <td height="26" colspan="2" class="td"> <p ALIGN="JUSTIFY"><font LANG="ZH-CN"> </font><font color="#000000" size="2"> 不管您在什么岗位上工作,利用Excel电子表格进行数据分析几乎已经成为每个经理人的必备工具,尤其是在财务和营销管理上,电子表格能够帮助你筛选数据、分析数据并制作管理图表。如果你打算利用Excel提高工作质量和效率,那么这个课程就是为你定制的。<br> </font><b><font color="#ff0000" size="2">培 训 收 益:</font></b><font color="#000000" size="2"><br> 提高EXCEL实际操作能力,提高工作效率;<br> 掌握如何利用各种函数建立数学模型进行高效财务分析;<br> 掌握快速实现产品、客户分类的方法,使公司效益倍增;<br> 掌握建立多因素量本利敏感分析模型,使你直观地发现最佳盈利模式;<br> 掌握利用各种预测工具,寻找营销方案;<br> 掌握如何制作令老板满意的各类图表</font><font LANG="ZH-CN"><font size="2"><span style="mso-bidi-font-size: 9.0pt; mso-bidi-font-family: Times New Roman; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">。</span></font> </font></td> </tr> </table> </div> <div align="center" style="width: 671; height: 1"> </div> <div align="center"> <table width="99%" height="84" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17%" height="20" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[课 程 大 纲]</font></div></td> <td width="83%" class="td"> </td> </tr> <tr> <td height="64" colspan="2" class="td"> <p> <font size="2"><b>一、 EXCEL操作技巧</b></font><font color="#000000" size="2"><br> 数据处理:<br> 数据输入、数据格式、建立公式、数据编辑、调用函数(基本函数、逻辑、统计、数据库、财务类等)、图表制作<br> 数据管理:<br> 排序、筛选、记录单、分类汇总<br> 数据分析:<br> 数据透视表(图)、数据敏感分析、单变量求解、模拟运算表、方案管理器、规划求解<br> <br> </font><font size="2"><b>二、如何运用图表进行销售/财务数据分析和报告</b></font><font color="#000000" size="2"><br> 怎样快速创建出你需要的图表<br> 如何创建动态图<br> 如何因地制宜地使用图表<br> 企业销售业绩的图表表达<br> 产品市场占有率的图表表达<br> 销售成本占产品总成本的图表表达<br> 代理商及销售代表的销售业绩的图表表达<br> 如何运用EXCEL分析市场调查问卷<br> 如何运用EXCEL制作和分析销售报表<br> 如何运用EXCEL制作和分析财务报表<br> <br> </font><font size="2"><b>三、如何运用EXCEL进行销售和财务管理</b></font><font color="#000000" size="2"><br> 成本费用分析与管理<br> 销售业务管理与决策<br> 动态本量利模型分析<br> 固定资产折旧计算<br> 工资及个人所得税计算<br> 现金日报及现金流量表的编制<br> 由资产负债表自动生成现金流量表<br> 工资、固定资产投资、折旧方案筛选等实际运用模板建立和应用分析<br> 量本利分析、回归分析、方案预测、销售客户产品分析等实战演练<br> 定性指标的定量化分析技术应用的模拟演练<br> 运用数据透视表(图)进行经营分析的分析思路和模拟演练<br> 投资项目评价与决策</font><br> </p></td> </tr> </table> <table width="99%" height="84" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17%" height="20" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[导 师 简 介]</font></div></td> <td width="83%" class="td"> </td> </tr> <tr> <td height="64" colspan="2" class="td"> <p> <font color="#FF0000"> </font><font color="#000000"> <font color="#ff0000">Mr Wang </font> ,管理工程硕士、高级经济师,国际职业培训师协会认证职业培训师,历任跨国公司生产负责人、工业工程经理、管理会计分析师、营运总监等高级管理职务多年,同时还担任 < 价值工程 > 杂志审稿人、辽宁省营口市商业银行独立董事等职务,对企业管理有较深入的研究。 王老师主要从事成本控制、财务管理、管理会计决策等课程的讲授,为 IBM 、 TDK 、松下、可口可乐、康师傅、汇源果汁、雪津啤酒、吉百利食品、冠捷电子、 INTEX 明达塑胶、正新橡胶、美国 ITT 集团、广上科技、美的空调、中兴通讯、京信通信、联想电脑,应用材料 ( 中国 ) 公司、艾克森 - 金山石化、中国化工进出口公司、正大集团大福饲料、厦华集团、灿坤股份、NEC 东金电子、太原钢铁集团、 PHILIPS 、深圳开发科技、大冷王运输制冷、三洋华强、 TCL 、美的汽车、上海贝尔阿尔卡特、天津扎努西、上海卡博特等知名企业提供项目辅导或专题培训。王老师授课经验丰富,风格幽默诙谐、逻辑清晰、过程互动,案例生动、深受学员喜爱</font>。<font color="#FF0000"> </font> </p></td> </tr> </table> </div> <div align="center"> <table width="669" border="0" cellpadding="0" cellspacing="0" height="57"> <tr> <td width="132" height="26" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[时间/地点/联系方式]</font></div></td> <td width="536" class="td" height="26"> </td> </tr> <tr> <td height="31" colspan="2" class="td" width="669"> <p><b> </b><font size="2"><b>时间:</b> 6月3-4日(周六/日)<b> 地点:</b></font>上海 <font size="2"><b> </b>1980元/人 四人以上参加,赠送一名名额</font> </p> </td> </tr> </table> </div> <table width="99%" height="51" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="51" class="td"> <font size="2"><b> 电话:</b>021-51187126 谢小姐 注:如您不需要此邮件,请回信 ts...@to...并在标题注明订退</font></td> </tr> </table> </td> </tr> </table> </body> </html> |
From: Alan G I. <ai...@am...> - 2006-05-19 18:03:05
|
It seems to me that the core question is whether you really need the direct sum to be constructed (seem unlikely), or whether you just need the information in the constituent matrices. How about a direct sum class, which takes a list of matrices as an argument, and appropriately defines the operations you need. Cheers, Alan Isaac PS I have argued that this is a better way to handle the Kronecker product as well, but as here I did not offer code. ;-) If you code it, please share it. |
From: Fred C. <fr...@uc...> - 2006-05-19 16:58:41
|
None of the functions in section 4.5 of the manual seem to be implemented: >>> import numpy >>> numpy.__version__ '0.9.6' >>> a = numpy.array([0.]) >>> numpy.isdtype(a) Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'module' object has no attribute 'isdtype' ? Fred Clare |
From: Pau G. <pau...@gm...> - 2006-05-19 16:56:41
|
On 5/19/06, jo...@st... <jo...@st...> wrote: > > For your information: http://scipy.org/Numpy_Example_List > - all examples are now syntax highlighted (thanks Pau Gargallo!) > - most examples have now a clickable "See also:" footnote > - is extended to 118 examples > > Joris > Thanks to you Joris !! 118 examples in a week, you did a huge work! The color syntax have some problems. We are using now the moinmoin command: {{{#!python numbers=3Ddisable so moinmoin is coloring the interactive sessions as if they were python files. This gives error when the output of the interactive session don't look like python code. See for example http://www.scipy.org/Numpy_Example_List#histogram where the print commands print opening brackets "[" and not the closing ones. Does someone know an easy way to solve this? Is there some way to deactivate the #!python color highlighting for some lines of the code? All around the scipy.org site there are examples of interactive python sessions, it will be nice to have a special syntax highlighter for them. Like: {{{#!python_interactive may be to much efforts just for colors? pau |
From: <jo...@st...> - 2006-05-19 14:45:11
|
For your information: http://scipy.org/Numpy_Example_List - all examples are now syntax highlighted (thanks Pau Gargallo!) - most examples have now a clickable "See also:" footnote - is extended to 118 examples Joris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm |
From: Satya U. <sat...@ya...> - 2006-05-19 13:17:44
|
Dear Python Users and Gurus, My problem is that i have a distance matrix obtained from the software package PHYLIP. I have placed it in a text file, and using ordinary python i am able to save the matrix elements as a multidimensional array. My problem is that i wish to now convert this multidimensional array into a matrix and subsequently i wish to find the eigenvectors and eigenvalues of this matrix. I tried using scipy and also earlier the Numeric and LinearAlgebra modules but i am facing problems. I can generate a new matrix using scipy (and also with Numeric/LinearAlgebra) and can obtain the corresponding eigenvectors. But i am facing a real problem in making scipy or Numeric/LinearAlgebra accept my multidimensional array as a matrix it can recognize. Please help/give a pointer to a similar query. Thanking you, Satya --------------------------------- Do you have a question on a topic you cant find an Answer to. Try Yahoo! Answers India Get the all new Yahoo! Messenger Beta Now |
From: Christian M. <chr...@ma...> - 2006-05-19 06:45:45
|
Mine says February 28, 2006 on the title page. As this has come up quite often - is there any kind of mechanism to obtain the most recent version? Regards, Christian. On Thu, May 18, 2006 23:07, Mark Heslep wrote: > So is the January '06 version of the Guide to Numpy still the most > recent version? > > Mark > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, securit= y? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geron= imo > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Bill B. <wb...@gm...> - 2006-05-19 01:45:05
|
I read the chapter in your book and sort of vaguely understand what it does now. Take an array A and index array ind: >>> A array([[ 0, 5, 10, 15], [ 1, 6, 11, 16], [ 2, 7, 12, 17], [ 3, 8, 13, 18], [ 4, 9, 14, 19]]) >>> ind array([[1, 3, 4], [0, 2, 1]]) And you get >>> A[ind] array([[[ 1, 6, 11, 16], [ 3, 8, 13, 18], [ 4, 9, 14, 19]], [[ 0, 5, 10, 15], [ 2, 7, 12, 17], [ 1, 6, 11, 16]]]) In this case it's roughly equivalent to [ A[row] for row in ind ]. >>> num.asarray( [ A[r] for r in ind ] ) array([[[ 1, 6, 11, 16], [ 3, 8, 13, 18], [ 4, 9, 14, 19]], [[ 0, 5, 10, 15], [ 2, 7, 12, 17], [ 1, 6, 11, 16]]]) >>> So I guess it could be useful if you want to take a bunch of different random samples of your data and stack them all up. E.g. you have a (1000,50) shaped grid of data, and you want to take N random samplings, eac= h consisting of 100 rows from the original grid, and then put them all together into an (N,100,50) array. Or say you want to make a stack of sliding windows on the data like rows 0-5, then rows 1-6, then rows 2-7, et= c to make a big (1000-5,5,50) array. Might be useful for that kind of thing. But thinking about applying an index obj of shape (2,3,4) to a (10,20,30,40,50) shaped array just makes my head hurt. :-) Does anyone actually use it, though? I also found it unexpected that A[ (ind[0], ind[1] ) ] doesn't do the same thing as A[ind] when ind.shape=3D= ( A.ndim, N). List of array -- as in A[ [ind[0], ind[1]] ] -- seems to act just like tuple of array also. --bill |
From: Mark H. <ma...@mi...> - 2006-05-18 21:08:04
|
So is the January '06 version of the Guide to Numpy still the most recent version? Mark |
From: Jonathan T. <jon...@ut...> - 2006-05-18 17:58:28
|
When 0.9.8 comes out does that mean the API is stable, or will there be API changes before 1.0? Jon. On 5/17/06, Travis Oliphant <oli...@ie...> wrote: > > If there are now further difficulties, I'm going to release 0.9.8 > today. Then work on 1.0 can begin. The 1.0 release will consist of a > series of release candidates. > > Thank you to David Cooke for his recent flurry of fixes.. Thanks to all > the other developers who have contributed as well. > > -Travis > > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job ea= sier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim= o > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Alan G I. <ai...@am...> - 2006-05-18 17:55:17
|
On Thu, 18 May 2006, Ed Schofield apparently wrote: > I've never thought of zip as a transpose operation > before, but I guess it is http://mail.python.org/pipermail/python-list/2004-December/257416.html But I like it. Cheers, Alan Isaac |
From: Fernando P. <fpe...@gm...> - 2006-05-18 17:27:22
|
On 5/18/06, Bill Baxter <wb...@gm...> wrote: > In Einstein summation notation, what numpy.dot() does now is: > c_riqk =3D a_rij * b_qjk > > And you want: > c_[r]ik =3D a_[r]ij * b_[r]jk > > where the brackets indicate a 'no summation' index. > Writing the ESN makes it clearer to me anyway. :-) I recently needed something similar to this, and being too lazy to think up the proper numpy ax-swapping kung-fu, I just opened up weave and was done with it in a hurry. Here it is, in case anyone finds the basic idea of any use. Cheers, f ### class mt3_dot_factory(object): """Generate the mt3t contract function, holding necessary state. This class only needs to be instantiated once, though it doesn't try to enforce this via singleton/borg approaches at all.""" def __init__(self): # The actual expression to contract indices, as a list of strings t= o be # interpolated into the C++ source mat_ten =3D ['mat(i,m)*ten(m,j,k)', # first index 'mat(j,m)*ten(i,m,k)', # second 'mat(k,m)*ten(i,j,m)', # third ] # Source template code_tpl =3D """ for (int i=3D0;i<order;i++) { for (int j=3D0;j<order;j++) { for (int k=3D0;k<order;k++) { double sum=3D0; for (int m=3D0;m<order;m++) { sum +=3D %s; } out(i,j,k) =3D sum; } } } """ self.code =3D [code_tpl % mat_ten[idx] for idx in (0,1,2)] def __call__(self,mat,ten,idx): """mt3s_contract(mat,ten,idx) -> tensor. A special type of matrix-tensor contraction over a single index. T= he returned array has the following structure: out(i,j,k) =3D sum_m(mat(i,m)*ten(m,j,k)) if idx=3D=3D0 out(i,j,k) =3D sum_m(mat(j,m)*ten(i,m,k)) if idx=3D=3D1 out(i,j,k) =3D sum_m(mat(k,m)*ten(i,j,m)) if idx=3D=3D2 Inputs: - mat: an NxN array. - ten: an NxNxN array. - idx: the position of the index to contract over, 0 1 or 2.""" # Minimal input validation - we use asserts so they don't kick in # under a -O run of python. assert len(mat.shape)=3D=3D2,\ "mat must be a rank 2 array, shape=3D%s" % mat.shape assert mat.shape[0]=3D=3Dmat.shape[1],\ "Only square matrices are supported: mat shape=3D%s" % mat.s= hape assert len(ten.shape)=3D=3D3,\ "mat must be a rank 3 array, shape=3D%s" % ten.shape assert ten.shape[0]=3D=3Dten.shape[1]=3D=3Dten.shape[2],\ "Only equal-dim tensors are supported: ten shape=3D%s" % ten= .shape order =3D mat.shape[0] out =3D zeros_like(ten) inline(self.code[idx],('mat','ten','out','order'), type_converters =3D converters.blitz) return out # Make actual instance mt3_dot =3D mt3_dot_factory() |
From: Ed S. <sch...@ft...> - 2006-05-18 17:20:50
|
George Nurser wrote: > This is a very useful thread. Made me think about what the present > arrangement is supposed to do. Great! > Alternatively, instead of transpose, we can simply use zip. > > E.g. (3D) > In [42]: for i,j,k in zip(*xx): > ....: print i,j,k That's interesting. I've never thought of zip as a transpose operation before, but I guess it is ... -- Ed |