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
(2) 
2
(5) 
3
(2) 
4
(5) 
5

6
(34) 
7
(16) 
8
(16) 
9
(2) 
10

11

12
(1) 
13
(1) 
14
(3) 
15
(2) 
16
(1) 
17

18
(5) 
19
(3) 
20
(7) 
21
(2) 
22

23
(1) 
24
(2) 
25
(1) 
26

27
(3) 
28
(2) 
29
(4) 
30
(5) 
31
(1) 






From: Paul F Dubois <paul@pf...>  20020331 03:01:32

About random number generation with Numeric: a. IMHO, RNG is the right choice if you are picky about the quality of the generator. This generator has a long history of heavy use. RandomArray is in the core because someone put it there early, not because it is the best. I do not claim to be an authority on this but that is my understanding. b. The suggestion made by one correspondent, that a generator should generate and throw away one value when the seed is set, sounds correct if viewed from the point of view of the initial set of a single stream. But many users need multiple streams that are independent and reproducible. This is done by saving the state of the generator and then restoring it later. It is important that this save/restore not change the results compared to not doing it. The presence or absence of another computation, or frequency of dump/restarts, that require a save/restore, must not affect the result. Thus a decision to throw away a result must come from the application level. 
From: rob <rob@py...>  20020330 16:59:17

After I post, I always see the dumb error. I am not including the 6x term in my finite difference equation. It now converges, but I get wierd looking V map. Rob. Here is the fixed code from math import * from Numeric import * # #*** ENTER DATA filename= "out" # bobfile=open(filename+".bob","w") print "\n"*30 NX=30 # number of cells NY=30 NZ=30 N=30 # size of box resmax=1e3 # conjgrad tolerance #allocate arrays ##Ex=zeros((NX+2,NY+2,NZ+2),Float) ##Ey=zeros((NX+2,NY+2,NZ+2),Float) ##Ez=zeros((NX+2,NY+2,NZ+2),Float) p=zeros((NX+1,NY+1,NZ+1),Float) q=zeros((NX+1,NY+1,NZ+1),Float) r=zeros((NX+1,NY+1,NZ+1),Float) u=zeros((NX+1,NY+1,NZ+1),Float) u[0:N,0:N,0]=0 # box at 1V with one side at 0V u[0:N,0,0:N]=1 u[0,0:N,0:N]=1 u[0:N,0:N,N]=1 u[0:N,N,0:N]=1 u[N,0:N,0:N]=1 r[1:NX1,1:NY1,1:NZ1]=(u[1:NX1,0:NY2,1:NZ1]+ #initialize r matrix u[1:NX1,2:NY,1:NZ1]+ u[0:NX2,1:NY1,1:NZ1]+ u[2:NX,1:NY1,1:NZ1]+ u[1:NX1,1:NY1,0:NZ2]+ u[1:NX1,1:NY1,2:NZ] 6*u[1:NX1,1:NY1,1:NZ1]) p[...]=r[...] #initialize p matrix # #**** START ITERATIONS # N=(NX2)*(NY2)*(NZ2) # left over from Jacobi solution, not used KK=0 # iteration counter res=0.0; #set residuals=0 while(1): q[1:NX1,1:NY1,1:NZ1]=(6*p[1:NX1,1:NY1,1:NZ1] p[1:NX1,0:NY2,1:NZ1] # finite difference eq p[1:NX1,2:NY,1:NZ1] p[0:NX2,1:NY1,1:NZ1] p[2:NX,1:NY1,1:NZ1] p[1:NX1,1:NY1,0:NZ2] p[1:NX1,1:NY1,2:NZ]) # Calculate r dot p and p dot q rdotp = 0.0 pdotq = 0.0 rdotp = add.reduce(ravel( r[1:NX1,1:NY1,1:NZ1] * p[1:NX1,1:NY1,1:NZ1])) pdotq = add.reduce(ravel( p[1:NX1,1:NY1,1:NZ1] * q[1:NX1,1:NY1,1:NZ1])) # Set alpha value alpha = rdotp/pdotq # Update solution and residual u[1:NX1,1:NY1,1:NZ1] += alpha*p[1:NX1,1:NY1,1:NZ1] r[1:NX1,1:NY1,1:NZ1] +=  alpha*q[1:NX1,1:NY1,1:NZ1] # calculate beta rdotq = 0.0 rdotq = add.reduce(ravel(r[1:NX1,1:NY1,1:NZ1]*q[1:NX1,1:NY1,1:NZ1])) beta = rdotq/pdotq # Set the new search direction p[1:NX1,1:NY1,1:NZ1] = r[1:NX1,1:NY1,1:NZ1]  beta*p[1:NX1,1:NY1,1:NZ1] res = sort(ravel(r[1:NX1,1:NY1,1:NZ1]))[1] #find largest residual # resmax = max(resmax,abs(res)) KK+=1 # print "Iteration Number %d Residual %1.2e" %(KK,abs(res)) if (abs(res)<=resmax): break # if residual is small enough break out print "Number of Iterations ",KK 
From: rob <rob@py...>  20020330 16:29:08

I'm experimenting with electrostatics now. I have an iterative Jacobian Laplace solver working but it can be slow. It creates a beautiful 3D Animabob image. So I decided to try out a conjugategradient solver, which should be an order of mag better. It runs but doesn't converge. One thing I am wondering, where is the conjugate? In my FEM code, the solver realy does use a conjugate, while this one here that I pieced together from several other programs does not. Why is it called conjugate gradient without a conjugate ? :) Here is the code: from math import * from Numeric import * # #*** ENTER DATA filename= "out" # bobfile=open(filename+".bob","w") print "\n"*30 NX=30 # number of cells NY=30 NZ=30 resmax=1e3 # conjgrad tolerance #allocate arrays ##Ex=zeros((NX+2,NY+2,NZ+2),Float) ##Ey=zeros((NX+2,NY+2,NZ+2),Float) ##Ez=zeros((NX+2,NY+2,NZ+2),Float) p=zeros((NX+1,NY+1,NZ+1),Float) q=zeros((NX+1,NY+1,NZ+1),Float) r=zeros((NX+1,NY+1,NZ+1),Float) u=zeros((NX+1,NY+1,NZ+1),Float) u[0:30,0:30,0]=0 # box at 1V with one side at 0V u[0:30,0,0:30]=1 u[0,0:30,0:30]=1 u[0:30,0:30,30]=1 u[0:30,30,0:30]=1 u[30,0:30,0:30]=1 r[1:NX1,1:NY1,1:NZ1]=(u[1:NX1,0:NY2,1:NZ1]+ #initialize r matrix u[1:NX1,2:NY,1:NZ1]+ u[0:NX2,1:NY1,1:NZ1]+ u[2:NX,1:NY1,1:NZ1]+ u[1:NX1,1:NY1,0:NZ2]+ u[1:NX1,1:NY1,2:NZ]) p[...]=r[...] #initialize p matrix # #**** START ITERATIONS # N=(NX2)*(NY2)*(NZ2) # left over from Jacobi solution, not used KK=0 # iteration counter res=resmax=0.0; #set residuals=0 while(1): q[1:NX1,1:NY1,1:NZ1]=(p[1:NX1,0:NY2,1:NZ1]+ # finite difference eq p[1:NX1,2:NY,1:NZ1]+ p[0:NX2,1:NY1,1:NZ1]+ p[2:NX,1:NY1,1:NZ1]+ p[1:NX1,1:NY1,0:NZ2]+ p[1:NX1,1:NY1,2:NZ]) # Calculate r dot p and p dot q rdotp = 0.0 pdotq = 0.0 rdotp = add.reduce(ravel( r[1:NX1,1:NY1,1:NZ1] * p[1:NX1,1:NY1,1:NZ1])) pdotq = add.reduce(ravel( p[1:NX1,1:NY1,1:NZ1] * q[1:NX1,1:NY1,1:NZ1])) # Set alpha value alpha = rdotp/pdotq # Update solution and residual u[1:NX1,1:NY1,1:NZ1] += alpha*p[1:NX1,1:NY1,1:NZ1] r[1:NX1,1:NY1,1:NZ1] +=  alpha*q[1:NX1,1:NY1,1:NZ1] # calculate beta rdotq = 0.0 rdotq = add.reduce(ravel(r[1:NX1,1:NY1,1:NZ1]*q[1:NX1,1:NY1,1:NZ1])) beta = rdotq/pdotq # Set the new search direction p[1:NX1,1:NY1,1:NZ1] = r[1:NX1,1:NY1,1:NZ1]  beta*p[1:NX1,1:NY1,1:NZ1] res = sort(ravel(r[1:NX1,1:NY1,1:NZ1]))[1] #find largest residual # resmax = max(resmax,abs(res)) KK+=1 # print "Iteration Number %d Residual %1.2e" %(KK,abs(res)) if (abs(res)<=resmax): break # if residual is small enough break out print "Number of Iterations ",KK   The Numeric Python EM Project http://www.pythonemproject.com 
From: rob <rob@py...>  20020330 16:00:50

Their site is dead here. If anyone has the latest copy of Weave tar'd up that they can send me, I had a bug report to finally make. For some reason, Weave still can't find libstdc++ on FreeBSD. Rob.   The Numeric Python EM Project http://www.pythonemproject.com 
From: Edward C. Jones <edcjones@er...>  20020330 15:54:47

IM (pronounced with a long I) is an Python module that makes it easy to use Numeric and PIL together in programs. Typical functions in IM are: Open: Opens an image file using PIL and converts it to Numeric, PIL, or OpenCV formats. Save: Converts an array to PIL and saves it to a file. Array_ToArrayCast: Converts images between formats and between pixel types. In addition to Numeric and PIL, IM works with the Intel OpenCV computer vision system (http://www.intel.com/research/mrl/research/opencv/). OpenCV is available for Linux at the OpenCV Yahoo Group (http://groups.yahoo.com/group/OpenCV/). IM currently runs under Linux only. It should not be too difficult to port the basic IM system to Windows or Mac. The OpenCV wrapper is large and complex and uses SWIG. It will be harder to port. The IM system appears to be pretty stable. On the other hand, the OpenCV wrapper is probably very buggy. To download the software go to http://members.tripod.com/~edcjones/pycode.html and download "PyCV.032502.tgz". Edward C. Jones edcjones@... 
From: Chad Netzer <cnetzer@ma...>  20020330 02:00:13

> <johanfo@...> writes: >Take a look at the first number in each run ! That is because the random starting seed is (probably, I haven't looked at the code) set from the clock, and doesn't change all that much from run to run. You'll see similar results when you substitute: print "Clock at time:" , i, ":", RandomArray.random_integers(10) or print "Clock at time:" , i, ":", RandomArray.uniform(1, 10) into your code. The part before the decimal point is always the same on the first call of each run (assuming you run them at roughly the same time). Note that the 'seed' is really the internal state of the RNG and changes at each call. You could call the random function a few dozen times before using results, or hash the first result and use that as a new seed, etc. But basically, the generator will produce similar initial results (ie. one call) for similar seeds, which is what the time value is causing. I'd propose that the implementation, when setting the seed from the time, generate at least one dummy RNG generation before returning results.  Chad Netzer chad.netzer at stanfordalumni.org 
From: Tim Churches <tchur@op...>  20020329 22:50:27

Johan Fredrik =D8hman wrote: >=20 > The first numbers in each of your three runs are 7.98493051529 , > 7.98525762558 and 7.98623776436. > They look like different numbers to me. >=20 > First, thanks for your answer Time. > I do agree, they are different. But I wouldn't call it random. I didn= 't expect > that the small difference in the initial seed would affect the first nu= mber with so little. > Usually the seed numbers I have experienced other places have much more > dramatic effect on the numbers, if you see what I mean... OK, you need to use Konrad Hinsen's excellent RNG module which comes with Numeric Python: ################################# # Python Virtual clock import RNG dist =3D RNG.NormalDistribution(10, 2) rng =3D RNG.CreateGenerator(0, dist) for i in range(1000000,10000000,1000000): print "Clock at time:" , i/1000000, ":", rng.ranf() ################################## The above code gives 8.46183655136, 7.29889782477 and 5.58243682462 as the first values in three successive runs on my system. Hope this helps, Tim C >=20 > If you want the difference > between initial values to be greater, you need to make the > difference in your seeds greater. For example, if I run your code now, = I > get 8.29225027561, 8.29484963417 and 8.29744851589, but setting the see= d > to (1,2) gives an initial value of 5.69397783279. Remember, these are > only pseudorandom numbers. >=20 > Yes, they are pseudorandom and that is OK. What I just want is some mo= re > initial difference between the runs without setting the seed number man= ually. > But know I know this is not a flaw in the RNG, but "its the way it is s= upposed to be" >=20 > Thanks >=20 >  > Johan Fredrik Ohman >=20 > _______________________________________________ > Numpydiscussion mailing list > Numpydiscussion@... > https://lists.sourceforge.net/lists/listinfo/numpydiscussion 
From: <johanfo@oh...>  20020329 21:27:42

The first numbers in each of your three runs are 7.98493051529 , 7.98525762558 and 7.98623776436. They look like different numbers to me.=20 First, thanks for your answer Time.=20 I do agree, they are different. But I wouldn't call it random. I = didn't expect that the small difference in the initial seed would affect the first = number with so little. Usually the seed numbers I have experienced other places have much more dramatic effect on the numbers, if you see what I mean... If you want the difference between initial values to be greater, you need to make the=20 difference in your seeds greater. For example, if I run your code now, I get 8.29225027561, 8.29484963417 and 8.29744851589, but setting the seed to (1,2) gives an initial value of 5.69397783279. Remember, these are only pseudorandom numbers.=20 Yes, they are pseudorandom and that is OK. What I just want is some = more initial difference between the runs without setting the seed number = manually. But know I know this is not a flaw in the RNG, but "its the way it is = supposed to be" Thanks  Johan Fredrik Ohman 
From: Tim Churches <tchur@op...>  20020329 21:00:29

> Johan Fredrik =D8hman wrote: >=20 > This code generates very nonrandom numbers, even when the seed value > is reinitialized. > Take a look at the first number in each run ! >=20 The first numbers in each of your three runs are 7.98493051529 , 7.98525762558 and 7.98623776436. They look like different numbers to me. If you want the difference between initial values to be greater, you need to make the=20 difference in your seeds greater. For example, if I run your code now, I get 8.29225027561, 8.29484963417 and 8.29744851589, but setting the seed to (1,2) gives an initial value of 5.69397783279. Remember, these are only pseudorandom numbers.=20 Tim C =20 > Is this right ? >=20 >  > JF=D8 >=20 >=20 > #!/usr/local/bin/python2.1 >=20 > # Python Virtual clock > import RandomArray >=20 > print "Seed", RandomArray.get_seed() > for i in range(1000000,10000000,1000000): > print "Clock at time:" , i/1000000, ":", > RandomArray.normal(10,2) >=20 >=20 > [root@... /root]# ./t2.py > Seed (101743, 1951) > Clock at time: 1 : 7.98493051529 > Clock at time: 2 : 10.8439420462 > Clock at time: 3 : 7.59234881401 > Clock at time: 4 : 7.32021093369 > Clock at time: 5 : 10.9444898367 > Clock at time: 6 : 10.1128772199 > Clock at time: 7 : 13.1178274155 > Clock at time: 8 : 11.779414773 > Clock at time: 9 : 10.7529922128 > [root@... /root]# ./t2.py > Seed (101743, 1953) > Clock at time: 1 : 7.98525762558 > Clock at time: 2 : 9.38142818213 > Clock at time: 3 : 7.11979293823 > Clock at time: 4 : 10.867649436 > Clock at time: 5 : 9.62882992625 > Clock at time: 6 : 12.1940765381 > Clock at time: 7 : 6.84895467758 > Clock at time: 8 : 8.13472533226 > Clock at time: 9 : 8.15638375282 > [root@... /root]# ./t2.py > Seed (101743, 1959) > Clock at time: 1 : 7.98623776436 > Clock at time: 2 : 14.5040078163 > Clock at time: 3 : 11.3408681154 > Clock at time: 4 : 6.32757425308 > Clock at time: 5 : 8.94617521763 > Clock at time: 6 : 12.1802353859 > Clock at time: 7 : 12.0685124397 > Clock at time: 8 : 10.5330892205 > Clock at time: 9 : 10.9744755626 
From: <johanfo@oh...>  20020329 20:02:26

This code generates very nonrandom numbers, even when the seed value is = reinitialized. Take a look at the first number in each run ! Is this right ?  JF=D8 #!/usr/local/bin/python2.1 # Python Virtual clock import RandomArray print "Seed", RandomArray.get_seed() for i in range(1000000,10000000,1000000): print "Clock at time:" , i/1000000, ":", = RandomArray.normal(10,2) [root@... /root]# ./t2.py=20 Seed (101743, 1951) Clock at time: 1 : 7.98493051529 Clock at time: 2 : 10.8439420462 Clock at time: 3 : 7.59234881401 Clock at time: 4 : 7.32021093369 Clock at time: 5 : 10.9444898367 Clock at time: 6 : 10.1128772199 Clock at time: 7 : 13.1178274155 Clock at time: 8 : 11.779414773 Clock at time: 9 : 10.7529922128 [root@... /root]# ./t2.py=20 Seed (101743, 1953) Clock at time: 1 : 7.98525762558 Clock at time: 2 : 9.38142818213 Clock at time: 3 : 7.11979293823 Clock at time: 4 : 10.867649436 Clock at time: 5 : 9.62882992625 Clock at time: 6 : 12.1940765381 Clock at time: 7 : 6.84895467758 Clock at time: 8 : 8.13472533226 Clock at time: 9 : 8.15638375282 [root@... /root]# ./t2.py=20 Seed (101743, 1959) Clock at time: 1 : 7.98623776436 Clock at time: 2 : 14.5040078163 Clock at time: 3 : 11.3408681154 Clock at time: 4 : 6.32757425308 Clock at time: 5 : 8.94617521763 Clock at time: 6 : 12.1802353859 Clock at time: 7 : 12.0685124397 Clock at time: 8 : 10.5330892205 Clock at time: 9 : 10.9744755626 
From: Konrad Hinsen <hinsen@cn...>  20020328 16:27:39

Amitha P <amitha_linux@...> writes: > irrevelent values. I could successfully return single > dimension Python array object but I am not able to > return 2D python array object. I am attaching the > code. Please look at it and point out the errors. > product = (PyArrayObject *)PyArray_FromDimsAndData(2, > dimensions, > PyArray_FLOAT,c); The variable c in this call must point to a storage area which holds the elements of the matrix, i.e. a onedimensional float array. What you pass in your code is a list of pointers to the rows of the matrix. Konrad.   Konrad Hinsen  EMail: hinsen@... Centre de Biophysique Moleculaire (CNRS)  Tel.: +332.38.25.56.24 Rue Charles Sadron  Fax: +332.38.63.15.17 45071 Orleans Cedex 2  Deutsch/Esperanto/English/ France  Nederlands/Francais  
From: Amitha P <amitha_linux@ya...>  20020328 14:58:17

Hi all, I am new to Python/Python extension programming. I am writing a cextension to python which takes a 3Dimensional array object and returns the 2Dimensional array object. The c function returns the 2D array and converts into Python object, but the 2D python array object doesnot contain the correct values, it's priting out some irrevelent values. I could successfully return single dimension Python array object but I am not able to return 2D python array object. I am attaching the code. Please look at it and point out the errors. Thank you very much..  CMATRIXMUL16.c  This takes the array (the python 3D array) and returns the 2D array  #include <stdio.h> #include <math.h> float* cmatrixmul16(float *array,float *paddarr, int n,int r,int col,float **store) { int i,j,k; int devices; int pathpoints; int column; int len; float sum; float **a,**b,**c,**d; float *temp; static float **tracematrix; tracematrix = store; pathpoints=r; column = col; devices= n; len = pathpoints*2; temp = (float *)malloc( len* sizeof(float)); sum =0.0; a = (float **)malloc(devices * sizeof(float)); b = (float **)malloc(devices * sizeof(float)); c = (float **)malloc(devices * sizeof(float)); d = (float **)malloc(devices * sizeof(float)); for(i=0;i<devices;i++) { a[i] = (float *)malloc(pathpoints*sizeof(float)); b[i] = (float *)malloc(pathpoints*sizeof(float)); c[i] = (float *)malloc(pathpoints*sizeof(float)); d[i] = (float *)malloc(pathpoints*sizeof(float)); } for(k=0;k<devices;k++){ for(i=0;i<pathpoints;i++) { a[k][i] = (*(array+k*pathpoints*column+i*column+0))*(1.0/sqrt(2.0)); b[k][i] = (*(array+k*pathpoints*column+i*column+1))*(1.0/sqrt(2.0)); c[k][i] = (*(array+k*pathpoints*column+i*column+2))*(1.0/sqrt(2.0)); d[k][i] = (*(array+k*pathpoints*column+i*column+3))*(1.0/sqrt(2.0)); tracematrix[k][i] = a[k][i]*a[k][i]+b[k][i]*b[k][i]; tracematrix[k][pathpoints+i] = c[k][i]*c[k][i]+d[k][i]*d[k][i]; } fprintf(stderr,"tracematrix: %f\n", tracematrix[k][0]); } for(i=0;i<devices;i++) { free(a[i]); free(b[i]); free(c[i]); free(d[i]); } free(a); free(b); free(c); free(d); return (float *)tracematrix; }  This is the module which calls the function _tests16module.c  #include <Python.h> #include <arrayobject.h> #include <math.h> static PyObject * Py_arraytest1 (PyObject *, PyObject *); static char _tests17_module_doc[] ="tests11: module documentation"; static char arraytest1__doc__[]= "mytest:function documentation"; /********************************Python symbol table *****************************************/ static PyMethodDef _tests17_methods[] = { {"arraytest1" , (PyCFunction)Py_arraytest1 , METH_VARARGS,arraytest1__doc__ }, {NULL, (PyCFunction)NULL,0,NULL } /* terminates the list of methods */ }; /*********************************End of Symbol table ***************************************/ void init_tests17() { /* We will be using Cfunctions defined in the array module. So we * need to be sure that the shared library defining these functions * is loaded. */ import_array(); (void) Py_InitModule4( "_tests17", /* module name */ _tests17_methods, /* structure containing python symbol info */ _tests17_module_doc, /* module documentation string */ (PyObject *) NULL, PYTHON_API_VERSION); } /*function to calculate the product of two arrays */ static PyObject * Py_arraytest1(PyObject *self, PyObject *args) { PyArrayObject *array, *paddarr, *product; char *c; int n,r,col,i,j,k; int dimensions[2]; float **store; if (!PyArg_ParseTuple(args, "O!O!", &PyArray_Type, &array,&PyArray_Type,&paddarr)) return NULL; /* The arguments are the 3D array and the 1Dpaddarr */ n = (long) array>dimensions[0]; r = (long) array>dimensions[1]; col = (long) array>dimensions[2]; store = (float **)malloc(n*sizeof(float)); for(i=0;i<n;i++) store[i]=(float *)malloc(2*r*sizeof(float)); c= (char*)cmatrixmul16((float *)array>data,(float *)paddarr>data,n,r,col,store); dimensions[0] = n; dimensions[1] = 2*r; product = (PyArrayObject *)PyArray_FromDimsAndData(2, dimensions, PyArray_FLOAT,c); PyArray_Return(product); } __________________________________________________ Do You Yahoo!? Yahoo! Movies  coverage of the 74th Academy Awards® http://movies.yahoo.com/ 
From: Jochen <jochen@un...>  20020327 21:00:49

BEGIN PGP SIGNED MESSAGE Hash: SHA1 On Wed, 27 Mar 2002 20:21:38 +0100 Magnus Lie Hetland wrote: Magnus> By the way: Is there any documentation of the numarray C API Magnus> anywhere yet? I think ,  http://stsdas.stsci.edu/numarray/DesignOverview.html ` is all there is for now. And it's probably not exactly right any more... Greetings, Jochen   University of North Carolina phone: +19199624403 Department of Chemistry phone: +19199621579 Venable Hall CB#3290 (Kenan C148) fax: +19198436041 Chapel Hill, NC 27599, USA GnuPG key: 44BCCD8E BEGIN PGP SIGNATURE Version: GnuPG v1.0.6cygwinfcn1 (Cygwin) Comment: Processed by Mailcrypt and GnuPG <http://www.gnupg.org/>; iEYEARECAAYFAjyiMsIACgkQiJ/aUUS8zY6wfgCdHxsqk3NnWRzme0M/6wYcfpKK kA8AoJ0p0Kg05UOwCOk2QkPu6mQft5xj =WLhN END PGP SIGNATURE 
From: Magnus Lie Hetland <magnus@he...>  20020327 19:21:48

Just something I've been thinking about for a few years (and never gotten around to doing anything about)... How realistic would it be to wrap a video file as a type of threedimensional (assuming grayscale) array object and then use e.g. numarray to manipulate it? And how easy would it be to make this sort of thing "lazy", so that only the parts needed for the parts you actually access (for display or whatever) are processed? E.g. (silly example): >>> a = videoarray('somefile.mpg') >>> b = sin(a) # No real computation here >>> for frame in b: ... displayFrame(frame) # Computation performed here... Or something... Or maybe I'm just bonkers ;) By the way: Is there any documentation of the numarray C API anywhere yet?  Magnus Lie Hetland The Anygui Project http://hetland.org http://anygui.org 
From: ¸ô¸¶½ºÅ¸ <mall@ko...>  20020327 14:35:44

<style> <! small {fontsize:8pt;fontfamily:굴림} font,td,p {fontsize: 9pt;textdecoration: none;fontfamily:굴림} <! A:link, A:active, A:visited {color:"#000000"; fontsize:7pt; textdecoration: none} A:hover {textdecoration:none; color:"#666600"} .notice {fontsize:10pt; color:black; textdecoration: none} a.01 {color:#7F7F7F; textdecoration:none} a.01:visited {color:#7F7F7F; textdecoration:none} a.01:hover {color:#4A4A4A; textdecoration:underline} > </style> <base href="C:\Documents and Settings\Administrator\바탕 화면\"></head> <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red"> <p> <table border="0" cellpadding="0" cellspacing="0" width="540" height="504" background="http://www.umaxmall.co.kr/shop/mail/mail_1/44.gif">; <tr> <td width="540" height="23" colspan="10"><p> </p></td> </tr> <tr> <td width="54" height="19"><p> </p></td> <td width="108" height="19" colspan="2"><p align="left"><font size="1"> </font></p></td> <td width="108" height="19" colspan="2"><p align="left"><font size="1"></font> </p></td> <td width="108" height="19" colspan="2"><p align="left"> </p></td> <td width="109" height="19" colspan="2"><p align="center"><font size="1"></font> </p></td> <td width="53" height="19"><p> </p></td> </tr> <tr> <td width="54" height="19"><p> </p></td> <td width="108" height="19" colspan="2"><p align="left"><font size="1"></font> </p></td> <td width="108" height="19" colspan="2"><p align="left"><font size="1"></font> </p></td> <td width="108" height="19" colspan="2"><p align="left"><font size="1"></font> </p></td> <td width="109" height="19" colspan="2"><p align="center"><font size="1"></font> </p></td> <td width="53" height="19"><p> </p></td> </tr> <tr> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="41" height="42"><p> </p></td> <td width="67" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="55" height="42"><p> </p></td> <td width="53" height="42"><p> </p></td> </tr> <tr> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="41" height="42"><p> </p></td> <td width="67" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="55" height="42"><p> </p></td> <td width="53" height="42"><p> </p></td> </tr> <tr> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="41" height="42"><p> </p></td> <td width="67" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="55" height="42"><p> </p></td> <td width="53" height="42"><p> </p></td> </tr> <tr> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="41" height="42"><p> </p></td> <td width="67" height="42"><p> </p></td> <td width="54" height="42"><p> </p></td> <td width="55" height="42"><p> </p></td> <td width="53" height="42"><p> </p></td> </tr> <tr> <td width="54" height="36"><p> </p></td> <td width="54" height="36"><p> </p></td> <td width="54" height="36"><p> </p></td> <td width="54" height="36"><p> </p></td> <td width="54" height="36"><p> </p></td> <td width="41" height="36"><p> </p></td> <td width="67" height="36"><p> </p></td> <td width="54" height="36"><p> </p></td> <td width="55" height="36"><p> </p></td> <td width="53" height="36"><p> </p></td> </tr> <tr> <td width="54" height="29"><p> </p></td> <td width="54" height="29"><p> </p></td> <td width="54" height="29"><p> </p></td> <td width="54" height="29"><p> </p></td> <td width="54" height="29"><p> </p></td> <td width="41" height="29"><p> </p></td> <td width="67" height="29"><p> </p></td> <td width="54" height="29"><p> </p></td> <td width="55" height="29"><p> </p></td> <td width="53" height="29"><p> </p></td> </tr> <tr> <td width="54" height="31"><p> </p></td> <td width="54" height="31" rowspan="2" colspan="4"><p><img src="http://www.umaxmall.co.kr/shop/mail/mail_1/sale_2.GIF"; width="216" height="60" border="0"></p></td> <td width="41" height="31"><p> </p></td> <td width="67" height="31"><p> </p></td> <td width="54" height="31"><p> </p></td> <td width="55" height="31"><p> </p></td> <td width="53" height="31"><p> </p></td> </tr> <tr> <td width="54" height="31"><p> </p></td> <td width="41" height="31"><p> </p></td> <td width="67" height="31"><p> </p></td> <td width="54" height="31"><p> </p></td> <td width="55" height="31"><p> </p></td> <td width="53" height="31"><p> </p></td> </tr> <tr> <td width="54" height="47"><p> </p></td> <td height="47"><p> </p></td> <td height="47"><p> </p></td> <td height="47"><p> </p></td> <td height="47"><p> </p></td> <td width="41" height="47"><p> </p></td> <td width="229" height="85" rowspan="2" colspan="4"><p><a href="http://www.umaxmall.co.kr"><img src="http://www.umaxmall.co.kr/shop/mail/mail_1/right.gif"; width="229" height="81" border="0"></a></p></td> </tr> <tr> <td width="54" height="38"><p> </p></td> <td height="38"></td> <td height="38"></td> <td height="38"></td> <td height="38"></td> <td width="41" height="38"></td> </tr> <tr> <td width="108" height="52" colspan="2"><p align="center"> <img src="http://www.umaxmall.co.kr/shop/mail/mail_1/im_stamp.gif"; width="45" height="45" border="0"></p></td> <td width="379" height="52" colspan="7"><p align="left" valign="top"><font color="black">허락없이 메일을 보내서 죄송합니다. 이 메일은 </font>웹서핑중, <b>무작위로 추출한것이며</b> EMail 주소 외에, 다른 정보는 갖고 있지 않습니다. <font color="black">메일 수신을 원치 않으시면 </font><font color="red"><b><A href="mailto:discorp@...?subject=수신거부&body=더이상numpydiscussion@...로 메일을 보내지 마세요..">수신거부</A></b></font><font color="black">를 해주십시요. 만약 불필요한 정보였다면 사과 드립니다 </font></p></td> <td width="53" height="52"><p> </p></td> </tr> <tr> <td width="540" height="11" colspan="10"><p> </p></td> </tr> </table></p> </body> 
From: Travis Oliphant <oliphant.travis@ie...>  20020325 00:48:32

On Sunday 24 March 2002 02:38 pm, you wrote: > Hello, > > while writing a test driver for a minimum phase calculation routine I came > across the following problem. It is causing asymmetriesin the output of > > >>> N=512 > >>> lastpoint=2*pi > >>> w1=arange(0,lastpoint,lastpoint/N) > >>> w2=arange(0,N)*(lastpoint/N) > >>> lastpointw1[511]w1[1] > > 6.3546390371982397e014 > > >>> lastpointw2[511]w2[1] > > 4.0245584642661925e016 > > >>> w1[511] > > 6.2709134608765646 > > >>> w2[511] > > 6.2709134608765007 > > >>> w2[511]w1[511] > > 6.3948846218409017e014 > I just fixed this in Numeric. The arange in Numeric used to increment the value by the step amount. It now computes the value using value = start + i*step which fixes the problem. Thanks for pointing this out. 
From: Pearu Peterson <pearu@ce...>  20020324 17:58:28

Hi, Nummies might be interested how to wrap C codes with f2py. On Wed, 20 Mar 2002, Paul Dubois wrote: > For example, if you have this C code: > > double mydot(int n, double* x, double *y) { > int i; > double d; > d = 0.0; > for (i=0; i < n; ++i) d += x[i] * y[i]; > return d; > } > > Then you can create a Pyfort input file mymod.pyf: > function mydot (n, x, y) > integer:: n=size(x) > doubleprecision x(n), y(n) > doubleprecision mydot > end Different from pyfort, f2py needs the following signature file: python module mymod interface function mydot (n, x, y) intent(c) mydot integer intent(c):: n=size(x) doubleprecision x(n), y(n) doubleprecision mydot end end interface end python module > > Compile mydot.c into a library libmydot.a. > Then: > > pyfort c cc i L. l mydot mymod.pyf > > builds and installs the module mymod containing function mydot, With f2py the above is equivalent to f2py c mydot.c mymod.pyf This compiles mydot.c and builds the module mymod into the current directory. > which you > can use from Python: > > import Numeric, mymod > x=Numeric.array([1.,2.3.]) > y=Numeric.array([5., 1., 1.]) > print mymod.mydot(x,y) Python session with f2py generated mymod: >>> import mymod >>> print mymod.mydot([1,2,3],[1,2,4.]) 17.0 Regards, Pearu 
From: Paul F Dubois <paul@pf...>  20020324 16:48:58

Pyfort 7.0b2 is now available at sf.net/projects/pyfortran. Nummies who do not use Fortran may be interested in using Pyfort; with Michiel de Hoon's "C" option, it is now extremely easy to wrap a simple kind of C code for processing Numeric's arrays, like this: double ctry(int n, double* x, double* y) { int i; double d; d = 0.0; for (i=0; i < n; ++i) { d += x[i] * y[i]; } return d; } void cout(int n, double* x, double* y) { int i; for (i = 0; i < n; ++i) { y[i] = 1.414159 * x[i]; } } double c2(int n, int m, double x[n][m]) { double sum = 0.0; int i, j; for (i=0; i < n; i++) { for (j=0; j < m; j++) { sum += x[i][j]; } } return sum; } and then call it from Python like this: import testc, Numeric x = Numeric.array([1.,2.,3.]) y = Numeric.array([6.,1.,1.]) z = Numeric.arange(6) *1.0 z.shape=(3,2) print "Should be 1.0:", testc.ctry(x,y) print "Should be sqrt(2) * [1,2,3]:", testc.cout(x) print "Should be 15.0:", testc.c2(z) z.shape=(2,3) print "Should be 15.0:", testc.c2(z)  notes Somehow 7.0b1 was missing the C examples. I apparently lost the changes I had made to the MANIFEST and did not realize my CVS commits had failed. Bad day at the office, I guess. I added testc back in, and added a 2dimensional example. I also eliminated some warning errors in the generated code, and fixed an error in that case. My thanks to Michiel de Hoon and J.S. Whitaker. 
From: Huaiyu Zhu <huaiyu_zhu@ya...>  20020323 08:31:04

On Thu, 21 Mar 2002, Pearu Peterson wrote: > On 20 Mar 2002, Jochen K=FCpper wrote: > > >>>> a > > Aureli> array([0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) > > >>>> b > > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) > >=20 > > >>>> Numeric.logical_and(a,b) > > Aureli> array([0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) > >=20 > > This look's correct... > >=20 > > >>>> a and b > > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) > >=20 > > ... and this suspiciously like b. >=20 > . and also correct. It is default behaviour of Python `and' > operation. From Python Language Reference: >=20 > The expression `x and y' first evaluates `x'; if `x' is false, its va= lue =20 > is returned; otherwise, `y' is evaluated and the resulting value is > returned.=20 >=20 > So, `and' operation is "object"operation (unless redefined to somethin= g > else) while logical_and is "elementwise"operation. There is a section in PEP225 for elementwise/objectwise operators to=20 extend the meaning of ~ to an "elementizer", so that=20 [1, 0, 1, 0] and [0, 1, 1, 0] =3D> [0, 1, 1, 0] [1, 0, 1, 0] ~and [0, 1, 1, 0] =3D> [0, 0, 1, 0] There are several other places, entirely unrelated to numerical=20 computation, that elementization of an operator makes sense. Huaiyu 
From: Pearu Peterson <pearu@ce...>  20020321 07:57:43

On 20 Mar 2002, Jochen K=FCpper wrote: > >>>> a > Aureli> array([0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) > >>>> b > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) >=20 >=20 > >>>> Numeric.logical_and(a,b) > Aureli> array([0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) >=20 > This look's correct... >=20 > >>>> a and b > Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) >=20 > ... and this suspiciously like b. =2E. and also correct. It is default behaviour of Python `and' operation. From Python Language Reference: The expression `x and y' first evaluates `x'; if `x' is false, its value = =20 is returned; otherwise, `y' is evaluated and the resulting value is returned.=20 So, `and' operation is "object"operation (unless redefined to something else) while logical_and is "elementwise"operation. Pearu 
From: Jochen <jochen@jo...>  20020321 03:05:28

BEGIN PGP SIGNED MESSAGE Hash: SHA1 On Wed, 20 Mar 2002 19:43:03 +0100 Aureli Soria Frisch wrote: >>>> a Aureli> array([0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) >>>> b Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) >>>> Numeric.logical_and(a,b) Aureli> array([0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) This look's correct... >>>> a and b Aureli> array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) ... and this suspiciously like b. Greetings, Jochen   Einigkeit und Recht und Freiheit http://www.JochenKuepper.de Liberté, Égalité, Fraternité GnuPG key: 44BCCD8E Sex, drugs and rocknroll BEGIN PGP SIGNATURE Version: GnuPG v1.0.6 (GNU/Linux) Comment: Processed by Mailcrypt and GnuPG <http://www.gnupg.org/>; iD8DBQE8mU3jiJ/aUUS8zY4RAnxdAKCfrCyep4b7TKoF+c631cJiX53GmACgtmGo jcS9gt6j1eJJj937JqoUm6M= =TyKW END PGP SIGNATURE 
From: Paul Dubois <paul@pf...>  20020320 21:13:20

A beta version of Pyfort 7.0 is available at pyfortran.sf.net. The documentation is not yet upgraded to this version. Pyfort 7.0 adds the ability to wrap Fortranlike C coding to extend Numpy. Dramatically illustrating the virtue of open source software, credit for this improvement goes to: Michiel de Hoon Human Genome Center University of Tokyo For example, if you have this C code: double mydot(int n, double* x, double *y) { int i; double d; d = 0.0; for (i=0; i < n; ++i) d += x[i] * y[i]; return d; } Then you can create a Pyfort input file mymod.pyf: function mydot (n, x, y) integer:: n=size(x) doubleprecision x(n), y(n) doubleprecision mydot end Compile mydot.c into a library libmydot.a. Then: pyfort c cc i L. l mydot mymod.pyf builds and installs the module mymod containing function mydot, which you can use from Python: import Numeric, mymod x=Numeric.array([1.,2.3.]) y=Numeric.array([5., 1., 1.]) print mymod.mydot(x,y) Note that by wrapping mydot in this way, Pyfort takes care of problems like converting input arrays of the wrong type, such as integer; making sure that x and y have the same length; and making sure x and y are contiguous. I added directory testc that contains an example like this and one where an array is output. Mr. de Hoon explained his patch as follows. "I have modified fortran_compiler.py to add gcc as a compiler. This enables pyfort to be used for C code instead of Fortran code only. To use this option, call pyfort with the cgcc option to specify gcc as the compiler. In order to switch off the default TRANSPOSE and MIRROR options, some small modifications were needed in generator.py also. [Editor's note: both c gcc and c cc will work] Before writing this addition to pyfort, I tried to use swig to generate the wrapper for my C code. However, pyfort was easier to use in my case because it is integrated with numpy. I wasn't able to get swig use numpy arrays. In addition, I am writing extension code both in fortran and C, so it is easier having to use only one tool (pyfort) for both. In a sense, it is easier to extend python with C than with fortran because you don't have to worry about transposing the array. I tried to be minimally instrusive on the existing pyfort code to switch off transposing arrays; there may be prettier ways to do this than what I have done. With this modification, I was able to pass one and twodimensional numpy arrays from Python to C and back without problems, as well as scalar variables with intent(in) and intent(out). I have also used the modified Pyfort on some Fortran routines to make sure I didn't break something in the fortran part of Pyfort. I haven't done an extensive test of this addition, but I haven't found any problems with it so far. I hope this patch will be useful to other people trying to extend Python/numpy with C routines." Michiel de Hoon Human Genome Center University of Tokyo mdehoon@... 
From: Aureli Soria Frisch <Aureli.Soria_F<risch@ip...>  20020320 18:47:08

Hi all, In the version of Numeric with MacPython2.2 the functions "Numeric.logical_and" and "and" behave different, although up to the online documentation they should behave the same: >>> Numeric.logical_and(a,b) array([0, 1, 0, 0, 0, 0, 1, 0, 0, 0]) >>> a and b array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) for arrays: >>> a array([0, 1, 0, 0, 1, 0, 1, 0, 0, 1]) >>> b array([1, 1, 0, 1, 0, 0, 1, 1, 1, 0]) or am I misunderstood something...? Regards, Aureli ################################# Aureli Soria Frisch Fraunhofer IPK Dept. Pattern Recognition post: Pascalstr. 89, 10587 Berlin, Germany email: aureli@... fon: +49 30 39006150 fax: +49 30 3917517 web: http://vision.fhg.de/~aureli/webaureli_en.html ################################# 
From: Prabhu Ramachandran <prabhu@ae...>  20020320 18:22:01

hi, I'm sorry I havent been following the discussion too closely and this post might be completely unrelated. >>>>> "AS" == A Schmolck <a.schmolck@...> writes: AS> Ideally , I'd like to see a slim core numarray, without any AS> frills (and more streamlined to behave like standard python AS> containers (e.g. indexing and type/casts behavior)) for the AS> python core, something more enabled and efficient for numerics AS> (including matrices!) as a seperate package (like the XML AS> example you quote). And then maybe a bigger prebundled AS> collection of (ideally rather modular) numerical libraries for AS> really hardcore scientific users (maybe in the spirit of AS> xemacspackages and sumotarballs  no bloat if you don't AS> need it, plenty of features in an instant if you do). AS> Anyway, is there at least general agreement that there should AS> be some new and wonderful matrix class (plus supporting AS> libraries) somewhere (rather than souping up array)? Ideally, I'd like something that also has a reasonably easy to use interface from C/C++. The idea is that it should be easy (and natural) for someone to use the same library from C/C++ when performance was desired. This would be really nice and very useful. prabhu 
From: Tim Peters <tim.one@co...>  20020320 02:20:45

[jochen@...] > Thanks for the quick answer. The problem is resolved. Cool! Glad to hear it. > Well, changing cvs from > release22maint > to > r221c1 > helps. That is, everything seems to work fine with the cvs sources > tagged r221c1. That shouldn't have made any difference  r221c1 is merely a tag on the release22maint branch. Now I can spend a lot of time trying to guess why your checkout is screwed up (probably stale sticky flags, if it is), or you can try blowing away your checkout and starting over. I know which one gets my vote <wink>. CVS branches and tags are a nightmare: when in any doubt, kill the beast and start over. > Then, is it really necessary to mess up the cvs tags so much? Why > isn't it possible to have a single python2.2 branch which one could > follow to get all the stuff that's incorporated into that version? That's what the release22maint branch is supposed to be (and, AFIAK, is). > There are huge differences between release22maint and r221c1, What makes you think so? I just did cvs diff r release22maint r r221c1 and it turned up expected differences in the handful of files that indeed *have* changed since r221c1 was tagged, mostly in the docs and under the Mac subdirectory: Index: Doc/lib/libcopyreg.tex Index: Doc/lib/libthreading.tex Index: Lib/urllib.py Index: Mac/_checkversion.py Index: Mac/Build/PythonCore.mcp Index: Mac/Distributions/(vise)/Python 2.2.vct Index: Mac/Include/macbuildno.h Index: Mac/Modules/macfsmodule.c Index: Mac/Modules/macmodule.c Index: Misc/NEWS Index: PCbuild/BUILDno.txt > ... > Thanks for all your work, and thank you for the quick help again. And thanks for checking that your problem is fixed in 221c1. Had anyone tried this stuff in 22a1 or 22a2 or 22a3 or 22a4 or 22b1 or 22b2 or 22c1 (yes, we actually cut 7 full prerelease distributions for 2.2!), it would have worked in 2.2 out of the box. Keep that in mind when 2.3a1 comes out <wink>. 