nmatrix icon indicating copy to clipboard operation
nmatrix copied to clipboard

Broadcasting support for nmatrix

Open v0dro opened this issue 8 years ago • 2 comments

Performing arithmetic operations by broadcasting elements in C level instead of looping over them in Ruby would be a nice way to speed up things in nmatrix. Take for example the numpy way of doing this.

Numo::NArray also supports broadcasting.

v0dro avatar Mar 31 '17 10:03 v0dro

I tend to feel like broadcasting creates confusing bugs in code. For example, if I add x and x-transpose together with Numpy, I expect an error — but actually I get an nxn matrix.

Maybe there's a way to have it be a feature that is turned on and off according to user preference?

translunar avatar Mar 31 '17 18:03 translunar

Yes maybe we can have it with support to turn it off and on. I think most of the problems with nmatrix speed involving things like multiplication and math operations can be overcome if we use broadcasting.

Having a switch would be helpful. If this is done, nmatrix can be internally used in daru for a massive increase in efficiency. I'm a bit skeptical about using Numo::NArray in daru because that will mean dropping support for JRuby.

v0dro avatar Apr 01 '17 10:04 v0dro