13.12.2012 Views

Theoretical and Experimental DNA Computation (Natural ...

Theoretical and Experimental DNA Computation (Natural ...

Theoretical and Experimental DNA Computation (Natural ...

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.

4.12 A Worked Example: The List Ranking Problem 103<br />

for all k ∈ L in parallel do<br />

if P (k) �= P (P (k)) then<br />

begin<br />

distance(k) :=distance(k)+distance(P (k));<br />

P (k) :=P (P (k));<br />

end;<br />

for all k ∈ L in parallel do<br />

rank(k) :=distance(k);<br />

Obviously this solves the list ranking problem in O(log n) parallel steps, using<br />

n processors <strong>and</strong> O(n) memory locations. We consider the realization of this<br />

for n =2 m . In the translation, a total of 5n memory locations are used, which<br />

are laid out as follows:<br />

M[1],...,M[n] hold the list pointers next(k)(1 ≤ k ≤ n)<br />

M[n +1],...,M[2n] holdthevaluesP (k)<br />

M[2n +1],...,M[3n] holddistance(k)<br />

M[3n +1],...,M[4n] are used for temporary results<br />

M[4n +1],...,M[5n] hold the output values rank(k)<br />

The unwound control program contains precisely m +2 in parallel do instructions,<br />

the middle m of which are identical. For the first instruction we<br />

have<br />

for all k ∈ L in parallel do<br />

begin<br />

P (k) :=next(k);<br />

if P (k) �= k then<br />

distance(k) :=1;<br />

else<br />

distance(k) :=0;<br />

end<br />

In terms of the basic instruction set this translates to<br />

1. LDA k<br />

2. STA n + k /* P (k) :=next(k)<br />

3. LDC k<br />

4. SUB n + k<br />

5. STA 3n + k<br />

6. JEQ 3n + k, 10 /* P (k) �= k<br />

7. LDC 1<br />

8. STA 2n + k /* distance(k) :=1<br />

9. JUMP 12

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

Saved successfully!

Ooh no, something went wrong!