You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A = Scalar((Inf, 0))
@finch begin
A .= (Inf, 0)
for i = _
A[] <<minby>>= tuple(B[i], i)
end
end
result = A[][2]
An example of a similar function exists here: hhttps://github.com/finch-tensor/Finch.jl/blob/2e89d2228a777a8238eccd145cfa6a7b405eb76c/src/interface/compare.jl#L1-L28
The idea is to first use minby to compute the argmin, then return just the coordinates of the minimum. In python, we only need to handle a single axis (https://numpy.org/doc/2.1/reference/generated/numpy.argmin.html). In Julia, there may be multiple axes, in which case the index used is an e.g.
CartesianIndex(i, j)
(https://docs.julialang.org/en/v1/base/collections/#Base.argmin). Theminby
function is described here: https://finch-tensor.github.io/Finch.jl/stable/docs/user-defined_functions/#Finch.minbyAn example of a one-dimensional argmin is:
An example of a similar function exists here: hhttps://github.com/finch-tensor/Finch.jl/blob/2e89d2228a777a8238eccd145cfa6a7b405eb76c/src/interface/compare.jl#L1-L28
You may find some of these docs to be helpful:
https://finch-tensor.github.io/Finch.jl/stable/docs/internals/virtualization/
The text was updated successfully, but these errors were encountered: