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}

S  M  T  W  T  F  S 



1
(21) 
2
(20) 
3
(22) 
4
(11) 
5
(4) 
6
(6) 
7
(6) 
8
(9) 
9
(15) 
10
(24) 
11
(24) 
12
(11) 
13
(8) 
14
(21) 
15
(19) 
16
(28) 
17
(9) 
18
(37) 
19
(5) 
20
(8) 
21
(13) 
22
(14) 
23
(24) 
24
(28) 
25
(40) 
26
(40) 
27
(31) 
28
(24) 
29
(61) 
30
(38) 
31
(42) 


From: David M. Cooke <cookedm@ph...>  20060831 23:12:53

On Aug 30, 2006, at 11:53 , Keith Goodman wrote: > I plan to build an amd64 box and run debian etch. Are there any big, > 64bit, showstopping problems in numpy? Any minor annoyances? Shouldn't be; I regularly build and test it on an amd64 box running Debian unstable, and I know several others use amd64 boxes too.  >\/< /\ David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ cookedm@... 
From: <hjn253@to...>  20060831 20:27:37

<html> <head> <meta httpequiv="ContentType" content="text/html; charset=gb2312"> <title>无标题文档</title> <style type="text/css"> <! .td { fontsize: 12px; color: #313131; lineheight: 20px; fontfamily: "Arial", "Helvetica", "sansserif"; } > </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="1171"> <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="zhcn"><font size="6">运用EXCEL改进市场营销与财务管理</font></span></div></td> </tr> </table> </div></td> </tr> <tr> <td height="1095" 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="ZHCN"> <font size="2"> 不管您在什么岗位上工作，利用Excel电子表格进行数据分析几乎已经成为每个经理人的必备工具，无论您从事采购、销售、财务分析还是经营决策，电子表格能够帮助你筛选数据、分析数据并制作管理图表，Excel的各种财务函数为您进行本量利分析和经营决策提供了方便。如果你打算利用Excel提高工作质量和效率，运用Powerpoint制作优美的演示报告取得不同凡响的震撼效果，那么这个课程就是为你定制的。<br> <b>培 训 收 益：</b><br> 提高EXCEL和PPT实际操作能力，提高工作效率；<br> 掌握如何利用各种函数建立数学模型进行高效财务分析；<br> 掌握快速实现产品、客户分类的方法，使公司效益倍增；<br> 掌握建立多因素量本利敏感分析模型，使你直观地发现最佳盈利模式；<br> 掌握利用各种预测工具，寻找营销方案；<br> 掌握如何制作令老板满意的各类图表和管理报告。 </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和Powerpoint的操作技巧</b><br> 1 数据管理：<br> 数据格式、建立公式、数据编辑、图表制作、排序、筛选、分类汇总<br> 2 数据分析：<br> 数据透视表(图)、数据敏感分析、单变量求解、模拟运算表、规划求解<br> 3 不同类型报告的模版演示：<br> ①业绩报告；项目汇报、②财务报告、③动员与展望、④评审/评估报告<br> 4 图表应用的五个步骤：<br> 目标、主题、对比关系、数据、图表<br> 5 用PPT表达思想<br> 管理结构、工作流程、业绩趋势和分析、竞争对手的对比<br> 6 PPT与EXCEL,OUTLOOK的链接使用技巧<br> <br> <b>二、如何运用图表进行事务处理和工作报告</b><br> 怎样快速创建出你需要的图表<br> 如何创建动态图<br> 如何因地制宜地使用图表<br> 行政管理表格设计<br> 人力资源管理表格设计<br> 如何自动生成员工考核工资表<br> 企业销售业绩的图表表达<br> 产品市场占有率的图表表达<br> 如何运用EXCEL分析市场调查问卷<br> 如何运用EXCEL制作和分析销售报表<br> 如何运用EXCEL制作和分析财务报表<br> 人事、物料、财务数据库的链接和自动处理<br> <br> <b>三、如何运用EXCEL进行本量利分析和经营决策</b><br> 成本费用分析与管理<br> 销售业务管理与决策<br> 动态本量利模型分析<br> 固定资产折旧计算<br> 工资及个人所得税计算<br> 现金日报及现金流量表的编制<br> 由资产负债表自动生成现金流量表<br> 工资、固定资产投资、折旧方案筛选等实际运用模板建立和应用分析<br> 量本利分析、回归分析、方案预测、销售客户产品分析等实战演练<br> 定性指标的定量化分析技术应用的模拟演练<br> 运用数据透视表（图）进行经营分析的分析思路和模拟演练<br> 投资项目评价与决策<br> <br> <b>四、管理和经营报告</b><br> 用图片插入技术制作项目分析短片<br> 动画展示产品型号及功能<br> 市场分析及推广计划演示<br> 形象化的股东大会营运报告<br> 制作动感宣传片<br> 丰富多彩的可行性研究报告<br> <br> <b>五、案例分析和实例演练</b></font></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 size="2">Mr Wang ，管理工程硕士、高级经济师，国际职业培训师协会认证职业培训师，历任跨国公司工业工程经理、管理会计分析师、营运总监等高级管理职务多年，同时还担任 < 价值工程 > 杂志审稿人、辽宁省营口市商业银行独立董事等职务，对企业管理有较深入的研究。 王老师主要从事成本控制、财务管理、管理会计决策等课程的讲授，为 IBM 、 TDK 、松下、可口可乐、康师傅、汇源果汁、雪津啤酒、吉百利食品、冠捷电子、 INTEX 明达塑胶、正新橡胶、美国 ITT 集团、广上科技、美的空调、中兴通讯、京信通信、联想电脑，应用材料 ( 中国 ) 公司、艾克森  金山石化、中国化工进出口公司、正大集团大福饲料、厦华集团、灿坤股份、NEC 东金电子、太原钢铁集团、 PHILIPS 、深圳开发科技、大冷王运输制冷、三洋华强、 TCL 、美的汽车、上海贝尔阿尔卡特、天津扎努西、上海卡博特等知名企业提供项目辅导或专题培训。王老师授课经验丰富，风格幽默诙谐、逻辑清晰、过程互动，案例生动、深受学员喜爱。</font></p></td> </tr> </table> </div> <div align="center"> <table width="679" border="0" cellpadding="0" cellspacing="0" height="70"> <tr> <td width="132" height="24" bgcolor="#0080C0" class="td"> <div align="center"><font color="#FFFFFF">[时间/地点/联系方式]</font></div></td> <td width="546" class="td" height="24"> </td> </tr> <tr> <td height="46" colspan="2" class="td" width="679"> <p><font size="2"><b>时间:</b> 9月910日 (周六/日) 上海 1980/人<font face="宋体">(含课程费、教材、午餐等)</font> 四人以上参加,赠予一名名额</font></p> </td> </tr> </table> </div> <table width="99%" height="45" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="25" class="td"> <font size="2"><b>报名/咨询:</b><font color="#000000"> </font>谢小姐 <font color="#000000">02151187126</font><br> 注:如您不需要此邮件,请发送邮件至:eebbs@... 并在标题注明订退</font></td> </tr> </table> </td> </tr> </table> </body> </html> 
From: Charles R Harris <charlesr.harris@gm...>  20060831 19:59:44

On 8/31/06, Christopher Barker <Chris.Barker@...> wrote: > > Tom Denniston wrote: > > I would think one would want to throw an error when the data has > > inconsistent dimensions. > > But it doesn't have inconsistent dimensions  they are perfectly > consistent with a (2,) array of objects. How is the code to know what > you intended? Same as it produces a float array from array([1,2,3.0]). Array is a complicated function for precisely these sort of reasons, but the convenience makes it worthwhile. So, if a list contains something that can only be interpreted as an object, dtype should be set to object. With numeric types, it is unambiguous to march down through the > sequences until you get a number. As a sequence is an object, there no > way to unambiguously do this automatically. > > Perhaps the way to solve this is for the array constructor to take a > "shape" or "rank" argument, so you could specify what you intend. But > that's really just syntactic sugar to avoid for calling numpy.empty() > first. > > Perhaps a numpy.object_array() constructor would be useful, although as > I think about it, even specifying a shape or rank would not be > unambiguous! > > This is a useful discussion. If we ever get a ndarray into the standard > lib, I suspect that object arrays will get heavy use  better to clean > up the semantics now. > > Perhaps a Wiki page on building object arrays is called for. > > Chris Chuck 
From: Christopher Barker <Chris.Barker@no...>  20060831 19:51:18

Tom Denniston wrote: > I would think one would want to throw an error when the data has > inconsistent dimensions. But it doesn't have inconsistent dimensions  they are perfectly consistent with a (2,) array of objects. How is the code to know what you intended? With numeric types, it is unambiguous to march down through the sequences until you get a number. As a sequence is an object, there no way to unambiguously do this automatically. Perhaps the way to solve this is for the array constructor to take a "shape" or "rank" argument, so you could specify what you intend. But that's really just syntactic sugar to avoid for calling numpy.empty() first. Perhaps a numpy.object_array() constructor would be useful, although as I think about it, even specifying a shape or rank would not be unambiguous! This is a useful discussion. If we ever get a ndarray into the standard lib, I suspect that object arrays will get heavy use  better to clean up the semantics now. Perhaps a Wiki page on building object arrays is called for. Chris  Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 5266959 voice 7600 Sand Point Way NE (206) 5266329 fax Seattle, WA 98115 (206) 5266317 main reception Chris.Barker@... 
From: Tom Denniston <tom.denniston@al...>  20060831 19:29:19

I would think one would want to throw an error when the data has inconsistent dimensions. This is what numpy does for other dtypes: In [10]: numpy.array(([1,2,3], [4,5,6])) Out[10]: array([[1, 2, 3], [4, 5, 6]]) In [11]: numpy.array(([1,3], [4,5,6]))  exceptions.TypeError Traceback (most recent call last) TypeError: an integer is required On 8/31/06, Christopher Barker <Chris.Barker@...> wrote: > > Tom Denniston wrote: > > So my question is what is the _advantage_ of the new semantics? > > what if the list don't have the same length, and therefor can not be > made into an array, now you get a weird result: > > >>>N.array([N.array([1,'A',None],dtype=object),N.array > ([2,2,'Somestring',5],dtype=object)]).shape > () > > Now you get an Object scalar. > > but: > >>>N.array([N.array([1,'A',None],dtype=object),N.array > ([2,2,'Somestring',5],dtype=object)],dtype=object).shape > (2,) > > Now you get a length 2 array, just like before: far more consistent. > With the old semantics, if you test your code with arrays of different > lengths, you'll get one thing, but if they then happen to be the same > length in some production use, the whole thing breaks  this is a Bad > Idea. > > Object arrays are just plain weird, there is nothing you can do that > will satisfy every need. I think it's best for the array constructor to > not try to guess at what the hierarchy of sequences you *meant* to use. > You can (and probably should) always be explicit with: > > >>> A = N.empty((2,), dtype=object) > >>> A > array([None, None], dtype=object) > >>> A[:] = [N.array([1,'A', None], > dtype=object),N.array([2,2,'Somestring',5],dtype=object)] > >>> A > array([[1 A None], [2 2 Somestring 5]], dtype=object) > > Chris > > > > > >  > Christopher Barker, Ph.D. > Oceanographer > > NOAA/OR&R/HAZMAT (206) 5266959 voice > 7600 Sand Point Way NE (206) 5266329 fax > Seattle, WA 98115 (206) 5266317 main reception > > Chris.Barker@... > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > 
From: Christopher Barker <Chris.Barker@no...>  20060831 19:09:00

Tom Denniston wrote: > So my question is what is the _advantage_ of the new semantics? what if the list don't have the same length, and therefor can not be made into an array, now you get a weird result: >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)]).shape () Now you get an Object scalar. but: >>>N.array([N.array([1,'A',None],dtype=object),N.array([2,2,'Somestring',5],dtype=object)],dtype=object).shape (2,) Now you get a length 2 array, just like before: far more consistent. With the old semantics, if you test your code with arrays of different lengths, you'll get one thing, but if they then happen to be the same length in some production use, the whole thing breaks  this is a Bad Idea. Object arrays are just plain weird, there is nothing you can do that will satisfy every need. I think it's best for the array constructor to not try to guess at what the hierarchy of sequences you *meant* to use. You can (and probably should) always be explicit with: >>> A = N.empty((2,), dtype=object) >>> A array([None, None], dtype=object) >>> A[:] = [N.array([1,'A', None], dtype=object),N.array([2,2,'Somestring',5],dtype=object)] >>> A array([[1 A None], [2 2 Somestring 5]], dtype=object) Chris  Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 5266959 voice 7600 Sand Point Way NE (206) 5266329 fax Seattle, WA 98115 (206) 5266317 main reception Chris.Barker@... 
From: Christopher Barker <Chris.Barker@no...>  20060831 18:51:50

Tim Hochberg wrote: >> That's what I'd expect, but what if you start with a (0,) array: >> >>> a = N.array([]).sum(); a.shape; a.size; a >> () >> 1 >> 0 >> >> where did that zero come from? >> > More or less from: > > >>> numpy.add.identity > 0 I'm not totally sure, but I think I'd rather it raise an exception. However, if it's not going to, then 0 is really the only reasonable answer. Chris  Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 5266959 voice 7600 Sand Point Way NE (206) 5266329 fax Seattle, WA 98115 (206) 5266317 main reception Chris.Barker@... 
From: Tim Hochberg <tim.hochberg@ie...>  20060831 18:43:41

Torgil Svensson wrote: >> Yes. fromiter(iterable, dtype, count) works. >> > > Oh. Thanks. I probably had too old documentation to see this (15 > June). If it's not updated since I'll give Travis a rest about this, > at least until 1.0 is released :) > Actually I just knew 'cause I wrote it. I don't see a docstring for fromiter, although I though I wrote one. Maybe I just forgot? >> Regardless, L is only iterated over once. >> > > How can this be true? If no size is given, mustn't numpy either loop > over L twice or build an internal representation on which it'll > iterate or copy in chunks? > Well, it can't in general loop over L twice since the only method that L is guaranteed to have is next(); that's the extent of the iterator protocol. What it does is allocate an initial chunk of memory (the size of which I forget  I did some tuning) and start filling it up. Once it's full, it does a realloc, which expands the existing chunk or memory, if possible, or returns a new, larger, chunk of memory with the data copied into it. Then we iterate on L some more until we fill up the new larger chunk, in which case we go get another one, etc. This is exactly how list.append works, although in that case the chunk of data is acutally a chunk of pointers to objects. tim > > I just found out that this works > >>>> import numpy,itertools >>>> rec_dt=numpy.dtype(">i4,S10,f8") >>>> rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',8)]) >>>> numpy.fromiter(rec_iter,rec_dt,10).view(recarray) >>>> > recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', 8.0), (1, 's', 4.0), > (5, 'y', 190.0), (2, 'h', 8.0), (1, 's', 4.0), (5, 'y', 190.0), > (2, 'h', 8.0), (1, 's', 4.0)], > dtype=[('f0', '>i4'), ('f1', 'S10'), ('f2', '<f8')]) > > but what's wrong with this? > > >>>> d2_dt=numpy.dtype("4f8") >>>> d2_iter=itertools.cycle([(1.0,numpy.nan,1e10,14.0)]) >>>> numpy.fromiter(d2_iter,d2_dt,10) >>>> > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: a float is required > >>>> numpy.__version__ >>>> > '1.0b4' > > //Torgil > > > > On 8/30/06, Tim Hochberg <tim.hochberg@...> wrote: > >> Torgil Svensson wrote: >> >>>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >>>> >>>> >>> Is it possible for fromiter to take an optional shape (or count) >>> argument in addition to the dtype argument? >>> >> Yes. fromiter(iterable, dtype, count) works. >> >> >>> If both is given it could >>> preallocate memory and we only have to iterate over L once. >>> >>> >> Regardless, L is only iterated over once. In general you can't rewind >> iterators, so that's a requirement. This is accomplished by doing >> successive overallocation similar to the way appending to a list is >> handled. By specifying the count up front you save a bunch of reallocs, >> but no iteration. >> >> tim >> >> >> >> >>> //Torgil >>> >>> On 8/29/06, Keith Goodman <kwgoodman@...> wrote: >>> >>> >>>> On 8/29/06, Torgil Svensson <torgil.svensson@...> wrote: >>>> >>>> >>>>> something like this? >>>>> >>>>> def list2index(L): >>>>> uL=sorted(set(L)) >>>>> idx=dict((y,x) for x,y in enumerate(uL)) >>>>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) >>>>> >>>>> >>>> Wow. That's amazing. Thank you. >>>> >>>>  >>>> Using Tomcat but need to do more? Need to support web services, security? >>>> Get stuff done quickly with preintegrated technology to make your job easier >>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>>> http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>>> _______________________________________________ >>>> Numpydiscussion mailing list >>>> Numpydiscussion@... >>>> https://lists.sourceforge.net/lists/listinfo/numpydiscussion >>>> >>>> >>>> >>>  >>> Using Tomcat but need to do more? Need to support web services, security? >>> Get stuff done quickly with preintegrated technology to make your job easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >>> http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>> _______________________________________________ >>> Numpydiscussion mailing list >>> Numpydiscussion@... >>> https://lists.sourceforge.net/lists/listinfo/numpydiscussion >>> >>> >>> >>> >> >>  >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with preintegrated technology to make your job easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Numpydiscussion mailing list >> Numpydiscussion@... >> https://lists.sourceforge.net/lists/listinfo/numpydiscussion >> >> > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > 
From: Robert Kern <robert.kern@gm...>  20060831 18:35:58

