Skip to content

Commit 69e7f39

Browse files
committed
rewritten repair, test shall pass!
1 parent c2c3b37 commit 69e7f39

7 files changed

Lines changed: 508 additions & 276 deletions

File tree

inst/include/jmotif.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ CharacterVector series_to_chars(NumericVector ts, int a_size);
2525
//
2626
CharacterVector series_to_string(NumericVector ts, int a_size);
2727
//
28-
std::map<int, CharacterVector> sax_via_window(NumericVector ts, int w_size, int paa_size, int a_size,
28+
std::map<int, std::string> sax_via_window(NumericVector ts, int w_size, int paa_size, int a_size,
2929
CharacterVector nr_strategy, double n_threshold);
3030
//
3131
std::map<int, CharacterVector> sax_by_chunking(NumericVector ts, int paa_size,
@@ -172,6 +172,9 @@ class repair_digram {
172172
repair_digram(const std::string str, int index);
173173
};
174174

175+
//
176+
// the priority queue (a dobly-linked list) node
177+
//
175178
class repair_pqueue_node {
176179
public:
177180
repair_pqueue_node* prev;
@@ -189,15 +192,18 @@ class repair_pqueue_node {
189192
}
190193
};
191194

195+
//
196+
// the priority queue taking care about repair digrams ordering
197+
//
192198
class repair_priority_queue {
193199
public:
194-
repair_pqueue_node* queue_head;
195-
std::unordered_map<std::string, repair_pqueue_node*> nodes;
200+
repair_pqueue_node* queue_head; // queue head pointer
201+
std::unordered_map<std::string, repair_pqueue_node*> nodes; // the fastmap <digram> -> <node>
196202
repair_priority_queue() {
197203
queue_head = nullptr;
198204
std::unordered_map<std::string, repair_pqueue_node*> nodes;
199205
}
200-
repair_digram* enqueue( repair_digram* digram );
206+
repair_digram* enqueue(repair_digram* digram);
201207
repair_digram* dequeue();
202208
repair_digram* peek();
203209
repair_digram* get(std::string *digram_string);
@@ -206,6 +212,7 @@ class repair_priority_queue {
206212
std::vector<repair_digram> to_array();
207213
void remove_node(repair_pqueue_node* node);
208214
std::string to_string();
215+
bool consistency_check();
209216
};
210217

211218
//

src/RcppExports.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ BEGIN_RCPP
191191
END_RCPP
192192
}
193193
// sax_via_window
194-
std::map<int, CharacterVector> sax_via_window(NumericVector ts, int w_size, int paa_size, int a_size, CharacterVector nr_strategy, double n_threshold);
194+
std::map<int, std::string> sax_via_window(NumericVector ts, int w_size, int paa_size, int a_size, CharacterVector nr_strategy, double n_threshold);
195195
RcppExport SEXP jmotif_sax_via_window(SEXP tsSEXP, SEXP w_sizeSEXP, SEXP paa_sizeSEXP, SEXP a_sizeSEXP, SEXP nr_strategySEXP, SEXP n_thresholdSEXP) {
196196
BEGIN_RCPP
197197
Rcpp::RObject __result;

0 commit comments

Comments
 (0)