ahwillia/TimeWarp.jl

fastdtw fails with multidimansional arrays

00sapo opened this issue · 0 comments

Hello,
I'm completely new to Julia, so my solution is not probably the best.

  1. in fastdtw.jlsubstitute lines 8-13 (fastdtw signature) with:
function fastdtw(
        seq1::AbstractArray,
        seq2::AbstractArray,
        radius::Int,
        dist::SemiMetric=SqEuclidean()
    )

    if !isa(seq1, Sequence)
        seq1 = Sequence(seq1)
    end
    if !isa(seq2, Sequence)
        seq2 = Sequence(seq2)
    end

And compress2 function (line 94):

function compress2(seq::Sequence)
    # Navg = div(length(seq), 2)
    evenseq = 0.5*(seq[1:2:end-1]+seq[2:2:end])
    if length(seq)%2 == 1
        return Sequence(hcat(evenseq, seq[end]))
    end
    Sequence(evenseq)
end
  1. in dtw.jl line 54 substitute:
D = zeros(T, m, n)

with

D = zeros(eltype(T), m, n)