Angelo Secchi wrote: > Hi, > I have the following script > > import fileinput > import string > from math import * > from scipy import * > from rpy import * > import Numeric > import shelve > import sys > > def dpolya1(n,N,b,a): > a=float(a) > b=float(b) > L=784 > probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L1)+Nn))(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(Nn+1)+special.gammaln(L*(a/b)(a/b))))#) > return probs > > and I observe the following "strange" (for me of course) behaviour > >>>> dpolya1(1,2,0.5,0.4) > 5.9741312822170585 >>>> type(dpolya1(1,2,0.5,0.4)) > <type 'float64scalar'> >>>> exp(dpolya1(1,2,0.5,0.4)) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > AttributeError: 'numpy.ndarray' object has no attribute 'exp' > > I do not understand what's wrong. Any help? Probably rpy (which still uses Numeric, right?) is exposing Numeric's exp() implementation and overriding the one that you got from scipy (which is numpy's, I presume). When Numeric's exp() is confronted with an object that it doesn't recognize, it looks for a .exp() method to call. If you want to avoid this situation in the future, don't use the "from foo import *" form. It makes debugging problems like this difficult.  Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth."  Umberto Eco 
From: Charles R Harris <charlesr.harris@gm...>  20060831 18:35:29

I submitted a ticket for this. On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > wrote the last email before reading your a = array([1,'A', None]) > comment. I definately agree with you on that. > > > On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > > > Yes one can take a toy example and hack it to work but I don't > > necessarily have control over the input as to whether it is a list of object > > arrays, list of 1d heterogenous arrays, etc. Before I didn't need to worry > > about the input because numpy understood that a list of 1d arrays is a > > 2d piece of data. Now it understands this for all dtypes except object. My > > question was is this new set of semantics preferable to the old. > > > > I think your example kind of proves my point. Does it really make any > > sense for the following two ways of specifying an array give such different > > results? They strike me as _meaning_ the same thing. Doesn't it seem > > inconsistent to you? > > > > > > In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some > > string'],dtype=object)], dtype=object).shape > > Out[13]: (2,) > > > > and > > > > In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some > > string'],dtype=object)]).shape > > Out[14]: (2, 3) > > So my question is what is the _advantage_ of the new semantics? The two > > examples above used to give the same results. In what cases is it > > preferable for them to give different results? How does it make life > > simpler? > > > > > > On 8/31/06, Charles R Harris <charlesr.harris@... > wrote: > > > > > On 8/31/06, Tom Denniston <tom.denniston@... > wrote: > > > > > But i have hetergenious arrays that have numbers and strings and > > > NoneType, etc. > > > > > > Take for instance: > > > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > > numpy.array([2,2,'Some string'])], dtype=object) > > > Out[11]: > > > array([[1, A, None], > > > [2, 2, Some string]], dtype=object) > > > > > > In [12]: numpy.array([ numpy.array([1,'A', None]), > > > numpy.array([2,2,'Some string'])], dtype=object).shape > > > Out[12]: (2, 3) > > > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > > get: > > > > > > I think you want: > > > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > > string'],dtype=object)]) > > > > In [60]: a.shape > > Out[60]: (2, 3) > > > > > > Which makes good sense to me. > > > > Chuck > > > > > > > > > > > > > >  > > Using Tomcat but need to do more? Need to support web services, > > security? > > Get stuff done quickly with preintegrated technology to make your job > > easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache > > Geronimo > > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > _______________________________________________ > > Numpydiscussion mailing list > > Numpydiscussion@... > > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > > > > > > > > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > 
From: Torgil Svensson <torgil.svensson@gm...>  20060831 18:25:15

