3411720a01c234dce67a3f68203673be0b2fd543
[epclust.git] / code / draft_R_pkg / R / main.R
1 #TODO: setRefClass... to avoid copy data !!
2 #http://stackoverflow.com/questions/2603184/r-pass-by-reference
3
4 #fields: data (can be NULL or provided by user), coeffs (will be computed
5 #con can be a character string naming a file; see readLines()
6 #data can be in DB format, on one column : TODO: guess (from header, or col. length...)
7 epclust = function(data=NULL, con=NULL, raw=FALSE, K, nbPerChunk, ..., where_to_store_tmp_data, and how ?)
8 #options for tmp files: in RAM, on disk, on DB (can be distributed)
9 {
10
11
12 #on input: can be data or con; data handled by writing it to file (ascii or bin ?!),
13
14
15 if (!is.null(data))
16 {
17 #full data matrix
18 index = 1
19 n = nrow(data)
20 while (index < n)
21 {
22 getCoeffs(data
23 index = index + nbSeriesPerChunk
24 }
25 } else if (!is.null(con))
26 {
27 #incremental connection
28 #read it one by one and get coeffs until nbSeriesPerChunk
29 #then launch a clustering task............
30 readLines()
31 } else
32 stop("at least 'data' or 'con' argument must be present")
33
34 }
35
36 getCoeffs = function(series)
37 {
38 #... return wavelets coeffs : compute in parallel !
39 }