Re: [julia-users] Re: How would you implement setindices! elegenatly?

2016-10-26 Thread Cedric St-Jean
Ah, right, I hadn't read your definition carefully. A[[CartesianIndex(1,1), CartesianIndex(2,3)]] = [0,0] Seems to be working correctly. So given your ind matrix, we can do A[mapslices(s->CartesianIndex(s...), ind, 2)] but I doubt that it'll be very performant. Could you directly output

[julia-users] Re: How would you implement setindices! elegenatly?

2016-10-26 Thread Tsur Herman
julia> A=rand(4,4) 4×4 Array{Float64,2}: 0.427998 0.720987 0.375013 0.432887 0.0333443 0.602459 0.946685 0.817995 0.402635 0.571399 0.553542 0.0234215 0.707829 0.339795 0.451387 0.358248 julia> ind = [1 1; 2 2; 3 3] 3×2 Array{Int64,2}: 1 1 2 2 3 3 julia> A[ind] 3×2