x
}
-#TODO: merge these 2 next ?!
-serialize = function(coeffs)
+writeCoeffs = function(coeffs)
{
+ file = ".coeffs"
#.........
#C function (from data.frame, type of IDs ??! force integers ? [yes])
#return raw vector
-}
-appendBinary = function(.......)
-{
#take raw vector, append it (binary mode) to a file
+#TODO: appendCoeffs() en C --> serialize et append to file
}
-#finalizeSerialization = function(...)
-#{
-# #write number of series, and length of each...
-#}
-
-deserialize = function(coeffs, range)
+readCoeffs = function(indices)
{
#......
+ file = ".coeffs"
#C function (from file name)
}
#TODO:
}
-getCoeffs(.....) #FROM BINARY FILE !!!
+curvesToCoeffs = function(series, wf)
{
-
+ L = length(series[1,])
+ D = ceiling( log2(L) )
+ nb_sample_points = 2^D
+ apply(series, 1, function(x) {
+ interpolated_curve = spline(1:L, x, n=nb_sample_points)$y
+ W = wavelets::dwt(interpolated_curve, filter=wf, D)@W
+ rev( sapply( W, function(v) ( sqrt( sum(v^2) ) ) ) )
+ })
}