On Sun, Aug 16, 2020 at 10:50 AM David Mertz email@example.com wrote:
What is happening in the discussion is that each potential user who comments finds some related capability that is relevant to their particular needs. But the union of all those wishes is something substantially large... Maybe not NumPy large, but heading in that direction.
On the other hand, trimming such a thing to a bare minimum would mean
that everyone using it would quickly hit limits that make it not really practical. Different limits for different people, but limits certainly.
which is why numpy is as large as it is :-) -- and the "scipy stack" even larger.
If the purpose is JUST teaching a certain kind of course in linear algebra,
that didn't seem like sufficient motivation for standard library, but it does sound like an excellent purpose for a third party library.
I think it goes a bit beyond this -- a matrix / linear algebra system would be useful for other (also pedagogical) uses, like physics classes mentioned.
In fact, I see really two packages being asked for in this thread:
1) The OP's Matrix object, and associated classes
2) a pure python and/or stdlib nd-array package -- i.e. numpy-lite
I've thought (2) would be a good addition to the stdlib for years -- as long as it is pretty compatible with numpy -- there really are some good reasons for 2 or 3 D arrays that aren't just nested lists. But the fact is, that as David alluded to, folks will hit limits, and then we'll want to expand it, and before you know it, you've got numpy all over again :-) And frankly it's just not that hard to get and install numpy.
NOTE: there is desire (3) -- something like numpy but with a different API -- to that, I say: please don't!
Final point: (1) and (2) above really are different. General purpose ND arrays for computation, and matrices for linear algebra are NOT the same -- and trying to cram them together does not work out great: MATLAB is a Matrix library that has been extended for general purpose computations -- numpy is a computational array library that has a few matrix features (and has a deprecated Matrix class). I find the numpy approach a lot more useful, and the fact that the numpy Matrix class has been depreciated indicates that I"m not the only one.
Anyway, I would like to see a nice linear algebra lib -- but not 'cause I'd use it, only because I find it interesting.
Honestly, I'm quite surprised that no one has done it yet -- at least not in a widely used package.
PS: it may be hard to find, but way back when (~15 years ago, maybe?) someone wrote a prototype of a version of numpy (maybe Numeric?) written in pure python. The experiment then was to run it through Psyco and see how well it performed -- it actually did pretty well. It used an array.array as the internal storage. Once upon a time I started building on it to make a pure python numpy clone, for use in some of my code that required numpy, but didn't really need the performance. But it never got to a usable state.
There was also an effort to make a numpy clone for PyPy -- though I think they abandoned that in favor of being able to call numpy directly -- turns out that the whole numpy ecosystem depends VERY heavily on C and Foirtran extensions, so you really need it to be compatible at the binary level, not just the Python level.