mverzilli / crystalla

Crystal library for Numerical Methods. It binds to LAPACK and is unashamedly inspired by Numpy.
MIT License
45 stars 7 forks source link

added ndarray class #15

Open MatthiasRMS opened 7 years ago

MatthiasRMS commented 7 years ago

So this is were I am. A Ndarray class, supporting most of the methods you defined for matrices when the array is 2D (there are a few that still need to be added), and basic numpy's methods for ndarrays (reshape, broadcasting, sum, bool comparison etc). As you advised, I use column major order.

There are some differences with the current Matrix class (shape, dot product instead of *) since I've tried to stick with numpy's behaviour most of the time.

Works fine with 1D and 2D (see specs), not yet with more dimensions. I've been able to replicate the numpy part of this course intro using this ndarray class.

Let me know what you think, what should be improved, if you have any design advices etc !

mverzilli commented 7 years ago

❤️ This is great Matthias, thank you so much! Give me a couple of days to review it and I'll merge it.

MatthiasRMS commented 7 years ago

I've added a few more stuffs. I keep adding elements while coding gradient descent, since I keep finding useful functions/features. If you see any improvements that could be made, just tell me and I can correct it. Especially performance improvements etc :-)

mverzilli commented 7 years ago

As regards:

There are some differences with the current Matrix class (shape, dot product instead of *) since I've tried to stick with numpy's behaviour most of the time.

Big 👍 from my side

MatthiasRMS commented 7 years ago

Sounds good, I'll fix those over the weekend 👍