The way the f function is written, there is no way to run it in
parallel, since it needs the previous answer. The best you can hope
for is to use two cores, one for a and one for b.

What you can do if you want to make it parallel is use the closed
form, and create a lazy list of that closed form for each iteration.
Something along the lines of (doall (pmap #(- (f a %) (f b %))
(range))), where (f a n) yields the value for the nth iteration with a
starting value of a, using the closed form. If you know in advance how
many steps you want, you could have even more parallelism with a
reducer-based map on a vector of n's.

Unfortunately, I personally do not know of an arbitrary-precision
implementation of sin, asin and sqrt (though I suppose they would not
be *that* hard to implement).

On 11 April 2013 09:27, Michael Gardner <[email protected]> wrote:
> On Apr 10, 2013, at 21:46 , Ulises <[email protected]> wrote:
>
>> Have you tried replacing all your calls to map for pmap yet?
>
> That will not work. He'll need to rearrange his algorithm to something like 
> this before pmap will help:
>
> (defn iterated-difference [f a b]
>     "Yields a lazy seq of the differences between (iterate f a) and (iterate 
> f b)."
>     (cons (doto (double (- b a)) println)
>         (lazy-seq (apply iterated-difference f (pmap f [a b])))))
>
> Might need to wrap this in a (doall …) or such to see progressive output from 
> the println.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to