julia> A, B = ones(3,), ones(3,);
julia> fn!(x) = begin x.=2 end;
julia> fn!(vec(A)); A
3×1 Array{Float64,2}:
2.0
2.0
2.0
julia> fn!(B[:]); B
3×1 Array{Float64,2}:
1.0
1.0
1.0
vec
’s behaviour is understood from the doc.
I wonder if [:]
's behavior is expected, since the Performance Tips:
This can be verified using the
vec
function or the syntax[:]
as shown below.
seems to suggest they should be indifferent.
Also, does this mean vec
is more efficient than [:]
?