275275Return a sparse distance matrix as determined by the sparsification method `sp_method`
276276and `metric`.
277277"""
278- function spdist(
279- data:: AbstractArray{<:SVector} ,
280- sp_method:: Neighborhood ,
281- metric:: Dists.PreMetric = Distances. Euclidean(),
282- )
278+ function spdist(data, sp_method:: Neighborhood , metric:: Dists.PreMetric = Distances. Euclidean())
283279 N = length(data) # number of states
284280 data = vec(data)
285281 # TODO : check for better leafsize values
@@ -292,11 +288,7 @@ function spdist(
292288 Vs = fill(1.0 , length(Is))
293289 return sparse(Is, Js, Vs, N, N, * )
294290end
295- function spdist(
296- data:: AbstractVector{<:SVector} ,
297- sp_method:: Union{KNN,MutualKNN} ,
298- metric:: Dists.PreMetric = Distances. Euclidean(),
299- )
291+ function spdist(data, sp_method:: Union{KNN,MutualKNN} , metric:: Dists.PreMetric = Distances. Euclidean())
300292 N = length(data) # number of states
301293 data = vec(data)
302294 # TODO : check for better leafsize values
@@ -315,11 +307,7 @@ function spdist(
315307 return min.(D, permutedims(D))
316308 end
317309end
318- function spdist(
319- data:: AbstractArray{<:AbstractArray{<:SVector}} ,
320- sp_method:: Neighborhood ,
321- metric:: STmetric ,
322- )
310+ function spdist(data, sp_method:: Neighborhood , metric:: STmetric )
323311 N = length(data) # number of trajectories
324312 T = Dists. result_type(metric, first(data), first(data))
325313 I1 = collect(1 : N)
@@ -352,11 +340,7 @@ function spdist(
352340 Vs = vcat(V1, getindex.(IJV, 3 ). .. )
353341 return sparse(Is, Js, Vs, N, N)
354342end
355- function spdist(
356- data:: AbstractArray{<:AbstractArray{<:SVector}} ,
357- sp_method:: Union{KNN,MutualKNN} ,
358- metric:: STmetric ,
359- )
343+ function spdist(data, sp_method:: Union{KNN,MutualKNN} , metric:: STmetric )
360344 data = vec(data)
361345 N, k = length(data), sp_method. k
362346 Is = repeat(1 : N, inner= k+ 1 )
0 commit comments