# NOT RUN {
Q <- cumsum(rnorm(100))
C <- Q[11:100] + rnorm(90, 0, 0.5)
tmp <- dtw(Q=Q, C=C, ws = 15, return_diffM = TRUE) # the ordinary calculation
# new observation
newObs <- c(2,3)
# the incremental step
idtw(Q, C, newO = newObs, gcm=tmp$gcm, dm=tmp$dm, diffM = tmp$diffM,
return_diffp = TRUE, ws = 15, return_diffM = TRUE)
# now with integers
Q <- 1:10
C <- 2:20
tmp <- dtw(Q=Q, C=C, ws = 15, return_diffM = TRUE) # the ordinary calculation
# new observation
newObs <- c(2L,3L)
# the incremental step
tmpnew <- idtw(Q, C, newO = newObs, gcm=tmp$gcm, dm=tmp$dm, diffM = tmp$diffM,
return_diffp = TRUE, ws = 15, return_diffM = TRUE)
str(tmpnew)
# }
Run the code above in your browser using DataLab