[Numpy-discussion] sum up to a specific value

2010-07-01 Thread Renato Fabbri
hi, i need to find which elements of an array sums up to an specific value any idea of how to do this? best, rf -- GNU/Linux User #479299 skype: fabbri.renato ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] sum up to a specific value

2010-07-01 Thread Pauli Virtanen
Thu, 01 Jul 2010 06:17:50 -0300, Renato Fabbri wrote: i need to find which elements of an array sums up to an specific value any idea of how to do this? Sounds like the knapsack problem http://en.wikipedia.org/wiki/Knapsack_problem ___

Re: [Numpy-discussion] sum up to a specific value

2010-07-01 Thread Vincent Davis
On Thu, Jul 1, 2010 at 3:17 AM, Renato Fabbri renato.fab...@gmail.com wrote: hi, i need to find which elements of an array sums up to an specific value any idea of how to do this? Not sure if there is a better way but a brut force way would be to a array([[ 7., 5., 9., 3.], [ 7.,

Re: [Numpy-discussion] sum up to a specific value

2010-07-01 Thread Renato Fabbri
just a solution (not all of them) and the application happen to come up with something like 10k values in the array. don care waiting, but... 2010/7/1 Vincent Davis vinc...@vincentdavis.net: On Thu, Jul 1, 2010 at 3:17 AM, Renato Fabbri renato.fab...@gmail.com wrote: hi, i need to find

Re: [Numpy-discussion] sum up to a specific value

2010-07-01 Thread Pauli Virtanen
to, 2010-07-01 kello 11:46 -0300, Renato Fabbri kirjoitti: just a solution (not all of them) and the application happen to come up with something like 10k values in the array. don care waiting, but... As said, the problem is a well-known one, and it's not really Python or Numpy-specific, so