Pretty sure Numpy’s einsum[1] function allows all of this reasoning in vanilla numpy (albeit with a different interface that I assume this author likes less than theirs). Quite sure that first example of how annoying numpy can be could be written much simpler with einsum. [1]: https://numpy.org/doc/stable/reference/generated/numpy.einsu...
DumPy: NumPy except it's OK if you're dum
31–40 of 62 posts
Re: DumPy: NumPy except it's OK if you're dum
#32Earlier quoted context omitted.
There is an "older" discussion with a different title: https://news.ycombinator.com/item?id=43996431 (488 points | 9 days ago | 212 comments)
That's a different post.
Re: DumPy: NumPy except it's OK if you're dum
#33Pretty sure Numpy’s einsum[1] function allows all of this reasoning in vanilla numpy (albeit with a different interface that I assume this author likes less than theirs). Quite sure that first example of how annoying numpy can be could be written much simpler with einsum. [1]: https://numpy.org/doc/stable/reference/generated/numpy.einsu...
How do you invert a matrix with einsum?
Re: DumPy: NumPy except it's OK if you're dum
#34Lots to like here but I'm not so sure about this: > In DumPy, every time you index an array or assign to a dp.Slot, it checks that all indices have been included. Not having to specify all indices makes for more generic implementations. Sure, the broadcasting rules could be simpler and more consistent, but in the meantime (implicit) broadcasting is what makes NumPy so powerful and flexible. Also I think straight up v…
Re: DumPy: NumPy except it's OK if you're dum
#35I think this sort of DSL construction is a perfect fit for languages with macros: Lisp, Nim, etc. I spend a lot of time on both so I might explore the possibilities. What should a higher-dimensional array indexing, looping, and broadcasting syntax even look like, if until now it's just been cludges? Is it just APL but with actual words?
solve(X[i,_], Y[j,_], A[i,j,_,_]) = over i, j/+: Y * linalg_solve(A, X)Re: DumPy: NumPy except it's OK if you're dum
#36Re: DumPy: NumPy except it's OK if you're dum
#37Lots to like here but I'm not so sure about this: > In DumPy, every time you index an array or assign to a dp.Slot, it checks that all indices have been included. Not having to specify all indices makes for more generic implementations. Sure, the broadcasting rules could be simpler and more consistent, but in the meantime (implicit) broadcasting is what makes NumPy so powerful and flexible. Also I think straight up v…
Re: DumPy: NumPy except it's OK if you're dum
#38The kind of person with the background to need these operations, and who is working on the kinds of problems where this stuff comes up, is more than capable of learning numpys syntax. Its not that bad. Avoiding the special purpose tools designed by and used by the people who work on these problems every day is the instinct of someone who has just started needing them and wants to solve new kinds of problems with the…
Re: DumPy: NumPy except it's OK if you're dum
#39This is a big improvement over numpy, but I don't see much of a compelling reason to go back to Python.