问题
In the doc, they say
We decided to use no operator overloading for ...
They provide prod
instead for these. But why? Is there any good reason? I like to do matrix * vector
(as in most other languages). I like to understand why they did not overloaded this operator to understand why it might be a bad idea to just do it myself. Or aren't they any drawbacks if I overload it myself?
回答1:
Probably, because op*
in other languages, e.g. with Numpy in Python, will always be element-wise. In case that one element is a matrix and another one is a vector, it will try to broadcast all the elements in the missing dimension.
来源:https://stackoverflow.com/questions/20056774/why-has-ublas-no-operatormatrix-vector