def list2index(L): uL=sorted(set(L)) idx=dict((y,x) for x,y in enumerate(uL)) return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int,count=len(L))) adding the count will save you a little more time, and temporary memory [see related thread]. //Torgil On 8/29/06, Keith Goodman <kwgoodman@...> wrote: > On 8/29/06, Torgil Svensson <torgil.svensson@...> wrote: > > something like this? > > > > def list2index(L): > > uL=sorted(set(L)) > > idx=dict((y,x) for x,y in enumerate(uL)) > > return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > > Wow. That's amazing. Thank you. > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > 
From: Torgil Svensson <torgil.svensson@gm...>  20060831 18:21:54

> Yes. fromiter(iterable, dtype, count) works. Oh. Thanks. I probably had too old documentation to see this (15 June). If it's not updated since I'll give Travis a rest about this, at least until 1.0 is released :) > Regardless, L is only iterated over once. How can this be true? If no size is given, mustn't numpy either loop over L twice or build an internal representation on which it'll iterate or copy in chunks? I just found out that this works >>> import numpy,itertools >>> rec_dt=numpy.dtype(">i4,S10,f8") >>> rec_iter=itertools.cycle([(1,'s',4.0),(5,'y',190.0),(2,'h',8)]) >>> numpy.fromiter(rec_iter,rec_dt,10).view(recarray) recarray([(1, 's', 4.0), (5, 'y', 190.0), (2, 'h', 8.0), (1, 's', 4.0), (5, 'y', 190.0), (2, 'h', 8.0), (1, 's', 4.0), (5, 'y', 190.0), (2, 'h', 8.0), (1, 's', 4.0)], dtype=[('f0', '>i4'), ('f1', 'S10'), ('f2', '<f8')]) but what's wrong with this? >>> d2_dt=numpy.dtype("4f8") >>> d2_iter=itertools.cycle([(1.0,numpy.nan,1e10,14.0)]) >>> numpy.fromiter(d2_iter,d2_dt,10) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: a float is required >>> numpy.__version__ '1.0b4' //Torgil On 8/30/06, Tim Hochberg <tim.hochberg@...> wrote: > Torgil Svensson wrote: > >> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > >> > > > > Is it possible for fromiter to take an optional shape (or count) > > argument in addition to the dtype argument? > Yes. fromiter(iterable, dtype, count) works. > > > If both is given it could > > preallocate memory and we only have to iterate over L once. > > > Regardless, L is only iterated over once. In general you can't rewind > iterators, so that's a requirement. This is accomplished by doing > successive overallocation similar to the way appending to a list is > handled. By specifying the count up front you save a bunch of reallocs, > but no iteration. > > tim > > > > > //Torgil > > > > On 8/29/06, Keith Goodman <kwgoodman@...> wrote: > > > >> On 8/29/06, Torgil Svensson <torgil.svensson@...> wrote: > >> > >>> something like this? > >>> > >>> def list2index(L): > >>> uL=sorted(set(L)) > >>> idx=dict((y,x) for x,y in enumerate(uL)) > >>> return uL,asmatrix(fromiter((idx[x] for x in L),dtype=int)) > >>> > >> Wow. That's amazing. Thank you. > >> > >>  > >> Using Tomcat but need to do more? Need to support web services, security? > >> Get stuff done quickly with preintegrated technology to make your job easier > >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > >> http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >> _______________________________________________ > >> Numpydiscussion mailing list > >> Numpydiscussion@... > >> https://lists.sourceforge.net/lists/listinfo/numpydiscussion > >> > >> > > > >  > > Using Tomcat but need to do more? Need to support web services, security? > > Get stuff done quickly with preintegrated technology to make your job easier > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Numpydiscussion mailing list > > Numpydiscussion@... > > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > > > > > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > 
From: Angelo Secchi <secchi@ss...>  20060831 18:13:47

Hi, I have the following script import fileinput import string from math import * from scipy import * from rpy import * import Numeric import shelve import sys def dpolya1(n,N,b,a): a=float(a) b=float(b) L=784 probs=((special.gammaln(N+1)+special.gammaln(L*(a/b))+special.gammaln((a/b)+n)+special.gammaln((a/b)*(L1)+Nn))(special.gammaln(L*(a/b)+N)+special.gammaln(a/b)+special.gammaln(n+1)+special.gammaln(Nn+1)+special.gammaln(L*(a/b)(a/b))))#) return probs and I observe the following "strange" (for me of course) behaviour >>> dpolya1(1,2,0.5,0.4) 5.9741312822170585 >>> type(dpolya1(1,2,0.5,0.4)) <type 'float64scalar'> >>> exp(dpolya1(1,2,0.5,0.4)) Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'numpy.ndarray' object has no attribute 'exp' I do not understand what's wrong. Any help? Thanks Angelo 
From: Tom Denniston <tom.denniston@al...>  20060831 18:11:31

wrote the last email before reading your a = array([1,'A', None]) comment. I definately agree with you on that. On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > Yes one can take a toy example and hack it to work but I don't > necessarily have control over the input as to whether it is a list of object > arrays, list of 1d heterogenous arrays, etc. Before I didn't need to worry > about the input because numpy understood that a list of 1d arrays is a > 2d piece of data. Now it understands this for all dtypes except object. My > question was is this new set of semantics preferable to the old. > > I think your example kind of proves my point. Does it really make any > sense for the following two ways of specifying an array give such different > results? They strike me as _meaning_ the same thing. Doesn't it seem > inconsistent to you? > > > In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some > string'],dtype=object)], dtype=object).shape > Out[13]: (2,) > > and > > In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some > string'],dtype=object)]).shape > Out[14]: (2, 3) > So my question is what is the _advantage_ of the new semantics? The two > examples above used to give the same results. In what cases is it > preferable for them to give different results? How does it make life > simpler? > > > On 8/31/06, Charles R Harris <charlesr.harris@...> wrote: > > > On 8/31/06, Tom Denniston <tom.denniston@... > wrote: > > > But i have hetergenious arrays that have numbers and strings and > > NoneType, etc. > > > > Take for instance: > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object) > > Out[11]: > > array([[1, A, None], > > [2, 2, Some string]], dtype=object) > > > > In [12]: numpy.array([ numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object).shape > > Out[12]: (2, 3) > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > get: > > > I think you want: > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > string'],dtype=object)]) > > In [60]: a.shape > Out[60]: (2, 3) > > > Which makes good sense to me. > > Chuck > > > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > > > 
From: Tom Denniston <tom.denniston@al...>  20060831 18:08:24

Yes one can take a toy example and hack it to work but I don't necessarily have control over the input as to whether it is a list of object arrays, list of 1d heterogenous arrays, etc. Before I didn't need to worry about the input because numpy understood that a list of 1d arrays is a 2d piece of data. Now it understands this for all dtypes except object. My question was is this new set of semantics preferable to the old. I think your example kind of proves my point. Does it really make any sense for the following two ways of specifying an array give such different results? They strike me as _meaning_ the same thing. Doesn't it seem inconsistent to you? In [13]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)], dtype=object).shape Out[13]: (2,) and In [14]: array([array([1,'A', None], dtype=object),array([2,2,'Some string'],dtype=object)]).shape Out[14]: (2, 3) So my question is what is the _advantage_ of the new semantics? The two examples above used to give the same results. In what cases is it preferable for them to give different results? How does it make life simpler? On 8/31/06, Charles R Harris <charlesr.harris@...> wrote: > On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > > But i have hetergenious arrays that have numbers and strings and > > NoneType, etc. > > > > Take for instance: > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object) > > Out[11]: > > array([[1, A, None], > > [2, 2, Some string]], dtype=object) > > > > In [12]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object).shape > > Out[12]: (2, 3) > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > get: > > > I think you want: > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > string'],dtype=object)]) > > In [60]: a.shape > Out[60]: (2, 3) > > > Which makes good sense to me. > > Chuck > > > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > 
From: Charles R Harris <charlesr.harris@gm...>  20060831 17:57:53

