It’s conceptually the same as [A].*B You are basically just creating a very low overhead container, so that A is treated as an element rather than a collection.
You could also use a comprehension, which is clearer, IMO, or even a generator if you don’t want to materialize.
julia> R = [A*b for b in B]
3-element Array{Array{Float64,2},1}:
[1.1064518582166465 1.4257048365761784]
[0.7462570773129014 0.2360058367114488]
[0.2639640481443961 1.0567511644538756]
julia> R = (A*b for b in B)
Base.Generator{Array{Array{Float64,2},1},var"#11#12"}(var"#11#12"(), [[0.28439915229561796 0.024986306638530964; 0.41102635296051426 0.7003592649688237], [0.6502316144726392 0.15084252545701005; 0.04801273142013107 0.042581655627219384], [0.0710881212956167 0.14551768207448657; 0.0964379634243897 0.45561674118969453]])
I suspect that this may actually be worse than B = [A*b for b in B], because either way it allocates on the right-hand side, but then it additionally copies over to the left hand side instead of just rebinding the variable, which is basically free.
True, but it probably depends on the relative sizes of B and A and memory pressure etc. One big allocation for a new B, might or might not be relevant compared to the numerous “small” allocations for A.
Also the inplace version might still be relevant if for example B is a view into a larger array. But now I’m probably reaching
Either way, the request was for an inplace version and I was hoping someone would suggest a clever way to fix the allocations. (The fact that the for loop with the mul! gave different behaviour for different sizes also thought me something new today).
Actually, my (untested) thesis is that the dotted assignment is strictly worse than the undotted one, because the dotted one does everything that the undotted one does, plus extra copying at the end. I think.