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: Paul F. D. <pa...@pf...> - 2001-07-27 23:22:25
|
I will try to put a note in the transpose section if there isn't one there already. As noted, there are numerous reference-instead-of-a-copy returns in Numeric which reflect the speed rather than safety orientation of the original designer. Many complaints of this nature are a complaint about that choice, which made a package that was harder to understand and more difficult to use safely but which is about as fast as possible. I didn't like some of these choices but then again I didn't do the work. -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Tim Hochberg Sent: Thursday, July 26, 2001 1:35 PM To: num...@li... Subject: [Numpy-discussion] Re: Numeric.transpose (incorrect documentation) "Curtis Jensen" <cj...@bi...> wrote in message news:3B6...@bi...... > the documenation for the "transpose" function for the "Numeric" module > seems to be incoorect, or at least missleading. The correct place for this is probably the numpy-discussion list, so I'm cc'ing it there. Perhaps the Paul Dubois will see it and have some ideas for clearing of the docs. |
From: Travis O. <oli...@ie...> - 2001-07-27 19:52:19
|
On Fri, 27 Jul 2001, Paul F. Dubois wrote: > I don't know if someone helped you with this while I was on travel, but in > case they didn't: > I tested his code on my machine and found that by placing an import_array() statement in the subroutine which uses the C-API seems to work. > I'm pretty sure your problem is that myTest is not in the same file as the > import_array; when it tries to access the Numeric C API, it will be > dereferencing zero. For extensions that are not in one file, a special > techniques is required. Recently an improvement was added to make this > easier. I believe you should add this to your header file, above the > include of arrayobject.h: > > #define PY_ARRAY_UNIQUE_SYMBOL xxxx > > where xxxx is any name you choose that won't conflict with your other > stuff. > |
From: Paul F. D. <pa...@pf...> - 2001-07-27 19:12:50
|
I don't know if someone helped you with this while I was on travel, but in case they didn't: I'm pretty sure your problem is that myTest is not in the same file as the import_array; when it tries to access the Numeric C API, it will be dereferencing zero. For extensions that are not in one file, a special techniques is required. Recently an improvement was added to make this easier. I believe you should add this to your header file, above the include of arrayobject.h: #define PY_ARRAY_UNIQUE_SYMBOL xxxx where xxxx is any name you choose that won't conflict with your other stuff. I hope that if I have this wrong somebody will correct me. -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Wim Vanroose Sent: Tuesday, July 24, 2001 4:05 AM To: num...@li... Subject: [Numpy-discussion] Troubles with arrays Dear Numerical Python Users, I have a small program that produces array's that I want to import in Python. The code is organised in three files. 1) arraytest.h, 2) arraytest.c 3) testmodule.c. and the code is shown below. The function myTest() produces the array and is called from the test module. However, the program does not work! it crashes. In my opinion, I do not have yet enough insight in Numerical Python. Is there an essential part that I do not understand. Remarkable is that the pure Python equivalent of the program does not crash. Any ideas? Wim Vanroose ///////////////////////// //file: arraytest.h ////////////////////// #include "Python.h" #include "arrayobject.h" PyObject *myTest(void); ////////////////////// // file: arraytest.c //////////////////// #include "arraytest.h" PyObject * myTest(void ){ PyArrayObject *result; double *datainput; int dimensions[1]; int M=10; int MM; dimensions[0]=M; result = (PyArrayObject *)PyArray_FromDims(1,dimensions,PyArray_DOUBLE); datainput =(double *)result->data; for(MM=0;MM < M ; MM++){ datainput[MM] = MM*0.1; } return PyArray_Return(result); } //////////////////// //file: test.c CRASHES!!!! //////////////// #include "arraytest.h" static PyObject *function(PyObject *self, PyObject *args){ return myTest(); } static PyMethodDef testMethods[] = { {"test",function,1}, {NULL,NULL} }; extern "C" { void inittest(){ PyObject *m,*d; m = Py_InitModule("test", testMethods); import_array(); d = PyModule_GetDict(m); } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The Python Equivalent: DOES NOT CRASH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///////////// // file: simpletest.h ///////////////// #include "simpletest.h" PyObject * myTest(void); //////////////////// // file: test.c ////////////////////// #include "simpletest.h" PyObject * myTest(void ){ return Py_BuildValue("i",123); } //////////////// //file: test.c ////////////////// #include "simpletest.h" static PyObject *function(PyObject *self, PyObject *args){ return myTest(); } static PyMethodDef testMethods[] = { {"test",function,1}, {NULL,NULL} }; extern "C" { void inittest(){ PyObject *m,*d; m = Py_InitModule("test", testMethods); d = PyModule_GetDict(m); } _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Aureli S. F. <Aur...@ip...> - 2001-07-27 17:20:58
|
Hi, Folllowing could be a bug: >Traceback (most recent call last): > File "<input>", line 1, in ? > File "macintosh hd:compiler:python >2.0:extensions:numerical:lib:packages:RandomArray.py", line 120, in >multivariate_normal > final_shape.append(mean.shape[0]) >AttributeError: 'tuple' object has no attribute 'append' should be: final_shape=final_shape+(mean.shape[0],) or am I missing something? Thanks ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 8-9, 10587 Berlin, Germany e-mail:au...@ip... fon: +49 30 39006-150 fax: +49 30 3917517 ################################# |
From: Tim H. <tim...@ie...> - 2001-07-26 20:36:52
|
"Curtis Jensen" <cj...@bi...> wrote in message news:3B6...@bi...... > the documenation for the "transpose" function for the "Numeric" module > seems to be incoorect, or at least missleading. The correct place for this is probably the numpy-discussion list, so I'm cc'ing it there. Perhaps the Paul Dubois will see it and have some ideas for clearing of the docs. > It says that transpose is suppose to return a "new" array. In fact it > does not. It returns a pointer to the same array, only with transposed > indicies. It's been a while since I looked at the NumPy docs, so I don't recall what conventions they use here. However, transpose does return a new array, it just points to the same data as the original. If a=transpose(b), "a is b" is false and "a.shape == b.shape" is false, so clearly they are different objects (i.e., different arrays). You know most of this, as you demonstrate down below, I just wanted to make the point that there is a difference between a new array and new data. Note that nearly every operation that can return a reference rather than a copy does so. Even slicing, if b=a[3:5], then 'b' holds a reference to the same data as 'a'. Some functions go so far to return a reference when they can, but otherwise copy. See ravel for example -- it copies the data if its argument is not contiguous, otherwise it uses a reference. Now _that_ can be confusing! Useful though. -tim > consider the example: > > Python 1.5.2 (#4, Sep 5 2000, 10:29:12) [C] on irix646 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> from Numeric import * > >>> foo = zeros([5,10]) > >>> bar = transpose( foo ) > >>> foo > array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) > >>> bar > array([[0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0]]) > >>> foo[0,2] = 1 > >>> foo > array([[0, 0, 1, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], > [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]) > >>> bar > array([[0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [1, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0], > [0, 0, 0, 0, 0]]) > >>> > > > if bar was truely a new array, then changes to foo would not affect > bar. In the example above, it does. This way actualy works better for > my purposes, however, the documentation is missleading. > > -- > Curtis Jensen > cj...@bi... > http://www-bioeng.ucsd.edu/~cjensen/ > FAX (425) 740-1451 |
From: Chris B. <chr...@ho...> - 2001-07-26 19:35:14
|
Robert Kern wrote: > >>> Numeric.floor > <ufunc 'floor'> > >>> Numeric.ceil > <ufunc 'ceil'> > >>> Numeric.around > <function around at 0x807439c> DOH! I had just been looking for round, but Ithought I had checked for ceil and floor as wel, but I guess not. sorry for the stupid question. I can point out that none of these is in the doc. Paul, is there any way any of us can contribute to the doc?? > The last one isn't a ufunc, but it's composed of them. ] It seems to act like one: >>> floor([3.3,3.5,3.6]) array([ 3., 3., 3.]) probably because it is composed of them. > a function so that it can match Python's rounding behavior. It does seem to match Python's native round, which makes me wonder why it can't be called "round", since it will behave the same for regulat python number types. NOt a big deal, of course. -thanks, Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Robert K. <ke...@ca...> - 2001-07-26 18:41:23
|
On Thu, Jul 26, 2001 at 11:46:06AM -0700, Chris Barker wrote: > Hi all, > > I was surprised to find that the functions: > > round, floor, and ceil are not included as ufuncs in NumPy. > > Have I just missed them? Where can I find them if they do exist? Python 2.0.1 (#0, Jul 3 2001, 12:36:30) [GCC 2.95.4 20010629 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> import Numeric >>> print Numeric.__version__ 20.1.0 >>> Numeric.floor <ufunc 'floor'> >>> Numeric.ceil <ufunc 'ceil'> >>> Numeric.around <function around at 0x807439c> The last one isn't a ufunc, but it's composed of them. I would guess that it's a function so that it can match Python's rounding behavior. -- Robert Kern ke...@ca... "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter |
From: Chris B. <chr...@ho...> - 2001-07-26 18:28:04
|
Hi all, I was surprised to find that the functions: round, floor, and ceil are not included as ufuncs in NumPy. Have I just missed them? Where can I find them if they do exist? If they don't is there a reason for it, or has just no one gotten around to writing them? If the latter, can someone give me some pointers as to how I would go about writting them myself. It certainly seems as though it would be easy if modeled after the other unary ufuncs, but I'm a little unsure from the source where I would put it all. thanks, -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Tim H. <tim...@ie...> - 2001-07-26 16:37:05
|
From: "Nils Wagner" <nw...@is...> > A matrix operation is that of stacking the columns of a > matrix one under the other to form a single column. > This operation is called "vec" or "cs" (c)olumn (s)tring > > Example > > A is a m * n matrix > > vec(A) = reshape(transpose(A),(m*n,1)) I assume you mean: def vec(A): reshape(transpose(A), (m*n,1)) First off, the following is a bit simpler and means you don't have to carray m and n around def vec(A): reshape(transpose(A), (-1,1)) > How can I copy the result of vec(A) into the i-th column of another > matrix called B ? B = zeros([m*n, p]) B[:,i:i+1] = vec(A) However, I don't think this is what you really want. I suspect you'd be happier with: B[:,i] = ravel(A) Ravel turns A into an m*n length vector [shape (m*n,)] instead of m*n by 1 array [shape (m*n,1)]. If all you want to do is insert it into B, this is going to be more useful. -tim |
From: Nils W. <nw...@is...> - 2001-07-26 15:55:20
|
Hi, A matrix operation is that of stacking the columns of a matrix one under the other to form a single column. This operation is called "vec" or "cs" (c)olumn (s)tring Example A is a m * n matrix vec(A) = reshape(transpose(A),(m*n,1)) How can I copy the result of vec(A) into the i-th column of another matrix called B ? Thanks in advance. Nils |
From: Nils W. <nw...@is...> - 2001-07-25 09:38:35
|
Hi, Has anyone written some functions concerning the matrix exponential expm(A) ? I am looking for demos illustrating the use of Pad=E9 approximation, Taylor series approximation, and eigenvalues and eigenvectors, respectively, to compute the matrix exponential. Thanks in advance. Nils Reference : SIAM Review, Vol. 20 (1979) pp.801-836 Moler, van Loan "Nineteen dubious ways to compute the exponential of a matrix" |
From: Nils W. <nw...@is...> - 2001-07-25 09:14:26
|
Hi, I'm interested in efficient implementations of various vector and matrix norms. Please can anyone give me some short examples regarding the following norms for vectors : 1. Frobenius norm 2. L_1 norm is sum of absolute values 3. L_2 norm 4. L_\infty or maximum norm 5. p-norm and matrices: matrix spectral norm or matrix 2-norm Frobenius norm ||A||_F p-norms ||A||_p Thanks in advance. Nils |
From: Tim H. <tim...@ie...> - 2001-07-24 20:07:04
|
Hi Scott, et al. First off I goofed -- that last reply should have gone to the list as a whole. Second, mere seconds after I pushed send I realized one problem with it: 'flat' only works for contiguous arrays. Its probably safer to use ravel after all, unless it's known that the array is contiguous. On the other hand, it would be slightly more efficient to ravel the matrix after taking its absolute value since ravel potentially allocates a new array and an array of Floats is going to be half the size of an array of Complexes. But then we know the resulting array is going to be contiguous. So after rewriting and erasing the thing a few times I end up with: max(abs(a).flat) Which is almost the same as my first one, except that the flat has been moved and now it should work when the array starts out noncontiguous. -tim > Hi Tim, > > Looks good to me! ;) > > Scott > > Tim Hochberg wrote: > > > > ----- Original Message ----- > > From: "Scott Ransom" <ra...@cf...> > > Cc: <nil...@fr...>; <num...@li...> > > Sent: Tuesday, July 24, 2001 12:24 PM > > Subject: Re: [Numpy-discussion] largest matrix element > > > > > Charles G Waldman wrote: > > > > > > > > nil...@fr... writes: > > > > > Given a complex Matrix A(m,n) > > > > > How can I get the absolute value of the largest matrix element > > > > > very efficiently ? > > > > > > > > How about > > > > > > > > sqrt(max((asarray(A)*conjugate(asarray(A))).real)) > > > > > > I if you want the global maximum you need a ravel in there: > > > > > > sqrt(max(ravel((asarray(a)*conjugate(asarray(a))).real))) > > > > I must be missing something. What's wrong with: > > > > max(abs(a.flat)) ? > > > > -tim > > -- > Scott M. Ransom Address: Harvard-Smithsonian CfA > Phone: (617) 496-7908 60 Garden St. MS 10 > email: ra...@cf... Cambridge, MA 02138 > GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 |
From: Scott R. <ra...@cf...> - 2001-07-24 19:24:55
|
Charles G Waldman wrote: > > nil...@fr... writes: > > Given a complex Matrix A(m,n) > > How can I get the absolute value of the largest matrix element > > very efficiently ? > > How about > > sqrt(max((asarray(A)*conjugate(asarray(A))).real)) I if you want the global maximum you need a ravel in there: sqrt(max(ravel((asarray(a)*conjugate(asarray(a))).real))) Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 496-7908 60 Garden St. MS 10 email: ra...@cf... Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 |
From: Charles G W. <cg...@al...> - 2001-07-24 19:18:44
|
nil...@fr... writes: > Given a complex Matrix A(m,n) > How can I get the absolute value of the largest matrix element > very efficiently ? How about sqrt(max((asarray(A)*conjugate(asarray(A))).real)) ? |
From: <nil...@fr...> - 2001-07-24 18:58:53
|
R2l2ZW4gYSBjb21wbGV4IE1hdHJpeCBBKG0sbikNCkhvdyBjYW4gSSBnZXQgdGhlIGFic29sdXRl IHZhbHVlIG9mIHRoZSBsYXJnZXN0IG1hdHJpeCBlbGVtZW50DQp2ZXJ5IGVmZmljaWVudGx5ID8N Cg0KTmlscw0KDQoKCgpEaWUgc2No9m5lbiBTZWl0ZW4gZGVzIFVybGF1YnMgYmVpIExpYnJpLmRl OiBTb25uaWdlIEL8Y2hlcgpwb3J0b2ZyZWkgYmVzdGVsbGVuOiBodHRwOi8vd3d3LmxpYnJpLmRl L2NvbnRlbnQvdXJsYXViLmh0bWw= |
From: Wim V. <van...@ru...> - 2001-07-24 11:04:51
|
Dear Numerical Python Users, I have a small program that produces array's that I want to import in Python. The code is organised in three files. 1) arraytest.h, 2) arraytest.c 3) testmodule.c. and the code is shown below. The function myTest() produces the array and is called from the test module. However, the program does not work! it crashes. In my opinion, I do not have yet enough insight in Numerical Python. Is there an essential part that I do not understand. Remarkable is that the pure Python equivalent of the program does not crash. Any ideas? Wim Vanroose ///////////////////////// //file: arraytest.h ////////////////////// #include "Python.h" #include "arrayobject.h" PyObject *myTest(void); ////////////////////// // file: arraytest.c //////////////////// #include "arraytest.h" PyObject * myTest(void ){ PyArrayObject *result; double *datainput; int dimensions[1]; int M=10; int MM; dimensions[0]=M; result = (PyArrayObject *)PyArray_FromDims(1,dimensions,PyArray_DOUBLE); datainput =(double *)result->data; for(MM=0;MM < M ; MM++){ datainput[MM] = MM*0.1; } return PyArray_Return(result); } //////////////////// //file: test.c CRASHES!!!! //////////////// #include "arraytest.h" static PyObject *function(PyObject *self, PyObject *args){ return myTest(); } static PyMethodDef testMethods[] = { {"test",function,1}, {NULL,NULL} }; extern "C" { void inittest(){ PyObject *m,*d; m = Py_InitModule("test", testMethods); import_array(); d = PyModule_GetDict(m); } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The Python Equivalent: DOES NOT CRASH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ///////////// // file: simpletest.h ///////////////// #include "simpletest.h" PyObject * myTest(void); //////////////////// // file: test.c ////////////////////// #include "simpletest.h" PyObject * myTest(void ){ return Py_BuildValue("i",123); } //////////////// //file: test.c ////////////////// #include "simpletest.h" static PyObject *function(PyObject *self, PyObject *args){ return myTest(); } static PyMethodDef testMethods[] = { {"test",function,1}, {NULL,NULL} }; extern "C" { void inittest(){ PyObject *m,*d; m = Py_InitModule("test", testMethods); d = PyModule_GetDict(m); } |
From: Mike R. <ro...@fs...> - 2001-07-20 22:02:23
|
I have written a python module in C which is implemented as a loadable shared library. My module uses Numeric array objects and includes arrayobject.h. With Numeric-19 this used to work fine. Now my module will not load because the symbol PyArray_API is not found. I located this fellow in the arrayobject header file: /* C API address pointer */ #if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC) extern void **PyUFunc_API; #else #if defined(PY_UFUNC_UNIQUE_SYMBOL) void **PyUFunc_API; #else static void **PyUFunc_API; #endif So, it seems (at first glance) that this symbol is either static or extern based on the NO_IMPORT macro. My question is, can I just define NO_IMPORT before including arrayobject.h or does Numeric python need to be rebuilt so that this symbol gets exported? Thanks, Mike Romberg (ro...@fs...) |
From: Jochen <jo...@un...> - 2001-07-20 20:05:29
|
>>>>> Paul F Dubois wrote on Tue, 17 Jul 2001 12:53:52 -0700: [patch to Src/fastumathmodule.c] Paul> This file is no longer in the distribution. So why was it changed today? > cvs log Src/fastumathmodule.c ,---- | RCS file: /cvsroot/numpy/Numerical/Src/fastumathmodule.c,v | Working file: Src/fastumathmodule.c | head: 1.2 | branch: | locks: strict | access list: | symbolic names: | keyword substitution: kv | total revisions: 2; selected revisions: 2 | description: | ---------------------------- | revision 1.2 | date: 2001/07/20 03:24:33; author: teoliphant; state: Exp; lines: +18 -0 | Added inverse hyperbolic functions. | ---------------------------- | revision 1.1 | date: 2001/07/16 23:19:23; author: teoliphant; state: Exp; | Added fastumathmodule which doesn't emit exceptions. | ============================================================================= `---- To get that straight: I am looking at the Repository "Numerical" at :pserver:ano...@cv...:/cvsroot/numpy I hope that is the correct module for an uptodate version of NumPy. If so, I would suggest the following patch to have it link successfully on Cygwin: Index: Src/fastumathmodule.c =================================================================== RCS file: /cvsroot/numpy/Numerical/Src/fastumathmodule.c,v retrieving revision 1.2 diff -u -r1.2 fastumathmodule.c --- Src/fastumathmodule.c 2001/07/20 03:24:33 1.2 +++ Src/fastumathmodule.c 2001/07/20 20:01:33 @@ -2141,7 +2141,7 @@ {NULL, NULL, 0} /* sentinel */ }; -void initfastumath() { +DL_EXPORT(void) initfastumath() { PyObject *m, *d, *s; /* Create the module and add the functions */ Thanks, Jochen -- University of North Carolina phone: 919-962-4403 Department of Chemistry phone: 919-962-1579 Venable Hall CB#3290 fax: 919-843-6041 Chapel Hill, NC 27599, USA GnuPG key: 44BCCD8E |
From: Chris B. <chr...@ho...> - 2001-07-20 18:30:54
|
Konrad Hinsen wrote: > > > Feature, I think. > > Right, but a relatively recent one. In the first NumPy releases, the > result was a scalar Integer object. There are good arguments for both > variants. OK. I see that there are trade-offs either way, and I certainly see the benefit of keeping the precision consistent(even though it would be easier in this case to have th upcast). I do think it's a bug, however, to have the upcast when pulling a single value out of a 1-d array, but not when pulling it out of a higher rank array: >>> a = array(((1,2,3),(4,5,6)),Int16) >>> type(a[1,1]) <type 'array'> >>> a.shape = (6,) >>> type(a[2]) <type 'int'> >>> This seems totally inconsistant. Note that this same effect occurs for arrays of type Float16 (and probably others) By the way, would it be at all possible for Python to accept an array of rank 0 as an index? How big a change would that be? -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Peter B. <Pet...@ru...> - 2001-07-20 15:04:06
|
Hi, In chapter 14 of the docs (Writing a C extension to NumPy), the last section (a less simple example) deals with mixing Fortran and C code. Wouldn't it be useful to mention the topic of different storage orders there, and to reflect this in the code by swapping some stride parameters? Could avoid a lot of frustration... Peter ------------------------------------- Peter Bienstman Department of Information Technology INTEC/IMEC - Ghent University St.-Pietersnieuwstraat 41 B-9000 Gent - Belgium E-mail: Pet...@ru... Tel: +32 9 264 3445 Fax: +32 9 264 3593 ------------------------------------- |
From: Konrad H. <hi...@cn...> - 2001-07-20 12:31:00
|
> Feature, I think. Right, but a relatively recent one. In the first NumPy releases, the result was a scalar Integer object. There are good arguments for both variants. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hi...@cn... Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- |
From: Emmanuel V. <vi...@li...> - 2001-07-20 07:18:42
|
Feature, I think. a[1,3] is a rank-0 array, with typecode Int16. There is no other way to handle a Int16 scalar in Python (Int16 is not a python type). This solution allows to correctly propagate the types in array arithmetic, without unwanted upcasts. Emmanuel Chris Barker wrote: > # now change the type > >>> a = a.astype(Int16) > >>> a.shape = (10,) > >>> print type(a[3]) > <type 'int'> > #it's an Int > > >>> a.shape = (2,5) > # now change the shape to rank-2 > > >>> print type(a[1,3]) > <type 'array'> > >>> print a[0,0].typecode() 's' # == Int16 >>> a[0,0].shape () # rank-0 array |
From: Chris B. <chr...@ho...> - 2001-07-20 00:10:47
|
Hi all, I am using a 2-d array to store values that will be an index into a list. It is huge, sot to samve space I have used a type Int16. Now when I pull a value outl it is of type array, so it can not be used to index a sequence. The strange thing is that it works if the array is of rank 1. Some tests: >>> from Numeric import * >>> >>> l = range(10) # a test list >>> a = arange(10) # an array if Ints >>> print type(a[3]) <type 'int'> #So this is an Int >>> print l[a[3]] 3 # and it can be used as an index. >>> a.shape = (2,5) #reshape it to be rank-2 >>> print type(a[1,3]) <type 'int'> # still and Int >>> print l[a[1,3]] 8 # and still usable as an index. # now change the type >>> a = a.astype(Int16) >>> a.shape = (10,) >>> print type(a[3]) <type 'int'> #it's an Int >>> a.shape = (2,5) # now change the shape to rank-2 >>> print type(a[1,3]) <type 'array'> #!!!!!!!#### # Now a single item is of type 'array' >>> print l[a[1,3]] Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: sequence index must be integer # and it can not be used as an index! I can work around this with an explicite type cast with int(), but it seems like wierd behaviour to me. I am accesing a single item, it is typcaste as an Int when the item is pulled out of a rank-1 array, but it is a rank-0 array when pulled from a rank > 1 array. Any ideas what causes this? Is there a good reson for htis, or is it a bug? -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Nils W. <nw...@is...> - 2001-07-19 08:15:43
|
Charles G Waldman schrieb: > Nils Wagner writes: > > > > How can I rearrange the result of outerproduct to the result of > > Kronecker product with numpy ? > > > > def kron(a,b): > o = outerproduct(a,b) > o.shape = a.shape + b.shape > return concatenate(concatenate(o, axis=1), axis=1) What is the difference between kron(z,eye) and kron(yt,eye) ? Nils |