<span class="Apple-style-span" style="font-family: Times; font-size: medium; "><pre style="white-space: pre-wrap; ">On Mon, Oct 3, 2011 at 10:05 PM, John Smith <<img border="0" src="http://erlang.org/pipermail/erlang-questions/emailaddrs/ema-6723.png">> wrote:
><i> We are still in the R&D phase (you could say), so I'm not quite sure
</i>><i> yet which specific category the number crunching will fall into (I
</i>><i> wouldn't be surprised if there are matrices, however). I think what
</i>><i> I'll do is write the most intensive parts in both Erlang and C, and
</i>><i> compare the two. I'd prefer to stick purely with Erlang though!</i></pre><pre style="white-space: pre-wrap; "><i>From time to time the "Erlang is poor at number crunching" can be heard.</i></pre>
<pre style="white-space: pre-wrap; "><i>Mainly this revolves around Erlang being bad at the kind of number crunching needed for linear algebra/image processing etc.</i></pre><pre style="white-space: pre-wrap; "><i>Having a similar requirement as John for a current project I thinking a lot recently how to use Erlang maybe together with another language or system together for this (other requirements are quite in favor of Erlang for my project).</i></pre>
<pre style="white-space: pre-wrap; "><i>When pondering this I noticed that if Erlang would have a flexible n-dim array type with good performing matrix/vector manipulation functions I would not need to integrate some external system with all the complexity required to make the concurrency impedances match.</i></pre>
<pre style="white-space: pre-wrap; "><i>There are several systems where efficient matrix manipulation is added to languages that would not be considered for numerical calculations without them. Examples are NumPy and <a href="http://pdl.perl.org">pdl.perl.org</a>. </i></pre>
<pre style="white-space: pre-wrap; "><i>Usually these revolve around a basic matrix "buffer" which is reference counted. These buffers are referred to by structures of metadata containing dimensionality, matrix slice info (they support the concept of having slices of matrices which share the buffers without copying).</i></pre>
<pre style="white-space: pre-wrap; "><i>The buffers are quite similar to Erlangs binaries, and the no-copy slicing looks quite functional to me.</i></pre><pre style="white-space: pre-wrap; "><i>If we would build a matrix library on top of binaries with only a few basic operations as NIF's quite powerful things could be built on top of this using pure Erlang.</i></pre>
<pre style="white-space: pre-wrap; "><i>I would invest some of my time in a library like this, probably not enough to make it general purpose. But if others want to participate, maybe we won't have to repeat the Erlangs to for (all) number crunching sentiment too often.</i></pre>
<pre style="white-space: pre-wrap; "><i>Cheers</i></pre><pre style="white-space: pre-wrap; "><i>-- Peer Stritzinger</i></pre></span>