PyArmadillo
PyArmadillo copied to clipboard
Need thoughts on v0.500.0!
Hi community,
Thanks for the support! ~~v0.500.0 is in preparation.~~
~~Feel free to give out some thoughts on PyArmadillo v0.400.0 after having a play!~~
We are happy to announce v0.500.0 is released! 🥳 🥳 🥳
You are more than welcome to use our library in your own projects and other work :D
Why do you use a different convention for *
and @
? This is very inconvenient and inconsistent IMO.
Why do you use a different convention for
*
and@
? This is very inconvenient and inconsistent IMO.
Hi @hiyyg, thanks for sharing your experience!
According to Python PEP465, it does state @
should be used as matrix multiplication.
But for *
, the background mentions that
Because Python syntax currently allows for only a single multiplication operator *, libraries providing array-like objects must decide: either use * for elementwise multiplication, or use * for matrix multiplication. And, unfortunately, it turns out that when doing general-purpose number crunching, both operations are used frequently, and there are major advantages to using infix rather than function call syntax in both cases. Thus it is not at all clear which convention is optimal, or even acceptable; often it varies on a case-by-case basis.
Hence, there is no optimal convention for *
, though some widely-used libraries currently use *
for elementwise multiplication, and function/method calls for matrix multiplication. (See more here)
Since we aim to keep the consistency between Matlab/Octave syntax and PyArmadillo, we have to make the choice for picking the different uses of *
and @
. As *
is used as matrix multiplication and .*
as element-wise multiplication in Matlab/Octave, we simply keep *
as the same in PyArmadillo. However, @
is arguable and we may replace it with the other symbol later.
Thanks. I guess most python users would prefer the other way around.
Thanks. I guess most python users would prefer the other way around.
I agree with your suggestion as most of the Python users will use NumPy array
in the computation. However, a further investigation may be needed to finally decide the case in PyArmadillo.
Why do you use a different convention for
*
and@
? This is very inconvenient and inconsistent IMO.
I think the main idea of the project is to produce a way for sci compute like matlab in python env. so it be convenient for transfer in python and matlab. as more as like matlab is very important
As you prefer. But I would like to warn that most python users might misuse these operators and it is dangerous.