Commit dfb62461 authored by WebTogz's avatar WebTogz

core/compare-all.cpp: compare_windows()

parent cfe8f633
......@@ -82,3 +82,69 @@ SimilarityMatrix compare_all(list <Sequence> sequences, bool min_size,
return matrix;
/*Function which permit to compare all windows in windowsStorage*/
SimilarityMatrix compare_windows(WindowsStorage &windowsStorage, const Cost theCost, int nb_clones) {
//Creation of a nb_clones matrix
SimilarityMatrix matrix(nb_clones);
if (windowsStorage.size() == 0)
return matrix;
//Creation of a pair list, which contains junctions/windows (index) and the number of occurences of this (value)
list<pair <junction, int> > sortedList = windowsStorage.getSortedList();
//Positions of the array
int positionIt1 = 0;
int positionIt2 = 0;
//Process of the junctions (windows)
for (list<pair <junction, int> >:: const_iterator it1 = sortedList.begin();
it1 != sortedList.end(); ++it1) {
//We save the name of the junction
string win1 = it1->first;
//We compute & save only clones it the position is lower than the number of clones we want
if (positionIt1 > nb_clones) break;
//Process of the second junctions
for (list<pair <junction, int> >:: const_iterator it2 = sortedList.begin();
it2 != sortedList.end(); ++it2) {
string win2 = it2->first;
//We compute only distances when first position is lower than the second
if (positionIt1 < positionIt2) {
if (positionIt2 <= nb_clones) {
//Compute all the windows, globally
DynProg dp = DynProg(win1, win2, DynProg::Global, theCost);
//Compute the score by dynamic programming
float score = dp.compute();
//To debug
cout << dp.str_back;*/
//Put the score at position1 / position2 of the array
matrix.setScore(positionIt1, positionIt2, score);
else break;
positionIt2 = 0;
return matrix;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment