Basically the algorithms are composed of two components. One is parameter
space optimization; the other is streaming correlation algorithm with parameters
computed in the first step. All of them need the library base.k and sketch.k

1. Parameter space optimization
The principle is that the parameter space is searched in a large scale first. 
Then the local finer search is performed around those good coarse parameter 
groups computed in the first step. This is justified by the continuity of recall
and precision in the parameter space.

Four parameters are to be computed. 
c: distance factor
f: parameter group fraction
N: Sketch size
g: Group size

The files are under the directory of \paraTest
(1)testgrid.k and grid_para.k
Objective:Compute the parameters in a coarse scale
Input: Test data
Output:postSets.l and preSets.l (See the comments in the file for explanation)
(2)benchmark.k
Objective:Compute the correlation by the naive pairwise comparison
Input: Test data
Output:benchmarkDist.l
(3)rec_prec.k
Objective:Compute the recall and precision
Input: postSet.l, preSet.l and benchmarkDist.l
Output:recall_precision.l
(4)local/R2/testGridlocal.k and local/R2/grid_para.k
Objective:Pick out those good coarse parameters from recall_precision around which
          the finer parameter groups are used in the experiemtns. It returns both 
          false and true positive(preLocalSets) and the true positives(postLocalSets). 
          They will be used to compute recall and precision by rec_prec.k
Input:test data, recall_precision.l
Output:preLocalSets.l and postLocalSets.l and goodpara.l
Note: Due to the complexity of combining different group size ( R=2,3,4) tests in one 
      file, I split them in R2 R3 R4. The only diffference is in parameter setting R=2  
      in grid_para.k. So only R2 is explained here.
(5)local/R2/rec_prec.k
Objective:Compute the finer parameter groups
Input:preLocalSets, postLocalSets, goodpara, benchmarkDist
Output:recall_precision_local
(6)stable/R2/putalltogether.k
Objective:Based on the Bootstrapping to test the stablity of the parameters
Input: benchmarkDist.l, recall_precision_local.l and test data
Output:recall_precision.l
(7)stable/R2/grid_para.k
Similar to local/R2/grid_para.k
(8)stable/std
Compute the mean and std of recall and precision of each parameter group


2. Streaming correlation algorithm
The files include: streamingbw.k and grid.k
Please see the comments in the files for details on the usage.
streamingbw.k takes in the data stream and compute their sketches which are
thrown into the grid structures(grid.k or gridhash.k) to compute the 
correlation. 
Note: gridHash.k is the hash version of grid.k. GridHash.k employs a hash structure 
to save space which, however may results in conflicts.

3.Library
base.k and sketch.k contains the utilities such as dft. mean, etc. Users
are encouraged to read the comments in the files.

4. Finally.
Before using the algorithms, please pay attention to the library link and data generation
(1) User needs to generate the symbolic link to base.k and sketch.k in each directory.
(2) The data format is a 2-dimentional matrix. Each row contains the time series. You may 
    generate it in K or load the practical data. See the comments for details
