Would a patch with a function for incrementing an array with advanced indexing be accepted?
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
Hello, If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement. If you compile and install that branch, you can test the code using: from numpy import * from numpy.core.multiarray import index_increment a = arange(12).reshape((3,4)) index = ([1,1,2,0], [0,0,2,3]) vals = [50,50., 30.,16] b = index_increment(a, index, vals) print b """ should print out: [[ 0. 1. 2. 19.] [ 104. 5. 6. 7.] [ 8. 9. 40. 11.]] """ Cheers, John
![](https://secure.gravatar.com/avatar/6c8561779fff34c62074c614d19980fc.jpg?s=120&d=mm&r=g)
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request. Thanks, -Travis
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial? On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io>wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/082c34b6c1544c177cb7a66609360089.jpg?s=120&d=mm&r=g)
Hi, I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said. Fred On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
Right, that makes sense. Thanks. On Tue, Jun 26, 2012 at 11:34 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Fred
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented,
http://comments.gmane.org/gmane.comp.python.numeric.general/50291.
I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote: this be
accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/6c8561779fff34c62074c614d19980fc.jpg?s=120&d=mm&r=g)
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying. -Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
I've submitted a pull request ( https://github.com/numpy/numpy/pull/326 ). I'm new to the numpy and python internals, so feedback is greatly appreciated. On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <travis@continuum.io>wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing
crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented,
http://comments.gmane.org/gmane.comp.python.numeric.general/50291.
I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like
something this be
accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/082c34b6c1544c177cb7a66609360089.jpg?s=120&d=mm&r=g)
Hi, I personnaly can't review this as this is too much in NumPy internal. My only comments is that you could add a test and an example in the doc for matrix[list]. I think it will be the most used case. Fred On Wed, Jun 27, 2012 at 7:47 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
I've submitted a pull request ( https://github.com/numpy/numpy/pull/326 ). I'm new to the numpy and python internals, so feedback is greatly appreciated.
On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the last two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
Hi Fred, That's an excellent idea, but I am not too familiar with this use case. What do you mean by list in 'matrix[list]'? Is the use case, just incrementing in place a sub matrix of a numpy matrix? John On Fri, Jun 29, 2012 at 11:43 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I personnaly can't review this as this is too much in NumPy internal.
My only comments is that you could add a test and an example in the doc for matrix[list]. I think it will be the most used case.
Fred
I've submitted a pull request ( https://github.com/numpy/numpy/pull/326 ). I'm new to the numpy and python internals, so feedback is greatly appreciated.
On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code
for
advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <
On Wed, Jun 27, 2012 at 7:47 PM, John Salvatier <jsalvati@u.washington.edu> wrote: travis@continuum.io>
wrote:
On Jun 26, 2012, at 11:46 AM, John Salvatier wrote:
Hello,
If you increment an array using advanced indexing and have repeated indexes, the array doesn't get repeatedly incremented, http://comments.gmane.org/gmane.comp.python.numeric.general/50291. I wrote a C function that does incrementing with repeated indexes correctly. The branch is here (https://github.com/jsalvatier/numpy see the
last
two commits). Would a patch with a cleaned up version of a function like this be accepted into numpy? I'm not experienced writing numpy C code so I'm sure it still needs improvement.
This is great. It is an often-requested feature. It's *very difficult* to do without changing fundamentally what NumPy is. But, yes this would be a great pull request.
Thanks,
-Travis
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/082c34b6c1544c177cb7a66609360089.jpg?s=120&d=mm&r=g)
Hi, Here is code example that work only with different index: import numpy x=numpy.zeros((5,5)) x[[0,2,4]]+=numpy.random.rand(3,5) print x This won't work if in the list [0,2,4], there is index duplication, but with your new code, it will. I think it is the most used case of advanced indexing. At least, for our lab:) Fred On Mon, Jul 2, 2012 at 7:48 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Hi Fred,
That's an excellent idea, but I am not too familiar with this use case. What do you mean by list in 'matrix[list]'? Is the use case, just incrementing in place a sub matrix of a numpy matrix?
John
On Fri, Jun 29, 2012 at 11:43 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I personnaly can't review this as this is too much in NumPy internal.
My only comments is that you could add a test and an example in the doc for matrix[list]. I think it will be the most used case.
Fred
On Wed, Jun 27, 2012 at 7:47 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
I've submitted a pull request ( https://github.com/numpy/numpy/pull/326 ). I'm new to the numpy and python internals, so feedback is greatly appreciated.
On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Can you clarify why it would be super hard? I just reused the code for advanced indexing (a modification of PyArray_SetMap). Am I missing something crucial?
On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant <travis@continuum.io> wrote: > > > On Jun 26, 2012, at 11:46 AM, John Salvatier wrote: > > Hello, > > If you increment an array using advanced indexing and have repeated > indexes, the array doesn't get repeatedly > incremented, > http://comments.gmane.org/gmane.comp.python.numeric.general/50291. > I wrote a C function that does incrementing with repeated indexes > correctly. > The branch is here (https://github.com/jsalvatier/numpy see the > last > two > commits). Would a patch with a cleaned up version of a function > like > this be > accepted into numpy? I'm not experienced writing numpy C code so > I'm > sure it > still needs improvement. > > > This is great. It is an often-requested feature. It's *very > difficult* > to do without changing fundamentally what NumPy is. But, yes this > would be > a great pull request. > > Thanks, > > -Travis > > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/725a50eff7b51f36402b946bf786393e.jpg?s=120&d=mm&r=g)
Okay, done ( https://github.com/jsalvatier/numpy/commit/7d03753e6305dbc878ed7df3e21e9b099... ). On Tue, Jul 3, 2012 at 11:41 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
Here is code example that work only with different index:
import numpy x=numpy.zeros((5,5)) x[[0,2,4]]+=numpy.random.rand(3,5) print x
This won't work if in the list [0,2,4], there is index duplication, but with your new code, it will. I think it is the most used case of advanced indexing. At least, for our lab:)
Fred
Hi Fred,
That's an excellent idea, but I am not too familiar with this use case. What do you mean by list in 'matrix[list]'? Is the use case, just incrementing in place a sub matrix of a numpy matrix?
John
On Fri, Jun 29, 2012 at 11:43 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I personnaly can't review this as this is too much in NumPy internal.
My only comments is that you could add a test and an example in the doc for matrix[list]. I think it will be the most used case.
Fred
On Wed, Jun 27, 2012 at 7:47 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
I've submitted a pull request (
https://github.com/numpy/numpy/pull/326
). I'm new to the numpy and python internals, so feedback is greatly appreciated.
On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <
wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote: > Can you clarify why it would be super hard? I just reused the code > for > advanced indexing (a modification of PyArray_SetMap). Am I missing > something > crucial? > > > > On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant > <travis@continuum.io> > wrote: >> >> >> On Jun 26, 2012, at 11:46 AM, John Salvatier wrote: >> >> Hello, >> >> If you increment an array using advanced indexing and have
repeated
>> indexes, the array doesn't get repeatedly >> incremented, >> http://comments.gmane.org/gmane.comp.python.numeric.general/50291. >> I wrote a C function that does incrementing with repeated indexes >> correctly. >> The branch is here (https://github.com/jsalvatier/numpy see the >> last >> two >> commits). Would a patch with a cleaned up version of a function >> like >> this be >> accepted into numpy? I'm not experienced writing numpy C code so >> I'm >> sure it >> still needs improvement. >> >> >> This is great. It is an often-requested feature. It's *very >> difficult* >> to do without changing fundamentally what NumPy is. But, yes
On Mon, Jul 2, 2012 at 7:48 PM, John Salvatier <jsalvati@u.washington.edu> wrote: travis@continuum.io> this
>> would be >> a great pull request. >> >> Thanks, >> >> -Travis >> >> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> NumPy-Discussion@scipy.org >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
![](https://secure.gravatar.com/avatar/6c8561779fff34c62074c614d19980fc.jpg?s=120&d=mm&r=g)
Hey John, Will you be able to clean up the indentation issues for your inplace increment patch today. I would like to include it in NumPy 1.7. Thanks, -Travis On Jul 6, 2012, at 10:37 AM, John Salvatier wrote:
Okay, done ( https://github.com/jsalvatier/numpy/commit/7d03753e6305dbc878ed7df3e21e9b099... ).
On Tue, Jul 3, 2012 at 11:41 AM, Frédéric Bastien <nouiz@nouiz.org> wrote: Hi,
Here is code example that work only with different index:
import numpy x=numpy.zeros((5,5)) x[[0,2,4]]+=numpy.random.rand(3,5) print x
This won't work if in the list [0,2,4], there is index duplication, but with your new code, it will. I think it is the most used case of advanced indexing. At least, for our lab:)
Fred
On Mon, Jul 2, 2012 at 7:48 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
Hi Fred,
That's an excellent idea, but I am not too familiar with this use case. What do you mean by list in 'matrix[list]'? Is the use case, just incrementing in place a sub matrix of a numpy matrix?
John
On Fri, Jun 29, 2012 at 11:43 AM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I personnaly can't review this as this is too much in NumPy internal.
My only comments is that you could add a test and an example in the doc for matrix[list]. I think it will be the most used case.
Fred
On Wed, Jun 27, 2012 at 7:47 PM, John Salvatier <jsalvati@u.washington.edu> wrote:
I've submitted a pull request ( https://github.com/numpy/numpy/pull/326 ). I'm new to the numpy and python internals, so feedback is greatly appreciated.
On Tue, Jun 26, 2012 at 12:10 PM, Travis Oliphant <travis@continuum.io> wrote:
On Jun 26, 2012, at 1:34 PM, Frédéric Bastien wrote:
Hi,
I think he was referring that making NUMPY_ARRAY_OBJECT[...] syntax support the operation that you said is hard. But having a separate function do it is less complicated as you said.
Yes. That's precisely what I meant. Thank you for clarifying.
-Travis
Fred
On Tue, Jun 26, 2012 at 1:27 PM, John Salvatier <jsalvati@u.washington.edu> wrote: > Can you clarify why it would be super hard? I just reused the code > for > advanced indexing (a modification of PyArray_SetMap). Am I missing > something > crucial? > > > > On Tue, Jun 26, 2012 at 9:57 AM, Travis Oliphant > <travis@continuum.io> > wrote: >> >> >> On Jun 26, 2012, at 11:46 AM, John Salvatier wrote: >> >> Hello, >> >> If you increment an array using advanced indexing and have repeated >> indexes, the array doesn't get repeatedly >> incremented, >> http://comments.gmane.org/gmane.comp.python.numeric.general/50291. >> I wrote a C function that does incrementing with repeated indexes >> correctly. >> The branch is here (https://github.com/jsalvatier/numpy see the >> last >> two >> commits). Would a patch with a cleaned up version of a function >> like >> this be >> accepted into numpy? I'm not experienced writing numpy C code so >> I'm >> sure it >> still needs improvement. >> >> >> This is great. It is an often-requested feature. It's *very >> difficult* >> to do without changing fundamentally what NumPy is. But, yes this >> would be >> a great pull request. >> >> Thanks, >> >> -Travis >> >> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> NumPy-Discussion@scipy.org >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> > > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Frédéric Bastien
-
John Salvatier
-
Travis Oliphant