On 8/31/06, Charles R Harris <charlesr.harris@...> wrote: > > On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > > But i have hetergenious arrays that have numbers and strings and > > NoneType, etc. > > > > Take for instance: > > > > In [11]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object) > > Out[11]: > > array([[1, A, None], > > [2, 2, Some string]], dtype=object) > > > > In [12]: numpy.array([numpy.array([1,'A', None]), > > numpy.array([2,2,'Some string'])], dtype=object).shape > > Out[12]: (2, 3) > > > > Works fine in Numeric and pre beta numpy but in beta numpy versions i > > get: > > > I think you want: > > In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some > string'],dtype=object)]) > > In [60]: a.shape > Out[60]: (2, 3) > > Which makes good sense to me. > OK, I changed my mind. I think you are right and this is a bug. Using svn revision 3098 I get In [2]: a = array([1,'A', None])  exceptions.TypeError Traceback (most recent call last) /home/charris/<ipython console> TypeError: expected a readable buffer object Which is different than you get with beta 1 in any case. I think array should cast the objects in the list to the first common dtype, object in this case. So the previous should be shorthand for: In [3]: a = array([1,'A', None], dtype=object) In [4]: a.shape Out[4]: (3,) Chuck 
From: Charles R Harris <charlesr.harris@gm...>  20060831 17:36:19

On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > But i have hetergenious arrays that have numbers and strings and NoneType, > etc. > > Take for instance: > > In [11]: numpy.array([numpy.array([1,'A', None]), > numpy.array([2,2,'Some string'])], dtype=object) > Out[11]: > array([[1, A, None], > [2, 2, Some string]], dtype=object) > > In [12]: numpy.array([numpy.array([1,'A', None]), > numpy.array([2,2,'Some string'])], dtype=object).shape > Out[12]: (2, 3) > > Works fine in Numeric and pre beta numpy but in beta numpy versions i get: I think you want: In [59]: a = array([array([1,'A', None],dtype=object),array([2,2,'Some string'],dtype=object)]) In [60]: a.shape Out[60]: (2, 3) Which makes good sense to me. Chuck 
From: Charles R Harris <charlesr.harris@gm...>  20060831 17:26:19

On 8/31/06, Christopher Barker <Chris.Barker@...> wrote: > > Fernando Perez wrote: > > In [8]: N.array(3).shape > > Out[8]: () > > > In [11]: N.array([]).shape > > Out[11]: (0,) > > > I guess my only remaining question is: what is the difference between > > outputs #8 and #11 above? Is an empty shape tuple == array scalar, > > while a (0,) shape indicates a onedimensional array with no elements? > > If this interpretation is correct, what is the usage of the latter > > kind of object, given how it can't even be indexed? > > It can be iterated over (with zero iterations): > > >>> a = N.array([]) > >>> for i in a: > ... print i > ... > > whereas the scalar can not: > > >>> b = N.array(3) > >>> b > array(3) > >>> for i in b: > ... print i > ... > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: iteration over a scalar (0dim array) > > Of course the scalar isn't empty, so ti's different in that way too. Can > there be an empty scalar? It doesn't look like it. In fact, this looks > like it may be a bug: > >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a > () > 1 > 6 > > That's what I'd expect, but what if you start with a (0,) array: > >>> a = N.array([]).sum(); a.shape; a.size; a > () > 1 > 0 > > where did that zero come from? I think that is correct, sums over empty sets are conventionally set to zero because they are conceived of as adding all the values in the set to zero. Typically this would be implemented as sum = 0 for i in set : sum += i; Chuck 
From: Tom Denniston <tom.denniston@al...>  20060831 17:00:09

But i have hetergenious arrays that have numbers and strings and NoneType, etc. Take for instance: In [11]: numpy.array([numpy.array([1,'A', None]), numpy.array([2,2,'Some string'])], dtype=object) Out[11]: array([[1, A, None], [2, 2, Some string]], dtype=object) In [12]: numpy.array([numpy.array([1,'A', None]), numpy.array([2,2,'Some string'])], dtype=object).shape Out[12]: (2, 3) Works fine in Numeric and pre beta numpy but in beta numpy versions i get: In [6]: numpy.array([numpy.array([1,'A', None]), numpy.array([2,2,'Some string'])], dtype=object) Out[6]: array([[1 A None], [2 2 Some string]], dtype=object) In [7]: numpy.array([numpy.array([1,'A', None]), numpy.array([2,2,'Some string'])], dtype=object).shape Out[7]: (2,) But a lists of lists still gives: In [9]: numpy.array([[1,'A', None], [2,2,'Some string']], dtype=object).shape Out[9]: (2, 3) And if you omit the dtype and use a list of arrays then you get a string array with 2,3 dimensions: In [11]: numpy.array([numpy.array([1,'A', None]), numpy.array([2,2,'Some string'])]).shape Out[11]: (2, 3) This new behavior strikes me as inconsistent. One of the things I love about numpy is the ufuncs, array constructors, etc don't care about whether you pass a combination of lists, arrays, tuples, etc. They just know what you _mean_. And what you _mean_ by a list of lists, tuple of arrays, list of arrays, etc is very consistent across constructors and functions. I think making an exception for dtype=object introduces a lot of inconsistencies and it isn't clear to me what is gained. Does anyone commonly use the array interface in a manner that this new behavior is actuallly favorable? I may be overlooking a common use case or something like that. On 8/31/06, Charles R Harris <charlesr.harris@...> wrote: > > > > On 8/31/06, Tom Denniston > <tom.denniston@...> wrote: > > > > For this simple example yes, but if one of the nice things about the array > constructors is that they know that lists, tuple and arrays are just > sequences and any combination of them is valid numpy input. So for instance > a list of tuples yields a 2d array. A list of tuples of 1d arrays yields a > 3d array. A list of 1d arrays yields 2d array. This was the case > consistently across all dtypes. Now it is the case across all of them > except for the dtype=object which has this unusual behavior. I agree that > vstack is a better choice when you know you have a list of arrays but it is > less useful when you don't know and you can't force a type in the vstack > function so there is no longer an equivalent to the dtype=object behavior: > > > > In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])], > dtype=object) > > Out[7]: > > array([[1, 2, 3], > > [4, 5, 6]], dtype=object) > > > What are you trying to do? If you want integers: > > In [32]: a = array([array([1,2,3]), array([4,5,6])], dtype=int) > > In [33]: a.shape > Out[33]: (2, 3) > > > If you want objects, you have them: > > In [30]: a = array([array([1,2,3]), array([4,5,6])], dtype=object) > > In [31]: a.shape > Out[31]: (2,) > > i.e, a is an array containing two array objects. > > Chuck > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > 
From: Tim Hochberg <tim.hochberg@ie...>  20060831 16:57:42

Christopher Barker wrote: > Fernando Perez wrote: > >> In [8]: N.array(3).shape >> Out[8]: () >> > > >> In [11]: N.array([]).shape >> Out[11]: (0,) >> > > >> I guess my only remaining question is: what is the difference between >> outputs #8 and #11 above? Is an empty shape tuple == array scalar, >> while a (0,) shape indicates a onedimensional array with no elements? >> If this interpretation is correct, what is the usage of the latter >> kind of object, given how it can't even be indexed? >> > > It can be iterated over (with zero iterations): > > >>> a = N.array([]) > >>> for i in a: > ... print i > ... > > whereas the scalar can not: > > >>> b = N.array(3) > >>> b > array(3) > >>> for i in b: > ... print i > ... > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: iteration over a scalar (0dim array) > > Of course the scalar isn't empty, so ti's different in that way too. Can > there be an empty scalar? It doesn't look like it. In fact, this looks > like it may be a bug: > >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a > () > 1 > 6 > > That's what I'd expect, but what if you start with a (0,) array: > >>> a = N.array([]).sum(); a.shape; a.size; a > () > 1 > 0 > > where did that zero come from? > More or less from: >>> numpy.add.identity 0 All the ufuncs have an identity function that they use as a starting point for reduce and accumulate. Sum doesn't appear to actually ahve one, but since it's more or less the same as add.reduce it's probably good that it has the same behavior. Note that this also matches the behavior of python's built in sum, although there the identity is called 'start'. tim > >>> N.__version__ > '1.0b4' > > Chris > > > > 
From: Charles R Harris <charlesr.harris@gm...>  20060831 16:51:06

On 8/31/06, Christopher Barker <Chris.Barker@...> wrote: > > Jonathan Taylor wrote: > > When trying to install 1.0b4 I had trouble getting it to detect my > > installed atlas. This was because the shipped site.cfg had; > > > > [atlas] > > library_dirs = /usr/lib/atlas/3dnow/ > > atlas_libs = lapack, blas > > > > but I had to change 3dnow to sse2 due to my current state of > > pentiumness. In any case it should probabally look in all the > > possible locations instead of just AMD's location. > > "All possible locations" is pretty much impossible. There really isn't > any choice but for individuals to customize site.cfg for their setup. > that's why it's called "site".cfg. > > I would like to see a pretty good collection of examples, most of them > commented out, in there, however. i.e.: I need this on fc5 x86_64 [atlas] library_dirs = /usr/lib64/atlas atlas_libs = lapack, blas, cblas, atlas I think this should be automatic. Apart from debian, the /usr/lib64 directory is pretty much standard for 64bit linux distros. Chuck 
From: Christopher Barker <Chris.Barker@no...>  20060831 16:46:16

