But if you are going to explore the threading of recursion in Perl, there are simpler ways than your implementations. This does the job:
No, that does not limit the number of workers.
Equally, the recursive algorithm can be sped up immensely by simply memoising it.
It doesn't seem to be a technique you can use for distributed work, which is where I thought you were going with this.
All of these modifications make it possible to calculate Fibonacci( 1474 )
The point was to find a technique. Or are you saying the technique will never be as efficient as alternatives?
Anyway, I saw your post about the Ackermann function, and that's a whole different ballgame. I spent a lot of time tinkering with that too after you mentioned it.
As far as I know, one can't make y = f(x); z = f(y); parallel without refactoring by a human, yet the Ackermann function is of that form.
That said, it does have interesting traits that may make parallisation possible (or impossible).
- If you need calculate A(m,n), you know you will also need to calculate A(m,i) for 0<i<n.
- For m>0 and n>0, A(m,n) is a series of n+1 evaluations of A(m-1,i) with increasing i.
- ...
But I'm in way over my head.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|