Re: [Numpy-discussion] design patterns for computing

2007-10-17 Thread Alan G Isaac
It sounds to me like you have something closer to the following. class Problem - initialized with an Input instance and an Analysis instance - has a ``get_results`` method that asks the Analysis instance to - call ``get_input`` on Input instance - run analysis on the provided

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > > The problem is I don't have time for this at the moment, I have to > develop > > my algorithm for my PhD, and if one does not work, I'll try another one, > but > > this is strange because this algorithm worked in the past... > > By incentive, I meant incentive for me, not for you :) I think t

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
On 10/17/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > > > > I'll try it this night (because it is very very long, so with the > > > simulator...) > > Yes, that's the worse cases, of course. For those cases, I wish we could > > use numpy with COUNT_ALLOCS. Unfortunately, using numpy in this cas

[Numpy-discussion] design patterns for computing

2007-10-17 Thread Renato Serodio
Hello there, some helpful pointers provided in the list have put me on track to ask further questions. Now that I'm acquainted with simulating interfaces and duck-typing (which is still a bit fuzzy to me) I think the information I've been looking for all along are the so-called 'design patterns'.

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > > I'll try it this night (because it is very very long, so with the > > simulator...) > Yes, that's the worse cases, of course. For those cases, I wish we could > use numpy with COUNT_ALLOCS. Unfortunately, using numpy in this case is > impossible (it crashes at import, and I've never tracked d

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
Matthieu Brucher wrote: > > > I agree with you, the problem is that I do not use directly C > > functions and that I do not know how I can reproduce the result > with a > > minimal example. > Yes, that's why I suggested looking at the memory usage (using top or > something e

Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread René Bastian
Hello, I work with numarray.zeros(n, numarray.Float64) as sound mixers ; there are huge number of datas : 44 000 .. 192 000 /second Operations : add, append, add & append (if the mixing begins on the existing part of the array + append if the array has to be prolonged) I do never use list-append

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > > I agree with you, the problem is that I do not use directly C > > functions and that I do not know how I can reproduce the result with a > > minimal example. > Yes, that's why I suggested looking at the memory usage (using top or > something else). Because maybe the problem can be spotted lon

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
Matthieu Brucher wrote: > > As said, my approach to debugging this kind of thing is to get out of > python ASAP. And once you manage to reproduce the result when calling > only a couple of python functions, then you use massif or memcheck. > > > I agree with you, the problem is that I d

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > As said, my approach to debugging this kind of thing is to get out of > python ASAP. And once you manage to reproduce the result when calling > only a couple of python functions, then you use massif or memcheck. I agree with you, the problem is that I do not use directly C functions and that

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
Matthieu Brucher wrote: > > > I wish I could, but this behaviour only shows up on this > peculiar data > > set :( > It always happens at the same time ? > > > Yes. > Perhaps debugging the process will sort things out ? As said, my approach to debugging this kind of thing is to get o

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > > I wish I could, but this behaviour only shows up on this peculiar data > > set :( > It always happens at the same time ? Yes. Perhaps debugging the process will sort things out ? > Unfortunately, the process is very long, there are several > > optimizations in the process, the whole thing

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
Matthieu Brucher wrote: > > Can't you emulate this behaviour with signals different than images ? > (say random signal of 64*64*64*3 samples). > > > > I wish I could, but this behaviour only shows up on this peculiar data > set :( It always happens at the same time ? > > Unfortunately, th

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
Oups, I'm wrong, the process happened this time with the 128² images and not the 3D images. I'll try to check a little bit further. Matthieu 2007/10/17, Matthieu Brucher <[EMAIL PROTECTED]>: > > Can't you emulate this behaviour with signals different than images ? > > (say random signal of 64*64*

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > Can't you emulate this behaviour with signals different than images ? > (say random signal of 64*64*64*3 samples). I wish I could, but this behaviour only shows up on this peculiar data set :( If the process does not > require a long processing time (say a couple of minutes), then you may

Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread Chad Kidder
Growing an array by appending it is the slow way in matlab. The suggested way to do things there is preallocate the array by saying x=zeros() and then referencing the elements in the array and inserting the correct value. --Chad Kidder On Oct 17, 2007, at 7:16 AM, mark wrote: So i

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread David Cournapeau
Matthieu Brucher wrote: > > There are two types of errors that can occur with reference > counting on > data-types. > > 1) There are too many DECREF's --- this gets us to the error > quickly and > is usually easy to reproduce > 2) There are too many INCREF's (the referen

Re: [Numpy-discussion] Error in deallocation ?

2007-10-17 Thread Matthieu Brucher
> > There are two types of errors that can occur with reference counting on > data-types. > > 1) There are too many DECREF's --- this gets us to the error quickly and > is usually easy to reproduce > 2) There are too many INCREF's (the reference count keeps going up until > the internal counter wra

Re: [Numpy-discussion] appending extra items to arrays

2007-10-17 Thread mark
So it seems like lists are the way to grow an array. Interestingly enough, it is very easy to grown an array in Matlab. Any idea how they do that (or are they slow as well?). Mark On Oct 11, 8:53 pm, "Adam Mercer" <[EMAIL PROTECTED]> wrote: > On 11/10/2007, Mark Janikas <[EMAIL PROTECTED]> wrote

Re: [Numpy-discussion] abstraction and interfaces

2007-10-17 Thread Matthieu Brucher
What is more, with the concept of duck-typing, you just have to provide the interface without inheriting from a mother class (which is what I do for the optimizer framework, the other sub-modules do not derive from a common ancestor). Matthieu 2007/10/17, Renato Serodio <[EMAIL PROTECTED]>: > > H

Re: [Numpy-discussion] A basic question on the dot function

2007-10-17 Thread Matthieu Brucher
> > what I'm searching for is : > > In [18]: dotprod2(a,b) > Out[18]: array([ 0.28354876, 0.54474092, 0.22986942, 0.42822669, > 0.98179793]) > > where I defined a "classical" (in the way I understand it. I may not > understand it properly ?) dot product between these 2 vectors. > > def dotprod2(

Re: [Numpy-discussion] A basic question on the dot function

2007-10-17 Thread Julien Hillairet
2007/10/16, Timothy Hochberg <[EMAIL PROTECTED]>: > > > You might try tensordot. Without thinking it through too much: > numpy.tensordot(a0, a1, axes=[-1,-1]) > seems to do what you want. > > Thank you. However, it works only for this simple example, where a0 and a1 are similar. The tensor product

Re: [Numpy-discussion] abstraction and interfaces

2007-10-17 Thread Renato Serodio
Hello there, thanks to your pointer, I've progressed further on the OO concept, and am currently building analysis, inputData and outputResults interfaces that should add some flexibility to my program. On the other hand, pulling the OO and interfaces string opened a box full of little critters,