On Sat, Sep 22, 2007 at 09:58:33AM -0600, Charles R Harris wrote:
>Umm... that doesn't look quite right. Shouldn't it be something like
Puzzling. My implementation works, as far as I could test it, which I did
as much as I could. Maybe the two are equivalent.
>Algorithm L can be chunked p
On 9/22/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> On Sat, Sep 22, 2007 at 10:35:16AM +0200, Gael Varoquaux wrote:
> > I would go for the "generate_fourplets" solution if I had a way to
> > calculate the binomial coefficient without overflows.
>
> Sorry, premature optimisation is the root of
On Sat, Sep 22, 2007 at 10:35:16AM +0200, Gael Varoquaux wrote:
> I would go for the "generate_fourplets" solution if I had a way to
> calculate the binomial coefficient without overflows.
Sorry, premature optimisation is the root of all evil, but turning ones
brain on early is good.
"""
On Fri, Sep 21, 2007 at 06:40:52PM -0600, Charles R Harris wrote:
>def triplet(n) :
>out = []
>for i in xrange(2,n) :
>for j in xrange(1,i) :
>for k in xrange(0,j) :
>out.append((i,j,k))
>return out
I need quadruplets, num
Gael,
The pure Pythonic solution is a list comprehension involving multiple sequences:
x = range(0,n)
y = x
z = x
t = [(xx,yy,zz) for xx in x for yy in y for zz in z]
You don't need subscripting, or recursive fns, or Knuth.
Runtime is almost instant (for n=10).
All the NumPy solutions look more
On 9/21/07, Gary Ruben <[EMAIL PROTECTED]> wrote:
>
> Gael Varoquaux wrote:
> > On Fri, Sep 21, 2007 at 02:58:43PM -0600, Charles R Harris wrote:
> >>I found generators a good approach to this sort of thing:
> >
> >>for (i,j,k) in triplets(n) :
> >
> > That's what we where doing so far, bu
Gael Varoquaux wrote:
> On Fri, Sep 21, 2007 at 02:58:43PM -0600, Charles R Harris wrote:
>>I found generators a good approach to this sort of thing:
>
>>for (i,j,k) in triplets(n) :
>
> That's what we where doing so far, but in the code itself. The result was
> unbearably slow.
> I thin
On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> On Fri, Sep 21, 2007 at 02:58:43PM -0600, Charles R Harris wrote:
> >I found generators a good approach to this sort of thing:
>
> >for (i,j,k) in triplets(n) :
>
> That's what we where doing so far, but in the code itself. The resu
On Fri, Sep 21, 2007 at 02:58:43PM -0600, Charles R Harris wrote:
>I found generators a good approach to this sort of thing:
>for (i,j,k) in triplets(n) :
That's what we where doing so far, but in the code itself. The result was
unbearably slow.
I think for our purposes we should build a
On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> On Fri, Sep 21, 2007 at 02:33:42PM -0600, Charles R Harris wrote:
> >I wrote up some of the combinatorial algorithms in python a few years
> ago
> >for my own use in writing a paper, ( Harris, C. R. Solution of the
> >aliasing an
On Fri, Sep 21, 2007 at 02:33:42PM -0600, Charles R Harris wrote:
>I wrote up some of the combinatorial algorithms in python a few years ago
>for my own use in writing a paper, ( Harris, C. R. Solution of the
>aliasing and least squares problems of spaced antenna interferometric
>me
On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> On Fri, Sep 21, 2007 at 01:52:31PM -0600, Charles R Harris wrote:
> >Go here, http://www.cs.utsa.edu/~wagner/knuth/. I think you want
> fascicle
> >4A, http://www.cs.utsa.edu/~wagner/knuth/fasc4a.pdf. Some of the
> fascicles
> >f
On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> On Fri, Sep 21, 2007 at 01:52:31PM -0600, Charles R Harris wrote:
> >Go here, http://www.cs.utsa.edu/~wagner/knuth/. I think you want
> fascicle
> >4A, http://www.cs.utsa.edu/~wagner/knuth/fasc4a.pdf. Some of the
> fascicles
> >f
On Fri, Sep 21, 2007 at 01:52:31PM -0600, Charles R Harris wrote:
>Go here, http://www.cs.utsa.edu/~wagner/knuth/. I think you want fascicle
>4A, http://www.cs.utsa.edu/~wagner/knuth/fasc4a.pdf. Some of the fascicles
>from Vol 4 of TAOCP are now in print, http://tinyurl.com/2goxpr.
:->
On 9/21/07, Charles R Harris <[EMAIL PROTECTED]> wrote:
>
>
>
> On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > I want to generate all the possible triplets of integers in [0, n]. I am
> > wondering want the best possible way to do this is.
> >
> > To make things clear
On 9/21/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I want to generate all the possible triplets of integers in [0, n]. I am
> wondering want the best possible way to do this is.
>
> To make things clearer, I could generate i, j, k using indices:
>
> i, j, k = indices((n, n, n))
>
Hi all,
I want to generate all the possible triplets of integers in [0, n]. I am
wondering want the best possible way to do this is.
To make things clearer, I could generate i, j, k using indices:
i, j, k = indices((n, n, n))
But I will have several times the same triplet with different ordenin
17 matches
Mail list logo