Skip to content

Commit

Permalink
max_fast not robust
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed May 26, 2020
1 parent ba4ce75 commit 93e807b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/dtw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ const LVB = LoopVectorization.VectorizationBase
ninvγ = one(T) / γ
v = LVB.SVec{4,T}((a, b, c, typemax(T)))
v = v * ninvγ
maxv = Base.FastMath.max_fast(a,b,c) * ninvγ
maxv = maximum(v)#Base.FastMath.max_fast(a,b,c) * ninvγ
ve = exp(v - maxv) * LVB.SVec{4,T}((one(T), one(T), one(T), zero(T)))

γ*(log(sum(ve)) + maxv)
end
6 changes: 2 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,8 @@ using Distances, Plots
T = randn(100)
d = DTW(5)
D = distance_profile(d, Q, T)
@test D[1] d(Q, getwindow(T,10,1))
@test D[2] d(Q, getwindow(T,10,2))
@test D[91] d(Q, getwindow(T,10,91))

@test length(D) == 100-10+1
foreach(i->@test(D[i] d(Q, getwindow(T,10,i))), 1:91)
end


Expand Down

0 comments on commit 93e807b

Please sign in to comment.