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: Todd M. <jm...@st...> - 2004-05-13 12:41:55
|
On Wed, 2004-05-12 at 19:54, Russell E Owen wrote: > I modified an existing numeric c extension today, adding a function > that returns a new array. This is the first time I've used > NA_NewArray. The code seems to run fine, but I get a disturbing > compiler warning: > > [rowen:Shared Files/Guider/PyGuide] rowen% python setup.py build > ... > src/radProfModule.c: In function `Py_radSqByRadInd': > src/radProfModule.c:378: warning: return from incompatible pointer type > > The associated code can be summarized as follows (and it is simple > enough that I've also appended a copy). The error is thrown on the > last line: > > static PyObject *Py_radSqByRadInd(PyObject *self, PyObject *args) { > long nElt; > Long *radSqByRadInd; > > if (!PyArg_ParseTuple(args, "l", &nElt)) > return NULL; > ... > return NA_NewArray((void *)radSqByRadInd, tLong, 1, nElt); > } > > So...am I actually doing something wrong, or is this warning normal? The problem is that your function returns a PyObject* but NA_NewArray returns a PyArrayObject*. This particular "error" is generally harmless since all that is really in conflict is the compiler's view of the same memory address. You can eliminate the warning by sticking in a cast to PyObject* like this: return (PyObject *) NA_NewArray((void *)radSqByRadInd, tLong, 1, nElt); Regards, Todd > > > -- Russell > > P.S. the full code: > > static PyObject *Py_radSqByRadInd(PyObject *self, PyObject *args) { > long nElt; > Long radInd; > char ModName[] = "radSqByRadInd"; > Long *radSqByRadInd; > > if (!PyArg_ParseTuple(args, "l", &nElt)) > return NULL; > > if (nElt < 0) { > PyErr_Format(PyExc_ValueError, "%s: nPts < 0", ModName); > return NULL; > } > > // allocate max(3, nElt) elements (simplifies the computation > // and avoids calling calloc on 0 elements) > radSqByRadInd = calloc(MAX(nElt, 3), sizeof *radSqByRadInd); > if (radSqByRadInd == NULL) { > PyErr_Format(PyExc_MemoryError, "%s: insufficient > memory", ModName); > return NULL; > } > > for (radInd=0; radInd<3; radInd++) { > radSqByRadInd[radInd] = radInd; > } > for (radInd=3; radInd<nElt; radInd++) { > radSqByRadInd[radInd] = (radInd - 1) * (radInd - 1); > } > > return NA_NewArray((void *)radSqByRadInd, tLong, 1, nElt); > } > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jm...@st...> |
From: T. C. <al...@an...> - 2004-05-13 11:48:29
|
Hi, I cannot understand why I do receive these warnings: Warning: Encountered invalid numeric result(s) in sqrt Warning: Encountered invalid numeric result(s) in divide after >>> newtimes =3D where(logical_and(RV<0,discr>0), (-RV-sqrt(discr))/VV, far= _future) RV, discr, RR, VV are NxN arrays of reals (Float64), while far_future=3D1e20 (scalar). 1. sqrt(<0) should be impossible, since it's explicitly ruled out that discr<0 in the where condition. 2. /0 should also be impossible, since VV=3D=3D0 is True only for the diagonal... I've done some testing and where(logical_and(RV<0, discr>0), discr, 666) doesn't show any negative numbers, neither does where(logical_and(RV<0,discr>0),VV,666) show any zeroes... =09 Please.. what am I doing wrong here? --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |
From: T. C. <al...@an...> - 2004-05-13 11:06:38
|
I have a matrix of particle collision times: times[i,j] gives the time for particle "i" to collide with particle "j". If I do, in order to get the first expected collision time for each particle, the following (random array for testing purposes) : >>> N=3D30 >>> times =3D rnd.random([N,N]) >>> choose(argmin(times,transpose(times)) Segmentation fault (of the python interactive shell!!!) With N=3D100 I get a more informative traceback, and rest within the shell: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 1670, in = choose return _choose(selector, population, outarr, clipmode) File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 1579, in = __call__ result =3D self._doit(computation_mode, woutarr, cfunc, ufargs, 0) File "/usr/lib/python2.3/site-packages/numarray/ufunc.py", line 1564, in = _doit blockingparameters) ValueError: _operator_compute: too many inputs + outputs For N=3D10,N=3D15 I get the expected output, but for N=3D20 I get again the brutal segfault... regards,=20 =E1. --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |
From: T. C. <al...@an...> - 2004-05-13 10:31:11
|
Hello, (for background, I am trying to get an array of interparticle distances, in which calculation of supradiagonal elements is unneeded because of symmetry. I am not doing anything about this now, though). >>> import numarray.random_array as rdn >>> N, D =3D 1000, 3 #number of particles and dimensions of space >>> r =3D rnd.random([N,D]) # r[i] gives the D coordinates of particle i # r[:,0] gives the all the x coordinates What I was doing: >>> r_rel =3D [[r[i]-r[j] for i in arange(N)] for j in arange N] now Tim says: > Try this: >=20 > >>> import numarray as na > >>> r =3D na.arange(5) > >>> na.subtract.outer(r, r) > array([[ 0, -1, -2, -3, -4], > [ 1, 0, -1, -2, -3], > [ 2, 1, 0, -1, -2], > [ 3, 2, 1, 0, -1], > [ 4, 3, 2, 1, 0]]) >=20 but this gives >>> subtract.outer(r,r).shape (10, 3, 10, 3) that is, subtracts y coordinates to x coordinates which is not intended. AFAIK the outer solution is MUCH faster than the nested for loops, so what I do now is >>> r_rel =3D transpose(array([subtract.outer(r[:,0],r[:,0]), subtract.outer(r[:,1],r[:,1]),=20 subtract.outer(r[:,2],r[:,2])])) >>> r_rel.shape #as with the double loop=20 (10,10,3)=20 My question is then if there is any more elegant way to do this, especially giving as a result independence of the number of dimensions). Maybe an "axis" (=3D0 in this case?) keyword for the outer function would be useful in this context? Thanks for the helpful welcome to the list!, =E1. PS. the problem with the min() function regarded a matrix of collision times between particles, which is symmetrical. The elements are reals, so I only expect to find one minimum. --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |
From: Robert K. <rk...@uc...> - 2004-05-13 00:27:44
|
Perry Greenfield wrote: > =C1lvaro Tejero Cantero wrote: >=20 >>It works great... but what about efficiency? If I do times.min() and >>then numarray.nd_image.minimum_positioan(times) I am running twice >>essentially the same extremum-finding routine, which is prohibitibe for >>large N..., am I right? >> >=20 > Well, yes. But when you ask to find all the things that equal > the minimum, you pretty much must look twice (if you want to know > where they all are if more than one). Once to determine the > minimum, the next time to locate all of them. Nah, you can accumulate indices corresponding to the current minimum=20 value as you go. Discard the list of indices and start again if you get=20 a new minimum value. minval =3D data[0] # let's suppose data is a vector for demonstration minindices =3D [0] for i in xrange(1, len(data)): x =3D data[i] if x < minval: minindices =3D [i] minval =3D x elif x =3D=3D minval: minindices.append(i) Whether or not this is faster (when implemented in C) than going over it=20 twice using numarray functions is another question. My guess: not enough. [snip] >>Yes... although for the problem at hand that motivated my query, my >>times matrix is symmetric... I don't really need all the minima, but >>does numarray have any special datatype for symmetric matrixes, that >>prevents storage of unneded (e.g. supradiagonal) elements?. >> >=20 > Not for special cases like this. One could probably write a special > subclass to do this, but for a savings of a factor of 2 in memory, > it usually would not be worth the trouble (unlike sparse matrices) OTOH, having subclasses that follow LAPACK's symmetric packed storage=20 scheme would be very useful not because of the space factor but the time=20 saved by being able to use the symmetric algorithms in LAPACK. I think. > Perry --=20 Robert Kern rk...@uc... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
From: Russell E O. <ow...@as...> - 2004-05-12 23:59:00
|
I modified an existing numeric c extension today, adding a function that returns a new array. This is the first time I've used NA_NewArray. The code seems to run fine, but I get a disturbing compiler warning: [rowen:Shared Files/Guider/PyGuide] rowen% python setup.py build ... src/radProfModule.c: In function `Py_radSqByRadInd': src/radProfModule.c:378: warning: return from incompatible pointer type The associated code can be summarized as follows (and it is simple enough that I've also appended a copy). The error is thrown on the last line: static PyObject *Py_radSqByRadInd(PyObject *self, PyObject *args) { long nElt; Long *radSqByRadInd; if (!PyArg_ParseTuple(args, "l", &nElt)) return NULL; ... return NA_NewArray((void *)radSqByRadInd, tLong, 1, nElt); } So...am I actually doing something wrong, or is this warning normal? -- Russell P.S. the full code: static PyObject *Py_radSqByRadInd(PyObject *self, PyObject *args) { long nElt; Long radInd; char ModName[] = "radSqByRadInd"; Long *radSqByRadInd; if (!PyArg_ParseTuple(args, "l", &nElt)) return NULL; if (nElt < 0) { PyErr_Format(PyExc_ValueError, "%s: nPts < 0", ModName); return NULL; } // allocate max(3, nElt) elements (simplifies the computation // and avoids calling calloc on 0 elements) radSqByRadInd = calloc(MAX(nElt, 3), sizeof *radSqByRadInd); if (radSqByRadInd == NULL) { PyErr_Format(PyExc_MemoryError, "%s: insufficient memory", ModName); return NULL; } for (radInd=0; radInd<3; radInd++) { radSqByRadInd[radInd] = radInd; } for (radInd=3; radInd<nElt; radInd++) { radSqByRadInd[radInd] = (radInd - 1) * (radInd - 1); } return NA_NewArray((void *)radSqByRadInd, tLong, 1, nElt); } |
From: Perry G. <pe...@st...> - 2004-05-12 22:10:36
|
Álvaro Tejero Cantero wrote: > > It works great... but what about efficiency? If I do times.min() and > then numarray.nd_image.minimum_positioan(times) I am running twice > essentially the same extremum-finding routine, which is prohibitibe for > large N..., am I right? > Well, yes. But when you ask to find all the things that equal the minimum, you pretty much must look twice (if you want to know where they all are if more than one). Once to determine the minimum, the next time to locate all of them. You didn't really say whether you needed just the first minimum or all minima (if I recall correctly). > Which makes me thing of a more general question: I know that some of the > array functions are coded in C for speed, but what about the classical > python-for loop, as in (r Nx3 array of particle positions) > > [ [r[i]-r[j] for i in arange(N)] for j in arange(N)] > > is this handled to C code? > As Tim mentions, yes this can be done efficiently. But there is no general answer this sort of open question. It depends on what you are doing. Sometimes there are functions or tricks to avoid loops in Python, sometimes not. > > Yes... although for the problem at hand that motivated my query, my > times matrix is symmetric... I don't really need all the minima, but > does numarray have any special datatype for symmetric matrixes, that > prevents storage of unneded (e.g. supradiagonal) elements?. > Not for special cases like this. One could probably write a special subclass to do this, but for a savings of a factor of 2 in memory, it usually would not be worth the trouble (unlike sparse matrices) Perry |
From: Tim H. <tim...@co...> - 2004-05-12 21:33:48
|
Álvaro Tejero Cantero wrote: >Hello, > > > >>To find the index of ONE minimum value is easy, >>though it is buried in the nd_image sub-package >>(where many users might miss it): >>numarray.nd_image.minimum_position >> >> > >It works great... but what about efficiency? If I do times.min() and >then numarray.nd_image.minimum_positioan(times) I am running twice >essentially the same extremum-finding routine, which is prohibitibe for >large N..., am I right? > >Which makes me thing of a more general question: I know that some of the >array functions are coded in C for speed, but what about the classical >python-for loop, as in (r Nx3 array of particle positions) > >[ [r[i]-r[j] for i in arange(N)] for j in arange(N)] > >is this handled to C code? > > Try this: >>> import numarray as na >>> r = na.arange(5) >>> na.subtract.outer(r, r) array([[ 0, -1, -2, -3, -4], [ 1, 0, -1, -2, -3], [ 2, 1, 0, -1, -2], [ 3, 2, 1, 0, -1], [ 4, 3, 2, 1, 0]]) Look up the special methods on ufuncs (outer, reduce, etc) for more details. >>I do not know a clean way to find all locations >>of the minimum value. I hope somebody else does. >> >> > >Yes... although for the problem at hand that motivated my query, my >times matrix is symmetric... I don't really need all the minima, but >does numarray have any special datatype for symmetric matrixes, that >prevents storage of unneded (e.g. supradiagonal) elements?. > > Not that I know of. -tim > >Thank you very much, I'm on my way to get some beautiful code out of old >fortranisms > >á. > > |
From: T. C. <al...@an...> - 2004-05-12 21:22:09
|
Hello, > To find the index of ONE minimum value is easy,=20 > though it is buried in the nd_image sub-package=20 > (where many users might miss it): > numarray.nd_image.minimum_position It works great... but what about efficiency? If I do times.min() and then numarray.nd_image.minimum_positioan(times) I am running twice essentially the same extremum-finding routine, which is prohibitibe for large N..., am I right? Which makes me thing of a more general question: I know that some of the array functions are coded in C for speed, but what about the classical python-for loop, as in (r Nx3 array of particle positions) [ [r[i]-r[j] for i in arange(N)] for j in arange(N)] is this handled to C code? > I do not know a clean way to find all locations=20 > of the minimum value. I hope somebody else does. Yes... although for the problem at hand that motivated my query, my times matrix is symmetric... I don't really need all the minima, but does numarray have any special datatype for symmetric matrixes, that prevents storage of unneded (e.g. supradiagonal) elements?. Thank you very much, I'm on my way to get some beautiful code out of old fortranisms=20 =E1. --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |
From: Tim H. <tim...@co...> - 2004-05-12 20:13:48
|
Álvaro Tejero Cantero wrote: >Hello, > >I am new to numarray. I have been searching the documentation, and see >no evident vectorial and concise way to get the indexes for the minimum >of an array times.min(). > > If I understand your question correctly, you want argmin: >>> import numarray as na >>> from numarray import random_array >>> times = random_array.randint(0, 16, [4,4]) >>> times array([[15, 3, 11, 10], [ 1, 1, 15, 7], [ 4, 3, 5, 6], [10, 15, 12, 3]]) >>> na.argmin(times) # Takes min along axis 0 array([1, 1, 2, 3]) >>> na.argmin(times, 1) # Take min along axis 1 array([1, 1, 1, 3]) -tim >Currently my two alternatives are: (times is NxN array) > >husband, wife = nonzero(equal(times.min(),times)) >#gives tuple of 1x1 arrays, each containing one index > >and (even uglier) > >husband = compress(times.min()==times,indices([N,N])[0]) >wife = compress(times.min()==times,indices([N,N])[1]) > >These are weird ways to get something as simple. I am surely missing >something, but I have tried several slicing strategies before without >success. > >For getting the minimum times in each row I use: > >choose(argmin(times),transpose(times)) > >What are the idioms in numpy for these tasks? > > >Thank you very much in advance, á. > >I would > > > |
From: Russell E O. <ow...@as...> - 2004-05-12 19:55:32
|
At 9:51 PM +0200 5/12/04, =C1lvaro Tejero Cantero wrote: >I am new to numarray. I have been searching the documentation, and see >no evident vectorial and concise way to get the indexes for the minimum >of an array times.min(). To find the index of ONE minimum value is easy,=20 though it is buried in the nd_image sub-package=20 (where many users might miss it): numarray.nd_image.minimum_position I do not know a clean way to find all locations=20 of the minimum value. I hope somebody else does. -- Russell |
From: T. C. <al...@an...> - 2004-05-12 19:44:59
|
Hello, I am new to numarray. I have been searching the documentation, and see no evident vectorial and concise way to get the indexes for the minimum of an array times.min(). Currently my two alternatives are: (times is NxN array) husband, wife =3D nonzero(equal(times.min(),times))=20 #gives tuple of 1x1 arrays, each containing one index and (even uglier) husband =3D compress(times.min()=3D=3Dtimes,indices([N,N])[0]) wife =3D compress(times.min()=3D=3Dtimes,indices([N,N])[1]) These are weird ways to get something as simple. I am surely missing something, but I have tried several slicing strategies before without success. For getting the minimum times in each row I use: choose(argmin(times),transpose(times)) What are the idioms in numpy for these tasks? Thank you very much in advance, =E1. I would=20 --=20 =C1lvaro Tejero Cantero http://alqua.org -- documentos libres free documents |
From: Paulo J. S. S. <rs...@im...> - 2004-05-12 10:45:35
|
Karthik, You are making a common mistake. In Mathematics, the "transpose" of a matrix is just the matrix with the axis transposed like numarray/numeric does. What you called transpose is actually the "adjoint" or "conjugate transpose" of a matrix. Actually, this last operation (the adjoint) is the most interesting one in Linear Algebra/Functional Analysis. For more details take a look at: http://en.wikipedia.org/wiki/Conjugate_transpose http://en.wikipedia.org/wiki/Transpose In the reals both operations coincide, thus the confusion. This is the reason why matlab can use the same symbol for both operations. Now, enough Mathematics, let's go to numarray. To get the adjoint of a matrix A in numarray, you can simply do: conjugate(transpose(A)) If you want, you may define a function named adjoint to perform the above operations. Note that this creates a new matrix, not only a new view of the original matrix like "transpose" function in numarray. Hope it helps, Paulo -- Paulo José da Silva e Silva Professor Assistente do Dep. de Ciência da Computação (Assistant Professor of the Computer Science Dept.) Universidade de São Paulo - Brazil e-mail: rs...@im... Web: http://www.ime.usp.br/~rsilva Teoria é o que não entendemos o (Theory is something we don't) suficiente para chamar de prática. (understand well enough to call) (practice) |
From: Karthikesh R. <ka...@ja...> - 2004-05-12 08:03:44
|
Hi All, i found something strange about complex matrices/arrays. Is it true that transposing them does not yeald the mathematically correct transpose (the signs of the imaginary part is reversed)? This leads to wrong results while calculating covariances etc .. Actually i find that things go a bit wild with complex number, is it true? Warm regards karthik ----------------------------------------------------------------------- Karthikesh Raju, email: ka...@ja... Researcher, http://www.cis.hut.fi/karthik Helsinki University of Technology, Tel: +358-9-451 5389 Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277 Department of Computer Sc., P.O Box 5400, FIN 02015 HUT, Espoo, FINLAND ----------------------------------------------------------------------- |
From: Faheem M. <fa...@em...> - 2004-05-10 23:31:23
|
On Tue, 20 Apr 2004, Todd Miller wrote: > On Mon, 2004-04-19 at 23:20, Faheem Mitha wrote: > > > > Yes, that works. Thanks. > > > > In [13]: numarray.objects.add.reduce(s,dim=1) > > Out[13]: ObjectArray(['abc', 'def', 'ghi']) > > > > BTW, that makes me wonder what the rules are for the order in which this > > reduction proceeds for arrays bigger than dimension two. Since there is no > > total order in this case, the answer is not obvious. > > (I think) the answer is that for numarray, reductions ultimately occur > along the innermost axis. Off-axis reductions are performed by a > swapaxis between the off-axis and the innermost axis, followed by the > reduction, followed by a swapaxis back between the new innermost axis > and the off-axis. I'm not sure there's an especially good reason for > the swap back (since the original swapped axis no longer exists), but > it seems to be what Numeric does and not doing it in numarray broke > extension (linear_algebra?) self-tests. > > > For string > > concatentation (since it is not commutative) at least this matters. I > > didn't see this documented in the manual but I may have missed it. > > Reductions always occur in order of increasing indexes with the > "reduction-so-far" as the left operand and the next index as the right > operand. Reductions occur in a sort of depth-first manner with the > outermost dimensions varying most slowly. Sorry about the slow reply. This message got lost in the mess in my inbox, which I have recently being cleaning out. I just wanted to say that it would be useful to have the above documented in some appropriate place in the numarray manual. 99% of the time the exact procedure for a reduction won't matter, but when someone is using a non-commutative operator it will. If this is documented in the manual I could not find it. Thanks. Faheem. |
From: Gary R. <ga...@em...> - 2004-05-10 04:13:05
|
I finally got around to putting my errorbar calculation module on my website. <http://users.bigpond.net.au/gazzar/python.html> This should be of interest to Numeric Python users who deal with calculation of error-bounds on experimental data. Synopsis: A module providing a Python number type class and helper functions to ease the task of computing error bounds on experimental data values. This module defines an abstract data type, Err, which carries a central/prime value and upper and lower error bounds. Helper functions are provided to allow Python Numeric rank-1 arrays of Err objects to be constructed with ease and to apply Numeric Ufuncs. Written under Python 2.3.3 and Numeric 23.0 Example of usage: upperPressure = ArrayOfErr([909., 802., 677., 585., 560., 548.], 1.0) lowerPressure = ArrayOfErr([144., 246., 378., 469., 493., 505.], 1.0) pressureDiff = upperPressure - lowerPressure V_RStandard = ArrayOfErr([2.016, 2.016, 2.020, 2.017, 2.021, 2.019], 0.001) R = 100.2 # standard resistor value [Ohm] I = V_RStandard / R # current [A] V_RAB = ArrayOfErr([6.167, 6.168, 6.170, 6.160, (6.153, 0.02), (5.894, 0.01)], 0.002) R_AB = V_RAB / I logR_AB = ApplyUfuncToErr(R_AB, log10) # This means log10(R_AB) print PrimeVals(logR_AB) print MinVals(logR_AB) print MaxVals(logR_AB) Enjoy, Gary Ruben -- ___________________________________________________________ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm |
From: Todd M. <jm...@st...> - 2004-05-07 14:23:07
|
On Thu, 2004-05-06 at 19:16, Colin J. Williams wrote: > > Todd Miller wrote: > > On Wed, 2004-05-05 at 18:59, Colin J. Williams wrote: > > > > > Todd Miller wrote: > > > > > > > On Wed, 2004-05-05 at 16:27, Colin J. Williams wrote: > > > > > > > > > > > > > It would help to have some documentation on the purpose and usage of the > > > > > class UsesOpPriority and its variable op_priority. > > > > > > > > > > > > > Todd, > > > > > > Thanks for this, perhaps it could be added to the pdf . I like the > > > basic idea. > > > > > OK. What is it you want to do? > Re: Above. > Document whatever you decide to do with UsesOpPriority I put more comments in numarraycore. If a lot of people want to subclass NumArray, it will probably require more discussion because UsesOpPriority is a limited scheme. For now, MaskedArrays do mostly what I want and it should work for PyMatrix as well. > Re: Below. > Access the methods of NumArray in a Pythonic manner. > Subclassing from UsesOpPriority doesn't appear to permit that. No, it doesn't. > > > > > > The basic idea was that NumArray subclasses which want to use numarray > > > > operators would: > > > > > > > > 1. subclass from UsesOpPriority > > > > > > > UsesOpPriority has no methods and thus, to access the methods of > > > NumArray, it would appear to be necessary to subclass from NumArray. > > > > > For limited but important uses (e.g. masked array) subclassing from > > NumArray is not necessary; I'd summarize these as the cases where a > > class wants to take control of operators from NumArray. > > > Thus, if masked array require use of the UsesOpPrioity, then direct > subclassing from there would appear to make sense. > > However, where one wishes to use some of the NumArray methods, then, > contrary to 1, above, subclassing from NumArray should, I suggest, be > the way to go. That's true... I overlooked the fact that UsesOpPriority is inherited automatically by NumArray subclasses. Sorry for the confusion. > > > > > > 2. set a class level op_priority > 0. > > > > > > > > > > > > NumArrays have op_priority 0, higher priorities are given "precedence". > > > > > > > > > > > > Thus, given A=NumArray(...) and B=NumArraySubclass(...), and > > > > A.op_priority==0 and B.op_priority==1, then: > > > > A+B would execute as B.__radd__(A) rather than A.__add__(B) and hence > > > > the type(A+B) could be NumArraySubclass rather than NumArray. Different > > > > subclasses could use higher or lower op_priorities to perform the same > > > > kind of operator resolution among themselves. > > > > > > > > > > > I wonder about the desirability of having different levels of priority > > > for the same level of subclassing and am puzzled that a float variable > > > is used for the priority. > > > > > Different levels of priority for the same level of sub-classing makes > > sense to me: it let's you answer the question "What's the result type > > of a PyMatrix instance + a SomeOtherSubclass instance?" > > > I agree, there is the possibility that one would wish to evaluate such > expressions right to left and > the priority provides a way of doing this. > > A float enables insertions of new members into the middle of an existing > > order. > > > True. I hope that there will be a database somewhere of all the > various values for op_priority Here's the database: :-) class op_priority NumArray 0 MaskedArray 1 Regards, Todd |
From: Jon S. <js...@wm...> - 2004-05-07 08:42:41
|
With NumPy: http://www.pyclimate.org Jon Saenz. | Tfno: +34 946012445 Depto. Fisica Aplicada II | Fax: +34 946013500 Facultad de Ciencias. \\ Universidad del Pais Vasco \\ Apdo. 644 \\ 48080 - Bilbao \\ SPAIN On Fri, 7 May 2004, Karthikesh Raju wrote: > Hi, > > Is am searching for a covariance function and other linear algebra > functions like eigen value decomposition. i am interested in both > scipy (havent managed to get scipy installed on the main computation > systems) and also numarray solution. > > With warm regards > karthik > > > ----------------------------------------------------------------------- > Karthikesh Raju, email: ka...@ja... > Researcher, http://www.cis.hut.fi/karthik > Helsinki University of Technology, Tel: +358-9-451 5389 > Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277 > Department of Computer Sc., > P.O Box 5400, FIN 02015 HUT, > Espoo, FINLAND > ----------------------------------------------------------------------- > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver > higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
From: Karthikesh R. <ka...@ja...> - 2004-05-07 08:22:21
|
Hi, Is am searching for a covariance function and other linear algebra functions like eigen value decomposition. i am interested in both scipy (havent managed to get scipy installed on the main computation systems) and also numarray solution. With warm regards karthik ----------------------------------------------------------------------- Karthikesh Raju, email: ka...@ja... Researcher, http://www.cis.hut.fi/karthik Helsinki University of Technology, Tel: +358-9-451 5389 Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277 Department of Computer Sc., P.O Box 5400, FIN 02015 HUT, Espoo, FINLAND ----------------------------------------------------------------------- |
From: Colin J. W. <cj...@sy...> - 2004-05-06 23:16:42
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> <br> <br> Todd Miller wrote:<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap="">On Wed, 2004-05-05 at 18:59, Colin J. Williams wrote: </pre> <blockquote type="cite"> <pre wrap="">Todd Miller wrote: </pre> <blockquote type="cite"> <pre wrap="">On Wed, 2004-05-05 at 16:27, Colin J. Williams wrote: </pre> <blockquote type="cite"> <pre wrap="">It would help to have some documentation on the purpose and usage of the class UsesOpPriority and its variable op_priority. </pre> </blockquote> </blockquote> <pre wrap="">Todd, Thanks for this, perhaps it could be added to the pdf . I like the basic idea. </pre> </blockquote> <pre wrap=""><!----> OK. What is it you want to do?</pre> </blockquote> Re: Above.<br> Document whatever you decide to do with UsesOpPriority<br> Re: Below.<br> Access the methods of NumArray in a Pythonic manner.<br> Subclassing from UsesOpPriority doesn't appear to permit that.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> </pre> <blockquote type="cite"> <blockquote type="cite"> <pre wrap="">The basic idea was that NumArray subclasses which want to use numarray operators would: 1. subclass from UsesOpPriority </pre> </blockquote> <pre wrap="">UsesOpPriority has no methods and thus, to access the methods of NumArray, it would appear to be necessary to subclass from NumArray. </pre> </blockquote> <pre wrap=""><!----> For limited but important uses (e.g. masked array) subclassing from NumArray is not necessary; I'd summarize these as the cases where a class wants to take control of operators from NumArray. </pre> </blockquote> Thus, if masked array require use of the UsesOpPrioity, then direct subclassing from there would appear to make sense. <br> <br> However, where one wishes to use some of the NumArray methods, then, contrary to 1, above, subclassing from NumArray should, I suggest, be the way to go.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> </pre> <blockquote type="cite"> <blockquote type="cite"> <pre wrap="">2. set a class level op_priority > 0. NumArrays have op_priority 0, higher priorities are given "precedence". Thus, given A=NumArray(...) and B=NumArraySubclass(...), and A.op_priority==0 and B.op_priority==1, then: A+B would execute as B.__radd__(A) rather than A.__add__(B) and hence the type(A+B) could be NumArraySubclass rather than NumArray. Different subclasses could use higher or lower op_priorities to perform the same kind of operator resolution among themselves. </pre> </blockquote> <pre wrap="">I wonder about the desirability of having different levels of priority for the same level of subclassing and am puzzled that a float variable is used for the priority. </pre> </blockquote> <pre wrap=""><!----> Different levels of priority for the same level of sub-classing makes sense to me: it let's you answer the question "What's the result type of a PyMatrix instance + a SomeOtherSubclass instance?" </pre> </blockquote> I agree, there is the possibility that one would wish to evaluate such expressions right to left and <br> the priority provides a way of doing this.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> A float enables insertions of new members into the middle of an existing order. </pre> </blockquote> True. I hope that there will be a database somewhere of all the various values for op_priority<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> </pre> <blockquote type="cite"> <pre wrap="">It would nice if this depth could be determined automatically. Perhaps something like the script below could be used. </pre> </blockquote> <pre wrap=""><!----> I don't think we want something automatic here. The choices involved are arbitrary so we just need to be able to define what we want. Other than masked arrays, the problem we were trying to solve with UsesOpPriority is more like: class A(NumArray): op_priority = 1 class B(NumArray): op_priority = 2 whenever A op B is encountered, the result should be a B. That said, the solution we currently have is better described by: whenever A op B is encountered, B.__rop__(A) is called in preference to A.__op__(B). With the example above, even though B.__rop__ is called, the result is still an A. :-( I fixed this in CVS today to work more like the original description. Regards, Todd </pre> </blockquote> Thanks.<br> <br> Colin W.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> </pre> <blockquote type="cite"> <pre wrap="">Colin W. </pre> <blockquote type="cite"> <pre wrap="">Todd </pre> </blockquote> <pre wrap=""># tClassing.py class A: def __init__(self): self.p= 0 def prior(self): self.p+= 1 class B(A): def __init__(self): A.__init__(self) self.prior() class C(B): def __init__(self): B.__init__(self) self.prior() print A().p print B().p c= C() print 'Priority for C methods:', c.p ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. <a class="moz-txt-link-freetext" href="http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3">http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3</a> _______________________________________________ Numpy-discussion mailing list <a class="moz-txt-link-abbreviated" href="mailto:Num...@li...">Num...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/numpy-discussion">https://lists.sourceforge.net/lists/listinfo/numpy-discussion</a> </pre> </blockquote> </blockquote> </body> </html> |
From: Todd M. <jm...@st...> - 2004-05-06 18:08:27
|
On Wed, 2004-05-05 at 18:59, Colin J. Williams wrote: > > Todd Miller wrote: > > On Wed, 2004-05-05 at 16:27, Colin J. Williams wrote: > > > > > It would help to have some documentation on the purpose and usage of the > > > class UsesOpPriority and its variable op_priority. > > > > > > Todd, > > Thanks for this, perhaps it could be added to the pdf . I like the > basic idea. OK. What is it you want to do? > > The basic idea was that NumArray subclasses which want to use numarray > > operators would: > > > > 1. subclass from UsesOpPriority > UsesOpPriority has no methods and thus, to access the methods of > NumArray, it would appear to be necessary to subclass from NumArray. For limited but important uses (e.g. masked array) subclassing from NumArray is not necessary; I'd summarize these as the cases where a class wants to take control of operators from NumArray. > > 2. set a class level op_priority > 0. > > > > > > NumArrays have op_priority 0, higher priorities are given "precedence". > > > > > > Thus, given A=NumArray(...) and B=NumArraySubclass(...), and > > A.op_priority==0 and B.op_priority==1, then: > > A+B would execute as B.__radd__(A) rather than A.__add__(B) and hence > > the type(A+B) could be NumArraySubclass rather than NumArray. Different > > subclasses could use higher or lower op_priorities to perform the same > > kind of operator resolution among themselves. > > > I wonder about the desirability of having different levels of priority > for the same level of subclassing and am puzzled that a float variable > is used for the priority. Different levels of priority for the same level of sub-classing makes sense to me: it let's you answer the question "What's the result type of a PyMatrix instance + a SomeOtherSubclass instance?" A float enables insertions of new members into the middle of an existing order. > > It would nice if this depth could be determined automatically. > Perhaps something like the script below could be used. I don't think we want something automatic here. The choices involved are arbitrary so we just need to be able to define what we want. Other than masked arrays, the problem we were trying to solve with UsesOpPriority is more like: class A(NumArray): op_priority = 1 class B(NumArray): op_priority = 2 whenever A op B is encountered, the result should be a B. That said, the solution we currently have is better described by: whenever A op B is encountered, B.__rop__(A) is called in preference to A.__op__(B). With the example above, even though B.__rop__ is called, the result is still an A. :-( I fixed this in CVS today to work more like the original description. Regards, Todd > > Colin W. > > Todd > > > # tClassing.py > > class A: > def __init__(self): > self.p= 0 > def prior(self): > self.p+= 1 > class B(A): > def __init__(self): > A.__init__(self) > self.prior() > class C(B): > def __init__(self): > B.__init__(self) > self.prior() > > print A().p > print B().p > c= C() > print 'Priority for C methods:', c.p > ------------------------------------------------------- This SF.Net > email is sponsored by Sleepycat Software Learn developer strategies > Cisco, Motorola, Ericsson & Lucent use to deliver higher performing > products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ Numpy-discussion > mailing list Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jm...@st...> |
From: Travis N. V. <tr...@en...> - 2004-05-06 12:29:32
|
Greetings, The 1st annual *SciPy Conference* will be held this year at Caltech, September 2-3, 2004. As some of you may know, we've experienced great participation in two SciPy "Workshops" (with ~70 attendees in both 2002 and 2003) and this year we're graduating to a "conference." With the prestige of a conference comes the responsibility of a keynote address. This year, Jim Hugunin has answered the call and will be speaking to kickoff the meeting on Thursday September 2nd. Jim is the creator of Numeric Python, Jython, and co-designer of AspectJ. Jim is currently working on IronPython--a fast implementation of Python for .NET and Mono. Registration is now open. More information can be found here: http://www.scipy.org/wikis/scipy04 You may register early online for $100.00. Registration includes breakfast and lunch Thursday & Friday and a very nice dinner Thursday night. After July 16, registration will cost $150.00. Call for Presenters: If you are interested in presenting at the conference, you may submit an abstract in Plain Text, PDF or MS Word formats to abs...@sc... -- the deadline for abstract submission is July 1, 2004. Papers and/or presentation slides are acceptable and are due by August 20, 2004. We're also planning three days of informal "Coding Sprints" prior to the conference -- August 30 to September 1, 2004. Conference registration is not required to participate in the sprints. Please email the list, however, if you plan to attend. Topics for these sprints will be determined via the mailing lists as well, so please submit any suggestions for topics to the scipy-user list: list signup: http://www.scipy.org/mailinglists/ list address: sci...@sc... Please forward this announcement to anyone/list that might be interested. I look forward to seeing you at the conference. Best Regards, Travis N. Vaught |
From: Colin J. W. <cj...@sy...> - 2004-05-05 23:00:54
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> <br> <br> Todd Miller wrote:<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap="">On Wed, 2004-05-05 at 16:27, Colin J. Williams wrote: </pre> <blockquote type="cite"> <pre wrap="">It would help to have some documentation on the purpose and usage of the class UsesOpPriority and its variable op_priority. </pre> </blockquote> <pre wrap=""><!----></pre> </blockquote> Todd,<br> <br> Thanks for this, perhaps it could be added to the pdf . I like the basic idea.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap="">The basic idea was that NumArray subclasses which want to use numarray operators would: 1. subclass from UsesOpPriority </pre> </blockquote> UsesOpPriority has no methods and thus, to access the methods of NumArray, it would appear to be necessary to subclass from NumArray.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> 2. set a class level op_priority > 0. NumArrays have op_priority 0, higher priorities are given "precedence". Thus, given A=NumArray(...) and B=NumArraySubclass(...), and A.op_priority==0 and B.op_priority==1, then: A+B would execute as B.__radd__(A) rather than A.__add__(B) and hence the type(A+B) could be NumArraySubclass rather than NumArray. Different subclasses could use higher or lower op_priorities to perform the same kind of operator resolution among themselves. </pre> </blockquote> I wonder about the desirability of having different levels of priority for the same level of subclassing and am puzzled that a float variable is used for the priority.<br> <br> It would nice if this depth could be determined automatically. Perhaps something like the script below could be used.<br> <br> Colin W.<br> <blockquote type="cite" cite="mid...@ha..."> <pre wrap=""> Todd </pre> </blockquote> # tClassing.py<br> <br> class A:<br> def __init__(self):<br> self.p= 0<br> def prior(self):<br> self.p+= 1<br> class B(A):<br> def __init__(self):<br> A.__init__(self)<br> self.prior()<br> class C(B):<br> def __init__(self):<br> B.__init__(self)<br> self.prior()<br> <br> print A().p<br> print B().p<br> c= C()<br> print 'Priority for C methods:', c.p<br> </body> </html> |
From: Todd M. <jm...@st...> - 2004-05-05 20:51:36
|
On Wed, 2004-05-05 at 16:27, Colin J. Williams wrote: > It would help to have some documentation on the purpose and usage of the > class UsesOpPriority and its variable op_priority. The basic idea was that NumArray subclasses which want to use numarray operators would: 1. subclass from UsesOpPriority 2. set a class level op_priority > 0. NumArrays have op_priority 0, higher priorities are given "precedence". Thus, given A=NumArray(...) and B=NumArraySubclass(...), and A.op_priority==0 and B.op_priority==1, then: A+B would execute as B.__radd__(A) rather than A.__add__(B) and hence the type(A+B) could be NumArraySubclass rather than NumArray. Different subclasses could use higher or lower op_priorities to perform the same kind of operator resolution among themselves. Todd -- Todd Miller <jm...@st...> |
From: Colin J. W. <cj...@sy...> - 2004-05-05 20:27:50
|
It would help to have some documentation on the purpose and usage of the class UsesOpPriority and its variable op_priority. |