-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Euclidean on Cartesian indices #177
Comments
Do you mean something like this? julia> A = reshape(collect(1:9), 3, 3)
3×3 Array{Int64,2}:
1 4 7
2 5 8
3 6 9
julia> inds1 = findall(iseven, A)
4-element Array{CartesianIndex{2},1}:
CartesianIndex(2, 1)
CartesianIndex(1, 2)
CartesianIndex(3, 2)
CartesianIndex(2, 3)
julia> inds2 = findall(isodd, A)
5-element Array{CartesianIndex{2},1}:
CartesianIndex(1, 1)
CartesianIndex(3, 1)
CartesianIndex(2, 2)
CartesianIndex(1, 3)
CartesianIndex(3, 3)
julia> pairwise(SqEuclidean(), inds1, inds2)
4×5 Array{Int64,2}:
1 1 1 5 5
1 5 1 1 5
5 1 1 5 1
5 5 1 1 1
julia> euclidean(inds1[1], inds1[1]) === 0.0
true I have added support for this special, noniterable type in #194. |
Could you explain why this would be useful? Since |
I think what @dkarrasch implemented is what I wanted. I would have to go back to this specific project to find out for sure but from what I can tell that solves my use case |
Yes but we decided to revert that change until we have a clearer view of why this would be needed. |
@nalimilan convinced me that supporting |
Is there a way to compute the euclidean distance between arrays that are of the type CartesianIndex?
The text was updated successfully, but these errors were encountered: