13.07.2015 Views

computing the quartet distance between general trees

computing the quartet distance between general trees

computing the quartet distance between general trees

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.2. IMPLEMENTATION 53well. My implementation will differ from <strong>the</strong> <strong>the</strong>ory by making no difference <strong>between</strong> <strong>the</strong>naive and some advanced method for matrix multiplication. I might as well use BLAS inevery case, since it is not specifically designed for square matrices. Anyway, even thoughI have no knowledge of <strong>the</strong> internals of <strong>the</strong> BLAS implementation I can treat it as a blackbox and test it as a piece in <strong>the</strong> algorithmic puzzle. With all of this in mind, I will makean array of experiments with <strong>the</strong> purpose of clarifying exactly when, if ever, it is feasibleto pad <strong>the</strong> matrices, making <strong>the</strong>m square, before applying <strong>the</strong> BLAS routine.I have been executing an equivalent to <strong>the</strong> prototype algorithm, but substituting <strong>the</strong>matrix multiplication method by BLAS. In each case <strong>the</strong> matrix multiplication had to becarried out, I made both calculations, with and without padding of <strong>the</strong> matrices, comparing<strong>the</strong> running time of that particular part of <strong>the</strong> execution. This has been donefor each combination of <strong>the</strong> different types of test <strong>trees</strong>, for larger <strong>trees</strong> of mainly 800leaves. The result is shown in Table 7.1. For each execution of <strong>the</strong> algorithm it is shownhow many times <strong>the</strong> multiplication was carried out and for how many of those paddingwas advantageous. This is also shown percentage-wise. For every case where paddingwas in fact advantageous <strong>the</strong> table shows <strong>the</strong> largest degree for an internal node and <strong>the</strong>largest difference <strong>between</strong> <strong>the</strong> degree of two of <strong>the</strong> internal nodes being processed whichis identical to <strong>the</strong> difference <strong>between</strong> <strong>the</strong> number of rows and columns in <strong>the</strong> matrix.Trees Number of Number of times Largest Largest %multiplications padding was degree differencean advantagein degreebin vs bin 636804 0 - - 0.000ran vs ran 154449 30 9 4 0.019sqrt vs sqrt 841 0 - - 0.000star vs star 1 0 - - 0.000wc vs wc 160801 0 - - 0.000bin vs ran 313614 43 7 4 0.014bin vs sqrt 8358 0 - - 0.000bin vs star 798 0 - - 0.000bin vs wc 319998 0 - - 0.000ran vs sqrt 4221 0 - - 0.000ran vs star 393 0 - - 0.000ran vs wc 157593 130 7 4 0.082sqrt vs star 21 0 - - 0.000sqrt vs wc 4221 0 - - 0.000star vs wc 401 0 - - 0.000Table 7.1: Investigating when it is advantageous to multiply square matrices.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!