Skip to content

Commit

Permalink
Fix NOTE: found no call to: R_registerRoutines
Browse files Browse the repository at this point in the history
  • Loading branch information
vwmaus committed Mar 22, 2017
1 parent cb0fce4 commit d07a375
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 29 deletions.
5 changes: 1 addition & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,4 @@ importFrom(stats,window)
importFrom(stats,xtabs)
importFrom(xtable,print.xtable)
importFrom(xtable,xtable)
useDynLib(dtwSat,bestmatches)
useDynLib(dtwSat,computecost)
useDynLib(dtwSat,g)
useDynLib(dtwSat,tracepath)
useDynLib(dtwSat, .registration = TRUE)
21 changes: 9 additions & 12 deletions R/dtw.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@
###############################################################


#' @useDynLib dtwSat computecost
# @useDynLib dtwSat computecost
.computecost = function(cm, step.matrix){

cm = rbind(0, cm)
n = nrow(cm)
m = ncol(cm)

if(is.loaded("computecost", PACKAGE = "dtwSat", type = "Fortran")){
out = .Fortran("computecost",
out = .Fortran(computecost,
CM = matrix(as.double(cm), n, m),
DM = matrix(as.integer(0), n, m),
VM = matrix(as.integer(0), n, m),
SM = matrix(as.integer(step.matrix), nrow(step.matrix), ncol(step.matrix)),
N = as.integer(n),
M = as.integer(m),
NS = as.integer(nrow(step.matrix)),
PACKAGE="dtwSat")
NS = as.integer(nrow(step.matrix)))
} else {
stop("Fortran computecost lib is not loaded")
}
Expand All @@ -45,7 +44,7 @@
}


#' @useDynLib dtwSat tracepath
# @useDynLib dtwSat tracepath
.tracepath = function(dm, step.matrix, jmin){

n = nrow(dm)
Expand All @@ -55,7 +54,7 @@

if(is.loaded("tracepath", PACKAGE = "dtwSat", type = "Fortran")){
aloc = length(jmin)*10*n
paths = .Fortran("tracepath",
paths = .Fortran(tracepath,
DM = matrix(as.integer(dm), n, m),
SM = matrix(as.integer(step.matrix), nrow(step.matrix), ncol(step.matrix)),
JMIN = as.vector(as.integer(jmin)),
Expand All @@ -66,8 +65,7 @@
M = as.integer(m),
NS = as.integer(nrow(step.matrix)),
NJ = as.integer(length(jmin)),
AL = as.integer(aloc),
PACKAGE="dtwSat")
AL = as.integer(aloc))

res = lapply(seq_along(paths$POS)[-1], function(p){
I = paths$POS[p]:((paths$POS[p-1])+1)
Expand All @@ -80,7 +78,7 @@
res
}

#' @useDynLib dtwSat bestmatches
# @useDynLib dtwSat bestmatches
.bestmatches = function(x, m, n, levels, breaks, overlap, fill=9999){
if(is.loaded("bestmatches", PACKAGE = "dtwSat", type = "Fortran")){
if(length(x[[1]]$distance)<1){
Expand All @@ -97,7 +95,7 @@
L = as.integer(length(levels)),
OV = as.double(overlap))
} else {
res = try(.Fortran("bestmatches",
res = try(.Fortran(bestmatches,
XM = matrix(as.integer(c(as.numeric(x[[1]]$from), as.numeric(x[[1]]$to))), ncol = 2),
AM = matrix(as.double(fill), nrow = n, ncol = m),
DM = as.double(x[[1]]$distance),
Expand All @@ -108,8 +106,7 @@
K = as.integer(length(x)),
P = as.integer(length(breaks)),
L = as.integer(length(levels)),
OV = as.double(overlap),
PACKAGE="dtwSat"))
OV = as.double(overlap)))
}
} else {
stop("Fortran bestmatches lib is not loaded")
Expand Down
7 changes: 3 additions & 4 deletions R/twdtw.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,20 +144,19 @@ initAlignments = function(...){
res
}

#' @useDynLib dtwSat g
# @useDynLib dtwSat g
.g = function(phi, step.matrix){

if(!is.loaded("g", PACKAGE = "dtwSat", type = "Fortran"))
stop("Fortran lib is not loaded")

n = nrow(phi)
m = ncol(phi)
res = .Fortran("g",
res = .Fortran(g,
TM = matrix(as.double(phi), n, m),
N = as.integer(n),
M = as.integer(m),
PC = as.double(366),
PACKAGE="dtwSat")
PC = as.double(366))
res$TM
}

2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' @importFrom lubridate month month<- day day<- year year<-
#' @importFrom caret createDataPartition
#' @importFrom xtable xtable print.xtable
# @useDynLib dtwSat, .registration = TRUE
#' @useDynLib dtwSat, .registration = TRUE
#'
NULL

Expand Down
8 changes: 0 additions & 8 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@

# v0.2.2

* Fixed from previous version

checking compiled code ... NOTE
File 'dtwSat/libs/i386/dtwSat.dll':
Found no call to: 'R_registerRoutines'
File 'dtwSat/libs/x64/dtwSat.dll':
Found no call to: 'R_registerRoutines'

# v0.2.1

* Fix Solaris installation errors.
Expand Down

0 comments on commit d07a375

Please sign in to comment.