On Sunday, 24 September 2017 at 05:24:57 UTC, Manu wrote:
On 23 September 2017 at 03:11, Ilya Yaroshenko via
Digitalmars-d < [email protected]> wrote:
Should we add `a * b` to ndslice for 1d vectors?
Discussion at https://github.com/libmir/mir-algorithm/issues/91
I often ponder this sort of question... and while the nerdy bit
of my would
love to see this, I can never get past the fact that
`is(typeof(a) !=
typeof(a * b))`... I feel that's a big enough reason to put a
bullet in the
idea. D has array operations, which look just like 1d ndslices,
also SIMD
vectors usually implement operators, but they do element-wise
operation, so
now there's a confusion.
Consider, a generic function receives some T; if T is a slice
or simd, it
does element-wise stuff, if T is an ndslice, it behaves
differently. That
doesn't seem right.
Python has a dedicated matrix multiplication operator, that is
not used by the standard library, but is implemented for e.g.
numpy arrays.
https://www.python.org/dev/peps/pep-0465/