Skip to content

Commit

Permalink
Fix matrix operation
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Jun 1, 2017
1 parent 19745a9 commit 50f9ec4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/twdtwApplyParallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ apply_raster_parallel <- function(x, fun, A, filepath="", ...) {
# Get best mathces for each point, period, and pattern
m = length(levels)
h = length(breaks)-1
A = lapply(as.list(twdtw_results), FUN=.lowestDistances, m=m, n=h, levels=levels, breaks=breaks, overlap=overlap, fill=9999)

t(data.frame(A))


A <- lapply(as.list(twdtw_results), FUN=.lowestDistances, m=m, n=h, levels=levels, breaks=breaks, overlap=overlap, fill=9999)
B <- as.list(data.frame(do.call("rbind", A)))
lapply(B, function(m) matrix(as.numeric(m), nrow = length(A), ncol = nrow(A[[1]]), byrow = TRUE))
}

# get all nodes going
Expand Down Expand Up @@ -343,3 +343,6 @@ apply_raster_parallel <- function(x, fun, A, filepath="", ...) {
return(out)
}

.lowestDistances2 = function(x, m, n, levels, breaks, overlap, fill){
t(.bestmatches(x, m, n, levels, breaks, overlap, fill)$AM)
}

0 comments on commit 50f9ec4

Please sign in to comment.