Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 10 years ago

Phoenix gravatar image

How to make "zip" work faster?

I have these two finite sets A and B where the size of A is typically much larger than the size of B. I am trying to enumerate all possible maps from B to A using the following idea - but this turns out to be very slow.

  • Is there a way to speed this up?

    • Without the over all "for i" loop can I access any one of the "k"s? (for every i each l is a list of tuples)

    How can I just pick out any one such "k" list without wanting to wait for the whole code to run.

    from itertools import product
    
    for i in product(A,repeat = len (B)):
    
    k = zip(B,i)
    S.append(k)
    
    
    show(S)

click to hide/show revision 2
No.2 Revision

How to make "zip" work faster?

I have these two finite sets A and B where the size of A is typically much larger than the size of B. I am trying to enumerate all possible maps from B to A using the following idea - but this turns out to be very slow.

  • Is there a way to speed this up?

    • Without the over all "for i" loop can I access any one of the "k"s? (for every i each l is a list of tuples)

    How can I just pick out any one such "k" list without wanting to wait for the whole code to run.

    from itertools import product
    
    for i in product(A,repeat = len (B)):
    
     k = zip(B,i)
     S.append(k)
    
    
    show(S)

click to hide/show revision 3
No.3 Revision

How to make "zip" work faster?

I have these two finite sets A and B where the size of A is typically much larger than the size of B. (typically |A| 200500 and |B| 1050) I am trying to enumerate all possible maps from B to A using the following idea - but this turns out to be very slow.

  • Is there a way to speed this up?

    • Without the over all "for i" loop can I access any one of the "k"s? (for every i each l is a list of tuples)

    How can I just pick out any one such "k" list without wanting to wait for the whole code to run.

    from itertools import product
    
    for i in product(A,repeat = len (B)):
    
        k = zip(B,i)
        S.append(k)
    
    
    show(S)

click to hide/show revision 4
No.4 Revision

How to make "zip" work faster?

I have these two finite sets A and B where the size of A is typically much larger than the size of B. (typically $|A| ~ is 200-500and|B| ~ is 10-50)IamtryingtoenumerateallpossiblemapsfromBtoA$ using the following idea - but this turns out to be very slow.

  • Is there a way to speed this up?

    • Without the over all "for i" loop can I access any one of the "k"s? (for every i each l is a list of tuples)

    How can I just pick out any one such "k" list without wanting to wait for the whole code to run.

    from itertools import product
    
    for i in product(A,repeat = len (B)):
    
        k = zip(B,i)
        S.append(k)
    
    
    show(S)

click to hide/show revision 5
No.5 Revision

How to make "zip" work faster?

I have these two finite sets A and B where the size of A is typically much larger than the size of B. (typically |A|is200500 and |B|is1050) I am trying to enumerate all possible maps from B to A using the following idea - but this turns out to be very slow.

  • Is there a way to speed this up?

    • Without the over all "for i" loop can I access any one of the "k"s? (for every i each l is a list of tuples)

    How can I just pick out any one such "k" list without wanting to wait for the whole code to run.

    S = []
    from itertools import product
    
    for i in product(A,repeat = len (B)):
    
        k = zip(B,i)
        S.append(k)
    
    
    show(S)