joaosferreira's Blog

Week 3 Check-in

Published: 06/22/2020

What did you do this week?

I continued the work started in last week's PR by adding more multimethods on array creation:

Numerical ranges:

  • geomspace

Building matrices:

  • diagflat
  • tri
  • tril
  • triu
  • vander

These additions conclude the mentioned PR which at the time of writing this is almost ready to be merged. I also tried to implement a metaclass type for classes in unumpy.

What is coming up next?

I'll be starting a new PR that intendes to expand unumpy's coverage of array manipulation routines. The PR is expected to last two weeks given the extensive and diverse nature of the multimethods covered. Also, following the discussion about the inclusion of a metaclass type from which other classes in unumpy instantiate, it's expected that I review a PR by one of my mentors on this. This is a good opportunity for me to start getting used to reviewing PRs. As a note, I think the workload in the next two weeks might increase a bit but as college assignments start to decrease a good balance between the two should stay constant.

Did you get stuck anywhere?

The biggest challenge this week was trying to implement the metaclass type. Although I was given some good pointers on how to proceed with this I still faced some problems on doing this correctly. Creating a metaclass with the added difficulty of writing multimethods for its methods was a bit overwhelming. I spent almost an entire day on this and got little results. Looking back I should have asked for help which would surely have helped me unblock. I'll be sure to keep that in mind next time. With that said, I'm still learning the ropes but I already feel that my Python skills are improving significantly.

View Blog Post

Week 2 Check-in

Published: 06/15/2020

What did you do this week?

This week I started a PR that further adds multimethods for array creation routines. I'll name the additions according to the NumPy docs sectioning:

Ones and zeros:

  • identity
  • ones_like
  • zeros_like
  • full_like

From existing data:

  • asanyarray
  • ascontiguousarray
  • copy
  • frombuffer
  • fromfile
  • fromfunction
  • fromiter
  • fromstring
  • loadtxt

During this week I also started learning about metaclasses in Python. This was encouraged by my mentors as a way to level up my Python skills so that I can tackle more complicated features in unumpy. This was mostly done by reading documentation, posts and articles about the subject and watching one of my mentors code some examples.

What is coming up next?

The current PR will be stretched to this upcoming week where I'll be covering more multimethods for these routines. Also, as briefly discussed in my previous blog post, I will eventually be picking up a PR that adds multimethods for the random module. However, as stated in this issue, classes in unumpy like np.random.RandomState could benefit from a custom metaclass. Given the importance of this feature for current and future implementations additional work during this week will be focused on the creation of this metaclass.

Did you get stuck anywhere?

There were some difficulties writing tests for some of these routines as there were a lot of errors that I didn't understand at first. Going over each one separately and writing why I thought they were failing actually helped in fixing some of them. At the time of writing this they are almost all resolved with only one exception.

View Blog Post

Week 1 Check-in

Published: 06/08/2020

What did you do this week?

I started a new PR that adds mathematical constants and mutlimethods for logic routines. These included:

Math constants:

  • euler_gamma
  • nan and aliases
  • inf and aliases
  • NINF
  • newaxis

Logic functions:

  • isposinf
  • isneginf
  • iscomplex
  • iscomplexobj
  • isreal
  • isrealobj
  • isscalar
  • array_equal
  • array_equiv

I've also continued to work on the PR started during community bonding. This one also originated a new issue. 

What is coming up next?

I'll be adding more multimethods, this time addressing routines for array creation. I've already done two multimethods on array creation when I was applying for GSoC which might help this coming week. I'm also thinking about picking up another PR left off by one of my mentors. The one about NumPy's random module seems interesting and challenging. However, this still has to be discussed with my mentors since this was not part of my proposal and it also depends on the available time I'll have. Although I have an exam and a project assignment to deliver I hope to keep a good rhythm going during this week. Let's see how it goes!

Did you get stuck anywhere?

I haven't had any major blocks this week. The default implementation for norm in the Linear Algebra module was the toughest as I was trying to implement a simple solution that would take into account all the corner cases. I realized that sometimes an elegant solution is not easily attainable and that correctness is more important. The result was not that bad I hope.

This week was also the start of my weekly meetings with my mentors. We discussed my PRs and other things about the project which was quite helpful. I really appreciate their availability and commitment.

View Blog Post

Community Bonding Check-in

Published: 05/29/2020

What did you do during this period?

I had an onboarding meeting with my mentors where we got to know each other a bit better. They advised me to play around with uarray and unumpy without any goal in mind which I found to be a very good advice. I played a bit with special methods by implementing a simple Vector2D class and used the code in this notebook with some print statements to understand better the protocols and how they are called. I wanted to start earlier on my project so I took over a PR from one of my mentors which adds multimethods for the linalg module.

What is coming up next?

I'm going to continue the PR that I have been working on since it still isn't finished and I will also follow the proposed timeline and start adding multimethods for other routines like checking class equality in array elements. Some mathematical constants and their aliases are also missing so I will be adding these too and probably refactoring the existing ones into classes. This week marks the end of my college classes but I still have some assignments and exams coming up in the following weeks so there's a lot of work ahead of me to proper balance both university studies and GSoC but I wouldn't have it other way.

Did you get stuck anywhere?

I consider the PR that I started working during this period to be a challenging one since some mathematical intuition is needed to translate Linear Algebra routines into proper functions. Things like decomposition of a matrix into eigenvalues and eigenvectors to calculate its n-th power is something I'm not too familiar with specially in a programming context. With that said there hasn't been a roadblock for me up until now and usually I can wrap my head around these concepts in half a day. It should be noted that mentor help plays a huge part in this as they frequently give me very good advices. Despite that I usually think a lot before doing a commit to make sure that what I'm pushing is correct I notice that I still can't avoid some mistakes, even ones that should be obvious to me. I guess these mistakes are normal and they are corrected soon after so no harm's done but I'm training myself to not do them as often.

View Blog Post