Sounds like a neat program. I&#39;m on a laptop right now but i&#39;ll check it out later. <br>The reason I am mailling is because you can use mencoder to convert a stream of image files into a video file. <br><br><a href="http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html">
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html</a><br><br>--ryan<br><br><div><span class="gmail_quote">On 5/5/07, <b class="gmail_sendername">Andrew Coppin</b> &lt;<a href="mailto:andrewcoppin@btinternet.com">
andrewcoppin@btinternet.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


  

<div bgcolor="#ffffff" text="#000000">
Greetings.<br>
<br>
I have something which you might find mildly interesting. (Please don&#39;t
attempt the following unless you have some serious CPU power available,
and several hundred MB of hard drive space free.)<br>
<br>
&nbsp; darcs get <a href="http://www.orphi.me.uk/darcs/Chaos" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.orphi.me.uk/darcs/Chaos</a><br>
&nbsp; cd Chaos<br>
&nbsp; ghc -O2 --make System1<br>
&nbsp; ./System1<br>
<br>
On my super-hyper-monster machine, the program takes an entire 15
minutes to run to completion. When it&#39;s done, you should have 500
images sitting in front of you. (They&#39;re in PPM format - hence the
several hundred MB of disk space!) The images are the frames that make
up an animation; if you can find a way to &quot;play&quot; this animation, you&#39;ll
be treated to a truely psychedelic light show! (If not then you&#39;ll just
have to admire them one at a time. The first few dozen frames are quite
boring by the way...)<br>
<br>
If you want to, you can change the image size. For example, &quot;./System1
800&quot; will render at 800x800 pixels instead of the default 200x200. (Be
prepaired for <i>big</i> slowdowns!)<br>
<br>
<b>What is it?</b><br>
<br>
Well, it&#39;s a physical simulation of a &quot;chaos pendulum&quot;. That is, a
magnetic pendulum suspended over a set of magnets. The pendulum would
just swing back and forth, but the magnets perturb its path in complex
and unpredictable ways.<br>
<br>
However, rather than simulate just 1 pendulum, the program simulates
40,000 of them, all at once! For each pixel, a pendulum is initialised
with a velocity of zero and an initial position corresponding to the
pixel coordinates. As the pendulums swing, each pixel is coloured
according to the proximity of the corresponding pendulum to the tree
magnets.<br>
<br>
<b>Help requested...</b><br>
<br>
Can anybody tell me how to make the program go faster?<br>
<br>
I already replaced all the lists with IOUArrays, which resulted in big,
big speedups (and a large decrease in memory usage). But I don&#39;t know
how to make it go any faster. I find it worrying that the process of
converting pendulum positions to colours appears to take significantly
longer than the much more complex task of performing the numerical
integration to discover the new pendulum positions. Indeed, using GHC&#39;s
profiling tools indicates that the most time is spent executing the
function &quot;quant8&quot;. This function is defined as:<br>
<br>
&nbsp; quant8 :: Double -&gt; Word8<br>
&nbsp; quant8 = floor . (0xFF *)<br>
<br>
I can&#39;t begin to <i>imagine</i> how <i>this</i> can be the most
compute-intensive part of the program when I&#39;ve got all sorts of heavy
metal maths going on with the numerical integration and so forth...!
Anyway, if anybody can tell me how to make it run faster, I&#39;d be most
appriciative!<br>
<br>
Also, is there an easy way to make the program use <i>both</i> of the
CPUs in my PC? (Given that the program maps two functions over two big
IOUArrays...)<br>
<br>
Finally, if anybody has any random comments about the [lack of] qualify
in my source code, feel free...<br>
<br>
</div>

<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">
http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br><br></blockquote></div><br>