[Numpy-discussion] ENH: Proposal to add shift functionality to array

2022-09-07 Thread Filippo Tagliacarne
Hi,

I hope this is the correct place to post this as this is my first (potential) 
contribution to numpy. 

I would like to implement a function numpy.shift which would work similarly to 
numpy.roll, with one key difference. After shifting an array by a value 
`shift`, the function fills the missing values with a `fill_value`
For example shifting the following array by 1 along axis 1with fill_value of 0

arr  = array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])

would result in

arr  = array([[0, 0, 1, 2, 3],
[0, 5, 6, 7, 8]])


Kind regards,

Filippo Tagliacarne

___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Newbie's naive question about debug

2022-09-07 Thread 腾刘
Hello, everyone. I'm a newcomer here and looking forward to contributing to
Numpy core code in the future.

However, there is an obstacle right ahead of me that I don't know how to
figure out the corresponding relationship between Numpy python code and its
C implementation code. In another word, I really want to know which part of
Numpy core C code implements this simple numpy array addition:

>>> a = np.array([1, 2, 3])
>>> b = np.array([2, 3, 4])
>>> c = a + b

I have built Numpy from source in a virtual environment (via conda), and I
know the addition described above might be implemented in loop.c or
something like that from StackOverflow, but I want to find a general
approach to solve all these similar problems like: where are array
transpose implemented?  where are array reshape implemented? etc. So I am
seeking some tools like GDB and track python step by step. I *can *use gdb
to track python, but I can't set breakpoint in Numpy because Numpy's C code
isn't part of Python interpreter.

So all in all, my final question is that, how can I debug and track Numpy's
C code and see which part is executed? I believe there must be a method
because the real developers will certainly need to debug.

Thanks in advance. And I'm quite new here, so I'm not sure whether I should
ask this kind of primitive and naive question here, since the previous
discussions seem to be advanced and I can't understand most of them.
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Newbie's naive question about debug

2022-09-07 Thread Andras Deak
On Wed, Sep 7, 2022, at 07:55, 腾刘 wrote:
> Hello, everyone. I'm a newcomer here and looking forward to 
> contributing to Numpy core code in the future. 
>
> However, there is an obstacle right ahead of me that I don't know how 
> to figure out the corresponding relationship between Numpy python code 
> and its C implementation code. In another word, I really want to know 
> which part of Numpy core C code implements this simple numpy array 
> addition:
>
 a = np.array([1, 2, 3])
 b = np.array([2, 3, 4])
 c = a + b
>
> I have built Numpy from source in a virtual environment (via conda), 
> and I know the addition described above might be implemented in loop.c 
> or something like that from StackOverflow, but I want to find a general 
> approach to solve all these similar problems like: where are array 
> transpose implemented?  where are array reshape implemented? etc. So I 
> am seeking some tools like GDB and track python step by step. I *can 
> *use gdb to track python, but I can't set breakpoint in Numpy because 
> Numpy's C code isn't part of Python interpreter.
>
> So all in all, my final question is that, how can I debug and track 
> Numpy's C code and see which part is executed? I believe there must be 
> a method because the real developers will certainly need to debug.

Hi,

As a first pointer, you might find one of the first videos on the NumPy youtube 
channel (from a NumPy Newcomers’ Hour panel discussion) useful, in case you 
haven't seen it yet: "Find your way in the NumPy codebase :: Melissa Mendonca, 
Sebastian Berg, Tyler Reddy, Matti Picus" 
https://www.youtube.com/watch?v=mTWpBf1zewc . Others in the channel might also 
be relevant.

András



>
> Thanks in advance. And I'm quite new here, so I'm not sure whether I 
> should ask this kind of primitive and naive question here, since the 
> previous discussions seem to be advanced and I can't understand most of 
> them. 
> ___
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: deak.and...@gmail.com
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Newbie's naive question about debug

2022-09-07 Thread 腾刘
Thanks so much! I will check these videos thoroughly. By the way, another
stupid question: does your reply means that my mail has been accepted by
the moderator and got permission into the mailing-list (which means that
everyone in the mailing-list will see this email) ?


Andras Deak  于2022年9月7日周三 21:09写道:

> On Wed, Sep 7, 2022, at 07:55, 腾刘 wrote:
> > Hello, everyone. I'm a newcomer here and looking forward to
> > contributing to Numpy core code in the future.
> >
> > However, there is an obstacle right ahead of me that I don't know how
> > to figure out the corresponding relationship between Numpy python code
> > and its C implementation code. In another word, I really want to know
> > which part of Numpy core C code implements this simple numpy array
> > addition:
> >
>  a = np.array([1, 2, 3])
>  b = np.array([2, 3, 4])
>  c = a + b
> >
> > I have built Numpy from source in a virtual environment (via conda),
> > and I know the addition described above might be implemented in loop.c
> > or something like that from StackOverflow, but I want to find a general
> > approach to solve all these similar problems like: where are array
> > transpose implemented?  where are array reshape implemented? etc. So I
> > am seeking some tools like GDB and track python step by step. I *can
> > *use gdb to track python, but I can't set breakpoint in Numpy because
> > Numpy's C code isn't part of Python interpreter.
> >
> > So all in all, my final question is that, how can I debug and track
> > Numpy's C code and see which part is executed? I believe there must be
> > a method because the real developers will certainly need to debug.
>
> Hi,
>
> As a first pointer, you might find one of the first videos on the NumPy
> youtube channel (from a NumPy Newcomers’ Hour panel discussion) useful, in
> case you haven't seen it yet: "Find your way in the NumPy codebase ::
> Melissa Mendonca, Sebastian Berg, Tyler Reddy, Matti Picus"
> https://www.youtube.com/watch?v=mTWpBf1zewc . Others in the channel might
> also be relevant.
>
> András
>
>
>
> >
> > Thanks in advance. And I'm quite new here, so I'm not sure whether I
> > should ask this kind of primitive and naive question here, since the
> > previous discussions seem to be advanced and I can't understand most of
> > them.
> > ___
> > NumPy-Discussion mailing list -- numpy-discussion@python.org
> > To unsubscribe send an email to numpy-discussion-le...@python.org
> > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> > Member address: deak.and...@gmail.com
> ___
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: 27rabbi...@gmail.com
>
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com


[Numpy-discussion] Re: Newbie's naive question about debug

2022-09-07 Thread Andras Deak
On Thu, Sep 8, 2022, at 03:39, 腾刘 wrote:
> Thanks so much! I will check these videos thoroughly. By the way, 
> another stupid question: does your reply means that my mail has been 
> accepted by the moderator and got permission into the mailing-list 
> (which means that everyone in the mailing-list will see this email) ?

That is correct. When in doubt, check the public archive: 
https://mail.python.org/archives/list/numpy-discussion@python.org/latest

András

>
>
> Andras Deak  于2022年9月7日周三 21:09写道:
>> On Wed, Sep 7, 2022, at 07:55, 腾刘 wrote:
>> > Hello, everyone. I'm a newcomer here and looking forward to 
>> > contributing to Numpy core code in the future. 
>> >
>> > However, there is an obstacle right ahead of me that I don't know how 
>> > to figure out the corresponding relationship between Numpy python code 
>> > and its C implementation code. In another word, I really want to know 
>> > which part of Numpy core C code implements this simple numpy array 
>> > addition:
>> >
>>  a = np.array([1, 2, 3])
>>  b = np.array([2, 3, 4])
>>  c = a + b
>> >
>> > I have built Numpy from source in a virtual environment (via conda), 
>> > and I know the addition described above might be implemented in loop.c 
>> > or something like that from StackOverflow, but I want to find a general 
>> > approach to solve all these similar problems like: where are array 
>> > transpose implemented?  where are array reshape implemented? etc. So I 
>> > am seeking some tools like GDB and track python step by step. I *can 
>> > *use gdb to track python, but I can't set breakpoint in Numpy because 
>> > Numpy's C code isn't part of Python interpreter.
>> >
>> > So all in all, my final question is that, how can I debug and track 
>> > Numpy's C code and see which part is executed? I believe there must be 
>> > a method because the real developers will certainly need to debug.
>> 
>> Hi,
>> 
>> As a first pointer, you might find one of the first videos on the NumPy 
>> youtube channel (from a NumPy Newcomers’ Hour panel discussion) useful, in 
>> case you haven't seen it yet: "Find your way in the NumPy codebase :: 
>> Melissa Mendonca, Sebastian Berg, Tyler Reddy, Matti Picus" 
>> https://www.youtube.com/watch?v=mTWpBf1zewc . Others in the channel might 
>> also be relevant.
>> 
>> András
>> 
>> 
>> 
>> >
>> > Thanks in advance. And I'm quite new here, so I'm not sure whether I 
>> > should ask this kind of primitive and naive question here, since the 
>> > previous discussions seem to be advanced and I can't understand most of 
>> > them. 
>> > ___
>> > NumPy-Discussion mailing list -- numpy-discussion@python.org
>> > To unsubscribe send an email to numpy-discussion-le...@python.org
>> > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
>> > Member address: deak.and...@gmail.com
>> ___
>> NumPy-Discussion mailing list -- numpy-discussion@python.org
>> To unsubscribe send an email to numpy-discussion-le...@python.org
>> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
>> Member address: 27rabbi...@gmail.com
> ___
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: deak.and...@gmail.com
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com