Fernando Perez wrote: > In [8]: N.array(3).shape > Out[8]: () > In [11]: N.array([]).shape > Out[11]: (0,) > I guess my only remaining question is: what is the difference between > outputs #8 and #11 above? Is an empty shape tuple == array scalar, > while a (0,) shape indicates a onedimensional array with no elements? > If this interpretation is correct, what is the usage of the latter > kind of object, given how it can't even be indexed? It can be iterated over (with zero iterations): >>> a = N.array([]) >>> for i in a: ... print i ... whereas the scalar can not: >>> b = N.array(3) >>> b array(3) >>> for i in b: ... print i ... Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: iteration over a scalar (0dim array) Of course the scalar isn't empty, so ti's different in that way too. Can there be an empty scalar? It doesn't look like it. In fact, this looks like it may be a bug: >>> a = N.array([1,2,3]).sum(); a.shape; a.size; a () 1 6 That's what I'd expect, but what if you start with a (0,) array: >>> a = N.array([]).sum(); a.shape; a.size; a () 1 0 where did that zero come from? >>> N.__version__ '1.0b4' Chris  Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 5266959 voice 7600 Sand Point Way NE (206) 5266329 fax Seattle, WA 98115 (206) 5266317 main reception Chris.Barker@... 
From: Christopher Barker <Chris.Barker@no...>  20060831 16:36:28

Jonathan Taylor wrote: > When trying to install 1.0b4 I had trouble getting it to detect my > installed atlas. This was because the shipped site.cfg had; > > [atlas] > library_dirs = /usr/lib/atlas/3dnow/ > atlas_libs = lapack, blas > > but I had to change 3dnow to sse2 due to my current state of > pentiumness. In any case it should probabally look in all the > possible locations instead of just AMD's location. "All possible locations" is pretty much impossible. There really isn't any choice but for individuals to customize site.cfg for their setup. that's why it's called "site".cfg. I would like to see a pretty good collection of examples, most of them commented out, in there, however. i.e.: ## for AMD atlas: #library_dirs = /usr/lib/atlas/3dnow/ #atlas_libs = lapack, blas ## for Fedora Core 4 sse2 atlas: #library_dirs = /usr/lib/sse2/ #atlas_libs = lapack, blas etc, etc. Chris  Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 5266959 voice 7600 Sand Point Way NE (206) 5266329 fax Seattle, WA 98115 (206) 5266317 main reception Chris.Barker@... 
From: Charles R Harris <charlesr.harris@gm...>  20060831 16:24:41

On 8/31/06, Tom Denniston <tom.denniston@...> wrote: > > For this simple example yes, but if one of the nice things about the array > constructors is that they know that lists, tuple and arrays are just > sequences and any combination of them is valid numpy input. So for instance > a list of tuples yields a 2d array. A list of tuples of 1d arrays yields a > 3d array. A list of 1d arrays yields 2d array. This was the case > consistently across all dtypes. Now it is the case across all of them > except for the dtype=object which has this unusual behavior. I agree that > vstack is a better choice when you know you have a list of arrays but it is > less useful when you don't know and you can't force a type in the vstack > function so there is no longer an equivalent to the dtype=object behavior: > > In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])], > dtype=object) > Out[7]: > array([[1, 2, 3], > [4, 5, 6]], dtype=object) > What are you trying to do? If you want integers: In [32]: a = array([array([1,2,3]), array([4,5,6])], dtype=int) In [33]: a.shape Out[33]: (2, 3) If you want objects, you have them: In [30]: a = array([array([1,2,3]), array([4,5,6])], dtype=object) In [31]: a.shape Out[31]: (2,) i.e, a is an array containing two array objects. Chuck 
From: Tom Denniston <tom.denniston@al...>  20060831 15:59:41

For this simple example yes, but if one of the nice things about the array constructors is that they know that lists, tuple and arrays are just sequences and any combination of them is valid numpy input. So for instance a list of tuples yields a 2d array. A list of tuples of 1d arrays yields a 3d array. A list of 1d arrays yields 2d array. This was the case consistently across all dtypes. Now it is the case across all of them except for the dtype=object which has this unusual behavior. I agree that vstack is a better choice when you know you have a list of arrays but it is less useful when you don't know and you can't force a type in the vstack function so there is no longer an equivalent to the dtype=object behavior: In [7]: numpy.array([numpy.array([1,2,3]), numpy.array([4,5,6])], dtype=object) Out[7]: array([[1, 2, 3], [4, 5, 6]], dtype=object) In [8]: numpy.vstack([numpy.array([1,2,3]), numpy.array([4,5,6])], dtype=object)  exceptions.TypeError Traceback (most recent call last) TypeError: vstack() got an unexpected keyword argument 'dtype' On 8/31/06, Charles R Harris <charlesr.harris@...> wrote: > On 8/31/06, Tom Denniston > <tom.denniston@...> wrote: > > > In version 0.9.6 one used to be able to do this: > > > > In [4]: numpy.__version__ > > Out[4]: '0.9.6' > > > > > > In [6]: numpy.array([numpy.array([4,5,6]), numpy.array([1,2,3])], > > dtype=object).shape > > Out[6]: (2, 3) > > > > > > In beta 1 numpy.PyObject no longer exists. I was trying to get the > > same behavior with dtype=object but it doesn't work: > > > > In [7]: numpy.__version__ > > Out[7]: '1.0b1' > > > > In [8]: numpy.array([numpy.array ([4,5,6]), numpy.array([1,2,3])], > > dtype=object).shape > > Out[8]: (2,) > > > The latter looks more correct, in that is produces an array of objects. To > get the previous behaviour there is the function vstack: > > In [6]: a = array([1,2,3]) > > In [7]: b = array([4,5,6]) > > In [8]: vstack([a,b]) > Out[8]: > array([[1, 2, 3], > [4, 5, 6]]) > > Chuck > > > >  > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with preintegrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.asus.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion > > > 