Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-02 Thread Patrick Kofod Mogensen
Does that work for you? I have to write A .= (*).(A,B) On Wednesday, November 2, 2016 at 3:51:54 AM UTC+1, Chris Rackauckas wrote: > > It's the other way around. .* won't fuse because it's still an operator. > .= will. It you want .* to fuse, you can instead do: > > A .= *.(A,B) > > since this

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-02 Thread Tim Holy
Hmm, that's surprising. Looks like we're using generic broadcasting machinery for that operation (check out what @which P.*P returns). Might be good to add .* to this line: https://github.com/JuliaLang/julia/blob/b7f1aa7554c71d3759702b9c2e14904ebdc94199/base/arraymath.jl#L69. Want to make a pull

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-02 Thread Sheehan Olver
OK, good to know. I think putting the function in a package is overkill. > On 2 Nov. 2016, at 6:35 pm, Chris Rackauckas wrote: > > Yes, this most likely won't help for GPU arrays because you likely don't want > to be looping through elements serially: you want

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-02 Thread Chris Rackauckas
Yes, this most likely won't help for GPU arrays because you likely don't want to be looping through elements serially: you want to call a vectorized GPU function which will do the computation in parallel on the GPU. ArrayFire's mathematical operations are already overloaded to do this, but I

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-01 Thread Sheehan Olver
Ah thanks! Though I guess if I want the same code to work also on a GPU array then this won't help? Sent from my iPhone > On 2 Nov. 2016, at 13:51, Chris Rackauckas wrote: > > It's the other way around. .* won't fuse because it's still an operator. .= > will. It you want

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-01 Thread Chris Rackauckas
It's the other way around. .* won't fuse because it's still an operator. .= will. It you want .* to fuse, you can instead do: A .= *.(A,B) since this invokes the broadcast on *, instead of invoking .*. But that's just a temporary thing. On Tuesday, November 1, 2016 at 7:27:40 PM UTC-7, Tom

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-01 Thread Tom Breloff
As I understand it, the .* will fuse, but the .= will not (until 0.6?), so A will be rebound to a newly allocated array. If my understanding is wrong I'd love to know. There have been many times in the last few days that I would have used it... On Tue, Nov 1, 2016 at 10:06 PM, Sheehan Olver

Re: [julia-users] Re: Fast vector element-wise multiplication

2016-11-01 Thread Sheehan Olver
Ah, good point. Though I guess that won't work til 0.6 since .* won't auto-fuse yet? Sent from my iPhone > On 2 Nov. 2016, at 12:55, Chris Rackauckas wrote: > > This is pretty much obsolete by the . fusing changes: > > A .= A.*B > > should be an in-place update of A