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
Cartesi
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 Arra
A[indices] = Values
?
On Wednesday, October 26, 2016 at 9:53:17 AM UTC-4, Tsur Herman wrote:
>
> What would you suggest is a fast and elegant way to achieve indexing into
> an array using a set of indices?
>
> function setindices!(A,Values,Indices)
> assert(length(Values) == size(Indices,1))