computing the quartet distance between general trees
computing the quartet distance between general trees
computing the quartet distance between general trees
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
54 CHAPTER 7. SUB-CUBIC TIME ALGORITHMFrom <strong>the</strong> table it is evident that padding <strong>the</strong> matrices is not speeding up <strong>the</strong> multiplication.Only in three experiments it seems faster in some cases and only in a very smallpercentage of <strong>the</strong> multiplications. Fur<strong>the</strong>rmore, from <strong>the</strong> sizes of <strong>the</strong> internal nodes involvedwe observe that it is only when dealing with very small matrices (#rows/#columns< 10), that we “benefit” from padding. More likely, it is a coincidence ra<strong>the</strong>r than an actualtendency. My conclusion is that it is not beneficial to pad <strong>the</strong> matrices and consequently,<strong>the</strong>re is no reason to separately take care of <strong>the</strong> case where max(d v ,d v ′) ω issmallest and I will continue to distinguish only <strong>between</strong> dv 2d v ′ and d v d 2 , as done in <strong>the</strong>v ′prototype.Expectations The implementation still does not meet <strong>the</strong> formal description of <strong>the</strong> article,which means that we can not count on <strong>the</strong> analysis and thus, <strong>the</strong> implementationmight brake <strong>the</strong> sub-cubic time bound and behave as a cubic algorithm. It seems reasonableto keep <strong>the</strong> assumptions from <strong>the</strong> prototype. Never<strong>the</strong>less, I hope to see a <strong>general</strong>improvement which of course is dependent on <strong>the</strong> proportion of time actually spent onmatrix multiplication. This should be more significant to <strong>the</strong> experiments involving <strong>the</strong>largest multiplications, namely <strong>the</strong> star <strong>trees</strong> and <strong>the</strong> worst case <strong>trees</strong> which seemed tobe suffering because of <strong>the</strong> larger matrices encountered.Result The result of applying <strong>the</strong> two final implementations on <strong>the</strong> usual array of testdata is shown in Fig. 7.10 and Fig. 7.11. We observe that <strong>the</strong>re is no significant improvementin running time. The <strong>general</strong> picture is much <strong>the</strong> same as for <strong>the</strong> prototype; <strong>the</strong>final implementations perform in <strong>the</strong> same range of time consumption as <strong>the</strong> prototypeimplementations with a few exceptions. The reason might very likely be <strong>the</strong> relativelylow amount of time spent doing matrix multiplication and <strong>the</strong> relatively high amount oftime spent processing <strong>the</strong> pairs of internal nodes.There are a couple of cases, however, where a change in <strong>the</strong> slope of <strong>the</strong> plot is clearlyobservable. That is, not surprisingly, <strong>the</strong> <strong>trees</strong> with few inner nodes, resulting in largematrices; star <strong>trees</strong> and wc <strong>trees</strong>. And only for <strong>the</strong> C++ implementation. Especially <strong>the</strong>star tree yields a dramatic improvement. The plot of <strong>the</strong> C++ prototype, that was almostparallel to <strong>the</strong> O(n 3 ) line, has now improved to being almost parallel to <strong>the</strong> O(n 2 ) line.However, <strong>the</strong> plot is not making an exact straight line which I suspect might be because<strong>the</strong> overhead is gradually equalized by <strong>the</strong> complexity of <strong>the</strong> matrix multiplication as <strong>the</strong>size of <strong>the</strong> matrices grow. Eventually this will result in <strong>the</strong> plot showing <strong>the</strong> complexityof <strong>the</strong> matrix multiplication only. The processing time of an 800-leaf star tree is loweredfrom over 100 seconds to below 10 seconds meaning that <strong>the</strong> change of matrix librarywas indeed a great improvement.