On Monday, March 10, 2014 9:46:11 AM UTC, Christophe Bal wrote: > > Hello, > when reading the draft, I've seen > > Elementwise multiplication is useful because it fits the common pattern > for numerical code: it lets us easily and quickly perform a basic operation > (scalar multiplication) on a large number of aligned values without writing > a slow and cumbersome for loop. And this fits into a very general schema; > e.g., in numpy, *all Python operators work elementwise on arrays of all > dimensionalities.* Matrix multiplication is slightly more special-purpose > -- it's only defined on 2d arrays, also known as "matrices" -- but still > used very heavily across all application areas; mathematically, it's one of > the most fundamental operations there is. > > This is also the case in math so I do not think that it is a good argument. >
I'm not sure what you mean here -- can you elaborate? I've never seen a math book that defines "<<" on matrices to mean elementwise-left-bitshift, or "|" as elementwise-bitwise-or, or even "/" as elementwise-division. These are all operations that numpy provides, though, and they're all useful and used in practical number-crunching contexts. > I really think that @ instead of * for scalar product is the good choice ! > Don't forget the scientific math world which use more and more Python. > Well, I'm not forgetting it, that's why I'm here :-). But I also don't want to forget the Python scientific data processing world, which (a) is where these problems actually occur (because they make heavy use of both elementwise and matrix multiplication), (b) has, after a debate that's been going on for 15 years back to the early releases of Numeric, overwhelmingly settled on using * for elementwise multiplication, (c) involves something like 20-30x more downstream users (judging by metrics like pypi downloads, github code search for "import numpy" versus "import sympy", number of pypi packages declaring a dependency on numpy versus sympy, etc.). So I just don't think I'm going to get very far if I go back to the numpy list and say "Alright, guys! We're switching * to mean matrix multiplication to make the mathematicians happy!". So the question is, what's the best system that balances between all these different communities and their constraints? Right now my feeling is that the PEP's proposal is the best available option, and if that means that sympy/sage will just ignore the PEP then that's fine, you guys are solving a different problem. But if you have a better way to balance these competing needs then I'd love to hear it! -n -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/69d788e8-b3b3-4a59-9f42-9b68fadc5e45%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
