<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Equars People  - Hiraedd (Marco's blog)</title>
  <id>tag:people.equars.com,2008:mephisto/blogs/marco</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://people.equars.com/feed/blogs/marco/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://people.equars.com/blogs/marco" rel="alternate" type="text/html"/>
  <updated>2008-07-08T17:21:23Z</updated>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-07-08:170</id>
    <published>2008-07-08T15:00:00Z</published>
    <updated>2008-07-08T17:21:23Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="matrix factorization"/>
    <category term="ruby"/>
    <link href="http://people.equars.com/2008/7/8/non-negative-matrix-factorization" rel="alternate" type="text/html"/>
    <title>Non-negative Matrix Factorization</title>
<content type="html">
            &lt;p&gt;Here it is a small ruby script that calculate the &lt;a href=&quot;http://en.wikipedia.org/wiki/NMF&quot;&gt;non-negative matrix factorization&lt;/a&gt; of a given matrix.
I tried to mantain the notation consistent with the one used in the paper of &lt;a href=&quot;http://hebb.mit.edu/people/seung/papers/nmfconverge.pdf&quot;&gt;Lee and Seung&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The script requires the &lt;a href=&quot;http://rb-gsl.rubyforge.org/&quot;&gt;GSL&lt;/a&gt; library.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;37&lt;tt&gt;
&lt;/tt&gt;38&lt;tt&gt;
&lt;/tt&gt;39&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;41&lt;tt&gt;
&lt;/tt&gt;42&lt;tt&gt;
&lt;/tt&gt;43&lt;tt&gt;
&lt;/tt&gt;44&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;45&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;46&lt;tt&gt;
&lt;/tt&gt;47&lt;tt&gt;
&lt;/tt&gt;48&lt;tt&gt;
&lt;/tt&gt;49&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;51&lt;tt&gt;
&lt;/tt&gt;52&lt;tt&gt;
&lt;/tt&gt;53&lt;tt&gt;
&lt;/tt&gt;54&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;55&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;56&lt;tt&gt;
&lt;/tt&gt;57&lt;tt&gt;
&lt;/tt&gt;58&lt;tt&gt;
&lt;/tt&gt;59&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;60&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;61&lt;tt&gt;
&lt;/tt&gt;62&lt;tt&gt;
&lt;/tt&gt;63&lt;tt&gt;
&lt;/tt&gt;64&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;65&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;66&lt;tt&gt;
&lt;/tt&gt;67&lt;tt&gt;
&lt;/tt&gt;68&lt;tt&gt;
&lt;/tt&gt;69&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;70&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;71&lt;tt&gt;
&lt;/tt&gt;72&lt;tt&gt;
&lt;/tt&gt;73&lt;tt&gt;
&lt;/tt&gt;74&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;75&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;76&lt;tt&gt;
&lt;/tt&gt;77&lt;tt&gt;
&lt;/tt&gt;78&lt;tt&gt;
&lt;/tt&gt;79&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;80&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;81&lt;tt&gt;
&lt;/tt&gt;82&lt;tt&gt;
&lt;/tt&gt;83&lt;tt&gt;
&lt;/tt&gt;84&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;85&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;86&lt;tt&gt;
&lt;/tt&gt;87&lt;tt&gt;
&lt;/tt&gt;88&lt;tt&gt;
&lt;/tt&gt;89&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;90&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;91&lt;tt&gt;
&lt;/tt&gt;92&lt;tt&gt;
&lt;/tt&gt;93&lt;tt&gt;
&lt;/tt&gt;94&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;95&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;96&lt;tt&gt;
&lt;/tt&gt;97&lt;tt&gt;
&lt;/tt&gt;98&lt;tt&gt;
&lt;/tt&gt;99&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;100&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;101&lt;tt&gt;
&lt;/tt&gt;102&lt;tt&gt;
&lt;/tt&gt;103&lt;tt&gt;
&lt;/tt&gt;104&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;105&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;106&lt;tt&gt;
&lt;/tt&gt;107&lt;tt&gt;
&lt;/tt&gt;108&lt;tt&gt;
&lt;/tt&gt;109&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;110&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;111&lt;tt&gt;
&lt;/tt&gt;112&lt;tt&gt;
&lt;/tt&gt;113&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/ruby&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;require(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;gsl&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;nmf&lt;/span&gt;(v, col, thresh)&lt;tt&gt;
&lt;/tt&gt;   r, c = v.shape&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# w * h = v&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   w = &lt;span class=&quot;co&quot;&gt;GSL&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Matrix&lt;/span&gt;.alloc(r, col)&lt;tt&gt;
&lt;/tt&gt;   h = &lt;span class=&quot;co&quot;&gt;GSL&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Matrix&lt;/span&gt;.alloc(col, c)&lt;tt&gt;
&lt;/tt&gt;   initrand(w)&lt;tt&gt;
&lt;/tt&gt;   initrand(h)&lt;tt&gt;
&lt;/tt&gt;   dist = thresh&lt;tt&gt;
&lt;/tt&gt;   iter = &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;while&lt;/span&gt;(dist &amp;gt;= thresh)&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;c&quot;&gt;# multiplicative update rule&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      dist, w, h = update(v, w, h)&lt;tt&gt;
&lt;/tt&gt;      puts dist &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (iter%&lt;span class=&quot;i&quot;&gt;50&lt;/span&gt; == &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;      iter += &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;   &lt;tt&gt;
&lt;/tt&gt;   puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Ended in &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;iter&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; iteration(s) with dist=&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;dist&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; w, h&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;initrand&lt;/span&gt;(m)&lt;tt&gt;
&lt;/tt&gt;   r, c = m.shape&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(r&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |i|&lt;tt&gt;
&lt;/tt&gt;       &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(c&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |j|&lt;tt&gt;
&lt;/tt&gt;          m[i,j] = rand()&lt;tt&gt;
&lt;/tt&gt;       }&lt;tt&gt;
&lt;/tt&gt;   }&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;update&lt;/span&gt;(v, w, h)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# choose an update rule&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# v, w, h are GSL::Matrix objects&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   dist, w, h = update_eu(v, w, h)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; dist, w, h&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;update_eu&lt;/span&gt;(v, w, h)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# multiplicative update rule&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# for minimizing euclidean distance&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# v, w, h are GSL::Matrix objects&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   dist = dist_eu(v, w*h)&lt;tt&gt;
&lt;/tt&gt;   wt = w.transpose&lt;tt&gt;
&lt;/tt&gt;   ht =  h.transpose&lt;tt&gt;
&lt;/tt&gt;   h = h.mul_elements(wt * v).div_elements(wt * w * h)&lt;tt&gt;
&lt;/tt&gt;   w = w.mul_elements(v * ht).div_elements(w * h * ht)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; dist, w, h&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;update_kl&lt;/span&gt;(v, w, h)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# multiplicative update rule&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# for minimizing divergence&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# v, w, h are GSL::Matrix objects&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   dist = dist_kl(v, w*h)&lt;tt&gt;
&lt;/tt&gt;   wt = w.transpose&lt;tt&gt;
&lt;/tt&gt;   ht =  h.transpose&lt;tt&gt;
&lt;/tt&gt;   num = v.div_elements(w * h)&lt;tt&gt;
&lt;/tt&gt;   rh, ch = h.shape&lt;tt&gt;
&lt;/tt&gt;   rw, cw = w.shape&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(rh&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |i|&lt;tt&gt;
&lt;/tt&gt;       &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(ch&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |j|&lt;tt&gt;
&lt;/tt&gt;          h[i, j] *= w.col(i).mul(num.col(j)).sum / w.col(i).sum&lt;tt&gt;
&lt;/tt&gt;       }&lt;tt&gt;
&lt;/tt&gt;   }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(rw&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |i|&lt;tt&gt;
&lt;/tt&gt;       &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(cw&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |j|&lt;tt&gt;
&lt;/tt&gt;          w[i, j] *= h.row(j).mul(num.row(i)).sum / h.row(j).sum&lt;tt&gt;
&lt;/tt&gt;       }&lt;tt&gt;
&lt;/tt&gt;   }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; dist, w, h&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Euclidean distance&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;dist_eu&lt;/span&gt;(a, b)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# a,b are GSL::Matrix objects&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   dist = &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   (a-b).collect { |d| dist += d * d }&lt;tt&gt;
&lt;/tt&gt;   dist&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Kullback-Leibler divergence&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;dist_kl&lt;/span&gt;(a, b)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# a, b are GSL::Matrix objects&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   dist = &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   r, c = a.shape&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(r&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |i|&lt;tt&gt;
&lt;/tt&gt;       &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;.upto(c&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;) { |j|&lt;tt&gt;
&lt;/tt&gt;          &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (b[i,j] == &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;) &lt;tt&gt;
&lt;/tt&gt;             dist = &lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;**&lt;span class=&quot;i&quot;&gt;32&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;             &lt;span class=&quot;r&quot;&gt;break&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;          &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;          dist += a[i,j] * &lt;span class=&quot;co&quot;&gt;Math&lt;/span&gt;::log(a[i,j]/b[i,j]) - a[i,j] + b[i,j]&lt;tt&gt;
&lt;/tt&gt;       }&lt;tt&gt;
&lt;/tt&gt;   }&lt;tt&gt;
&lt;/tt&gt;   dist&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;v = &lt;span class=&quot;co&quot;&gt;GSL&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Matrix&lt;/span&gt;[[&lt;span class=&quot;i&quot;&gt;29&lt;/span&gt;, &lt;span class=&quot;i&quot;&gt;31&lt;/span&gt;], [&lt;span class=&quot;i&quot;&gt;37&lt;/span&gt;, &lt;span class=&quot;i&quot;&gt;41&lt;/span&gt;]]&lt;tt&gt;
&lt;/tt&gt;w, h = nmf(v, &lt;span class=&quot;i&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;i&quot;&gt;10&lt;/span&gt;**(&lt;span class=&quot;i&quot;&gt;-10&lt;/span&gt;))&lt;tt&gt;
&lt;/tt&gt;puts w&lt;tt&gt;
&lt;/tt&gt;puts h&lt;tt&gt;
&lt;/tt&gt;puts w*h&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-07-02:169</id>
    <published>2008-07-02T14:40:00Z</published>
    <updated>2008-07-02T14:44:00Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="correlation"/>
    <category term="ruby"/>
    <category term="tanimoto"/>
    <link href="http://people.equars.com/2008/7/2/tanimoto-coefficient" rel="alternate" type="text/html"/>
    <title>Tanimoto Coefficient</title>
<content type="html">
            &lt;p&gt;A small Ruby snippet to calculate the &lt;a href=&quot;http://en.wikipedia.org/wiki/Jaccard_index&quot;&gt;Tanimoto coefficient&lt;/a&gt; (aka extended Jaccard coefficient) of two real vectors.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/ruby&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Array&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;sum&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      inject( &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt; ) { |sum,x| sum+x }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;sum_square&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      inject( &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt; ) { |sum,x| sum+x*x }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;*&lt;/span&gt;(other) &lt;span class=&quot;c&quot;&gt;# dot_product&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      ret = []&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; !other.is_a? &lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt; || size != other.size&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.each_with_index {|x, i| ret &amp;lt;&amp;lt; x * other[i]}&lt;tt&gt;
&lt;/tt&gt;      ret.sum&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;tanimoto&lt;/span&gt;(a, b)&lt;tt&gt;
&lt;/tt&gt;   dot = (a*b)&lt;tt&gt;
&lt;/tt&gt;   den = a.sum_square + b.sum_square - dot&lt;tt&gt;
&lt;/tt&gt;   dot.to_f/den.to_f&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# puts tanimoto([1,2,2],[3,3,1])&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-07-01:168</id>
    <published>2008-07-01T10:26:00Z</published>
    <updated>2008-07-01T10:27:30Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="correlation"/>
    <category term="pearson"/>
    <category term="ruby"/>
    <link href="http://people.equars.com/2008/7/1/pearson-correlation-coefficient" rel="alternate" type="text/html"/>
    <title>Pearson Correlation Coefficient</title>
<content type="html">
            &lt;p&gt;A small Ruby snippet to calculate the &lt;a href=&quot;http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient&quot;&gt;Pearson product-moment correlation coefficient&lt;/a&gt;:&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/ruby&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Array&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;sum&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      inject( &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt; ) { |sum,x| sum+x }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;sum_square&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      inject( &lt;span class=&quot;i&quot;&gt;0&lt;/span&gt; ) { |sum,x| sum+x*x }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;mean&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      sum / size&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;*&lt;/span&gt;(other)&lt;tt&gt;
&lt;/tt&gt;      ret = []&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;nil&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; !other.is_a? &lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt; || size != other.size&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.each_with_index {|x, i| ret &amp;lt;&amp;lt; x * other[i]}&lt;tt&gt;
&lt;/tt&gt;      ret&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;x = &lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt;.new(&lt;span class=&quot;i&quot;&gt;100&lt;/span&gt;) {|i| rand(&lt;span class=&quot;i&quot;&gt;10&lt;/span&gt;) }&lt;tt&gt;
&lt;/tt&gt;y = &lt;span class=&quot;co&quot;&gt;Array&lt;/span&gt;.new(&lt;span class=&quot;i&quot;&gt;100&lt;/span&gt;) {|i| rand(&lt;span class=&quot;i&quot;&gt;20&lt;/span&gt;) }&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;sumx = x.sum&lt;tt&gt;
&lt;/tt&gt;sumy  = y.sum&lt;tt&gt;
&lt;/tt&gt;num = (x.size * (x*y).sum) - (sumx * sumy)&lt;tt&gt;
&lt;/tt&gt;den = &lt;span class=&quot;co&quot;&gt;Math&lt;/span&gt;.sqrt((x.size * x.sum_square) - sumx * sumx) * &lt;span class=&quot;co&quot;&gt;Math&lt;/span&gt;.sqrt((y.size * y.sum_square) - sumy * sumy)&lt;tt&gt;
&lt;/tt&gt;r = num &lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;den&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;puts &amp;quot;X= [&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;x.join(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;]&amp;quot;&lt;tt&gt;
&lt;/tt&gt;puts &amp;quot;Y= [&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;y.join(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;]&amp;quot;&lt;tt&gt;
&lt;/tt&gt;puts &amp;quot;r= &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;r&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-06-18:166</id>
    <published>2008-06-18T11:19:00Z</published>
    <updated>2008-06-18T11:24:24Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="riemann hypothesis"/>
    <category term="zeta function"/>
    <link href="http://people.equars.com/2008/6/18/riemann-zeta-function" rel="alternate" type="text/html"/>
    <title>&#950;(s)</title>
<content type="html">
            &lt;p&gt;Such a terse and strong abstract, and a really short  &lt;a href=&quot;http://arxiv.org/abs/0806.2361&quot;&gt;paper&lt;/a&gt;, for an hypothesis that lasts unproved for a century. We shall see if the proof is correct. &lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-05-22:163</id>
    <published>2008-05-22T15:51:00Z</published>
    <updated>2008-05-26T13:45:46Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="erlang"/>
    <category term="fiber"/>
    <category term="programming"/>
    <category term="ruby"/>
    <link href="http://people.equars.com/2008/5/22/ruby-fiber-ring-benchmark" rel="alternate" type="text/html"/>
    <title>Ruby Fiber Ring Benchmark</title>
<content type="html">
            &lt;p&gt;I stole an exercise from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Erlang_%28programming_language%29&quot;&gt;Erlang&lt;/a&gt; world: the &lt;a href=&quot;http://people.equars.com/2008/5/22/erlang-ring-benchmark&quot;&gt;ring benchmark&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used the exercise as a way to get acquainted with a new class in Ruby, &lt;a href=&quot;http://pragdave.blogs.pragprog.com/pragdave/2007/12/pipelines-using.html&quot;&gt;Fiber&lt;/a&gt; (starting from the version 1.9). &lt;a href=&quot;http://en.wikipedia.org/wiki/Fiber_%28computer_science%29&quot;&gt;Fibers&lt;/a&gt; are a way to implement asymmetric &lt;a href=&quot;http://en.wikipedia.org/wiki/Coroutine&quot;&gt;coroutines&lt;/a&gt; in Ruby, &lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;37&lt;tt&gt;
&lt;/tt&gt;38&lt;tt&gt;
&lt;/tt&gt;39&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;41&lt;tt&gt;
&lt;/tt&gt;42&lt;tt&gt;
&lt;/tt&gt;43&lt;tt&gt;
&lt;/tt&gt;44&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;45&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;46&lt;tt&gt;
&lt;/tt&gt;47&lt;tt&gt;
&lt;/tt&gt;48&lt;tt&gt;
&lt;/tt&gt;49&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;51&lt;tt&gt;
&lt;/tt&gt;52&lt;tt&gt;
&lt;/tt&gt;53&lt;tt&gt;
&lt;/tt&gt;54&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;55&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;56&lt;tt&gt;
&lt;/tt&gt;57&lt;tt&gt;
&lt;/tt&gt;58&lt;tt&gt;
&lt;/tt&gt;59&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;60&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;61&lt;tt&gt;
&lt;/tt&gt;62&lt;tt&gt;
&lt;/tt&gt;63&lt;tt&gt;
&lt;/tt&gt;64&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;65&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;66&lt;tt&gt;
&lt;/tt&gt;67&lt;tt&gt;
&lt;/tt&gt;68&lt;tt&gt;
&lt;/tt&gt;69&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;70&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;71&lt;tt&gt;
&lt;/tt&gt;72&lt;tt&gt;
&lt;/tt&gt;73&lt;tt&gt;
&lt;/tt&gt;74&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;75&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;76&lt;tt&gt;
&lt;/tt&gt;77&lt;tt&gt;
&lt;/tt&gt;78&lt;tt&gt;
&lt;/tt&gt;79&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;80&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;81&lt;tt&gt;
&lt;/tt&gt;82&lt;tt&gt;
&lt;/tt&gt;83&lt;tt&gt;
&lt;/tt&gt;84&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;85&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/ruby1.9&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fiber&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;benchmark&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Ring&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   attr_reader &lt;span class=&quot;sy&quot;&gt;:id&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   attr_accessor &lt;span class=&quot;sy&quot;&gt;:attach&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;initialize&lt;/span&gt;(id)&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@id&lt;/span&gt; = id&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@fiber&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Fiber&lt;/span&gt;.new &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;         pass_message&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;|&lt;/span&gt;(other)&lt;tt&gt;
&lt;/tt&gt;      other.attach = &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; !other.nil?&lt;tt&gt;
&lt;/tt&gt;      other&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;resume&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@fiber&lt;/span&gt;.resume&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;pass_message&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;while&lt;/span&gt; message = message_in&lt;tt&gt;
&lt;/tt&gt;         message_out(message)      &lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;message_in&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@attach&lt;/span&gt;.resume &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; !&lt;span class=&quot;iv&quot;&gt;@attach&lt;/span&gt;.nil?&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;message_out&lt;/span&gt;(message)&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;co&quot;&gt;Fiber&lt;/span&gt;.yield(message)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;RingStart&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;Ring&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   attr_accessor &lt;span class=&quot;sy&quot;&gt;:message&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;initialize&lt;/span&gt;(n, m, message)&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@m&lt;/span&gt; = m&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;iv&quot;&gt;@message&lt;/span&gt; = message&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;super&lt;/span&gt;(n)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;pass_message&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;      loop { message_out(&lt;span class=&quot;iv&quot;&gt;@message&lt;/span&gt;) }&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;create_chain_r&lt;/span&gt;(i, chain)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# recursive version&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; chain &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; i&amp;lt;=&lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   r = chain.nil? ? &lt;span class=&quot;co&quot;&gt;Ring&lt;/span&gt;.new(i) :  chain | &lt;span class=&quot;co&quot;&gt;Ring&lt;/span&gt;.new(i)&lt;tt&gt;
&lt;/tt&gt;   create_chain(i&lt;span class=&quot;i&quot;&gt;-1&lt;/span&gt;, r)&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;create_chain&lt;/span&gt;(n, chain)&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# loop version&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;c&quot;&gt;# needed to avoid stack overflow for high n&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   n.downto(&lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;) {&lt;tt&gt;
&lt;/tt&gt;      chain = chain | &lt;span class=&quot;co&quot;&gt;Ring&lt;/span&gt;.new(n)&lt;tt&gt;
&lt;/tt&gt;   }&lt;tt&gt;
&lt;/tt&gt;   chain&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;n=&lt;span class=&quot;pc&quot;&gt;ARGV&lt;/span&gt;[&lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;].to_i&lt;tt&gt;
&lt;/tt&gt;m=&lt;span class=&quot;pc&quot;&gt;ARGV&lt;/span&gt;[&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;].to_i&lt;tt&gt;
&lt;/tt&gt;mess=&lt;span class=&quot;sy&quot;&gt;:hello&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;tm  = &lt;span class=&quot;co&quot;&gt;Benchmark&lt;/span&gt;.measure {&lt;tt&gt;
&lt;/tt&gt;   ringu = &lt;span class=&quot;co&quot;&gt;RingStart&lt;/span&gt;.new(&lt;span class=&quot;i&quot;&gt;0&lt;/span&gt;, m, mess)&lt;tt&gt;
&lt;/tt&gt;   chain = create_chain(n, ringu)&lt;tt&gt;
&lt;/tt&gt;   m.times { ringu.message = chain.resume }&lt;tt&gt;
&lt;/tt&gt;}.format(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;%10.6r&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;).gsub!(&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;\)&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;n&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;m&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;tm&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


The comparison with the 
&lt;a href=&quot;http://people.equars.com/2008/5/22/erlang-ring-benchmark&quot;&gt;equivalent Erlang program&lt;/a&gt; 
is of course unfair, for one of the Erlang specialty is the spawning of cooperative processes. Anyway, here are the results:


&lt;table class=&quot;prettytable&quot;&gt;
&lt;tr&gt;
    &lt;th&gt;N&lt;/th&gt;
    ﻿&lt;th&gt;M&lt;/th&gt;
﻿    &lt;th&gt;Execution Time&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
﻿    &lt;th&gt;Ruby [ms]&lt;/th&gt;
    ﻿&lt;th&gt;Erlang [ms]&lt;/th&gt;
&lt;/tr&gt;                                
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 10&lt;/td&gt;
&lt;td&gt; 1&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 20&lt;/td&gt;
&lt;td&gt; 2&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 50&lt;/td&gt;
&lt;td&gt; 4&lt;/td&gt;
&lt;td&gt;10
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 100&lt;/td&gt;
&lt;td&gt; 10&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 200&lt;/td&gt;
&lt;td&gt; 18&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 500&lt;/td&gt;
&lt;td&gt; 42&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt; 1000&lt;/td&gt;
&lt;td&gt; 82&lt;/td&gt;
&lt;td&gt;10
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 10&lt;/td&gt;
&lt;td&gt; 15&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 20&lt;/td&gt;
&lt;td&gt; 23&lt;/td&gt;
&lt;td&gt;10
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 50&lt;/td&gt;
&lt;td&gt; 60&lt;/td&gt;
&lt;td&gt;0
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 100&lt;/td&gt;
&lt;td&gt; 99&lt;/td&gt;
&lt;td&gt;10
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 200&lt;/td&gt;
&lt;td&gt; 186&lt;/td&gt;
&lt;td&gt;20
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 500&lt;/td&gt;
&lt;td&gt; 433&lt;/td&gt;
&lt;td&gt;50
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt; 1000&lt;/td&gt;
&lt;td&gt; 805&lt;/td&gt;
&lt;td&gt;90
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 10&lt;/td&gt;
&lt;td&gt; 320&lt;/td&gt;
&lt;td&gt;10
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 20&lt;/td&gt;
&lt;td&gt; 423&lt;/td&gt;
&lt;td&gt;20
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 50&lt;/td&gt;
&lt;td&gt; 809&lt;/td&gt;
&lt;td&gt;60
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 100&lt;/td&gt;
&lt;td&gt; 1479&lt;/td&gt;
&lt;td&gt;130
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 200&lt;/td&gt;
&lt;td&gt; 2803&lt;/td&gt;
&lt;td&gt;250
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 500&lt;/td&gt;
&lt;td&gt; 6914&lt;/td&gt;
&lt;td&gt;600
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1000&lt;/td&gt;
&lt;td&gt; 1000&lt;/td&gt;
&lt;td&gt; 15410&lt;/td&gt;
&lt;td&gt;1190
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 10&lt;/td&gt;
&lt;td&gt; 16168&lt;/td&gt;
&lt;td&gt;190
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 20&lt;/td&gt;
&lt;td&gt; 17491&lt;/td&gt;
&lt;td&gt;320
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 50&lt;/td&gt;
&lt;td&gt; 21348&lt;/td&gt;
&lt;td&gt;710
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 100&lt;/td&gt;
&lt;td&gt; 28314&lt;/td&gt;
&lt;td&gt;1480
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 200&lt;/td&gt;
&lt;td&gt; 41547&lt;/td&gt;
&lt;td&gt;2860
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 500&lt;/td&gt;
&lt;td&gt; 81166&lt;/td&gt;
&lt;td&gt;7200
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10000&lt;/td&gt;
&lt;td&gt; 1000&lt;/td&gt;
&lt;td&gt; 147570&lt;/td&gt;
&lt;td&gt;14190
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-05-21:161</id>
    <published>2008-05-21T22:13:00Z</published>
    <updated>2008-05-21T22:26:50Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="$"/>
    <category term="oil"/>
    <category term="prices"/>
    <link href="http://people.equars.com/2008/5/21/oil-price" rel="alternate" type="text/html"/>
    <title>Oil price</title>
<content type="html">
            &lt;p&gt;I&#8217;d like to reiterate a &lt;a href=&quot;http://perassi.org/2007/09/28/mea-culpa/&quot;&gt;past meme&lt;/a&gt;. This time I restrict the meme to  one single prediction:  please tell me wether you think the &lt;a href=&quot;http://tonto.eia.doe.gov/dnav/pet/pet_pri_spt_s1_d.htm&quot;&gt;crude oil price&lt;/a&gt; will pass the 150$ per barrell in the very near future, and, if you think that of it&#8217;s only matter of weeks, dare to say the exact day. I venture myself to bespeak the 30th of June, 2008.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://perassi.org/&quot;&gt;Carlo&lt;/a&gt;, &lt;a href=&quot;http://blog.bluendo.com/antitifoso/&quot;&gt;Alx&lt;/a&gt;, what do you think?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-05-14:160</id>
    <published>2008-05-14T22:15:00Z</published>
    <updated>2008-05-22T22:17:14Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="lighttpd"/>
    <category term="lua"/>
    <category term="mephisto"/>
    <category term="mongrel"/>
    <link href="http://people.equars.com/2008/5/14/caching-mephisto-with-lighttpd-and-mod_magnet" rel="alternate" type="text/html"/>
    <title>Caching Mephisto with lighttpd and mod_magnet</title>
<content type="html">
            &lt;p&gt;This blog uses &lt;a href=&quot;http://mephistoblog.com&quot;&gt;Mephisto&lt;/a&gt;, a &lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;rails&lt;/a&gt; application, and &lt;a href=&quot;http://code.macournoyer.com/thin/&quot;&gt;Thin&lt;/a&gt; as backend webserver. The frontend webserver is &lt;a href=&quot;http://lighttpd.net&quot;&gt;Lighttpd&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While Mephisto has a good caching system, producing a static html file for every visited page, the file is still served via Thin, reducing the speed and the scalability of the system and introducing an unnecessary step.&lt;/p&gt;

&lt;p&gt;Lighttpd is very good at &lt;a href=&quot;http://www.lighttpd.net/benchmark&quot;&gt;serving static files&lt;/a&gt;,
thus I searched a way to serve a file from the cache directory of Mephisto, if present; 
I found a hack using &lt;a href=&quot;http://trac.lighttpd.net/trac/wiki/Docs%3AModMagnet&quot;&gt;mod_magnet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hereafter I wrote the relevant snippets of configuration files and how to put every piece in the right position.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; the same procedure should apply if you use &lt;a href=&quot;http://mongrel.rubyforge.org/&quot;&gt;Mongrel&lt;/a&gt; instead of Thin, for the relevant point is to bypass the backend rails webserver and serve all files (whether they exist) from the Mephisto cache. &lt;/p&gt;

&lt;p&gt;First I configure Lighttpd to proxy to Thin for the rails application. I assume Thin (or Mongrel) is listening on port 3000 on two hosts.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  HTTP[''host&quot;] == &quot;virtualhost.example.org&quot; {
        magnet.attract-physical-path-to = ( &quot;/var/www/cache_mephisto.lua&quot; ) 
        proxy.balance = &quot;hash&quot;
        proxy.server  = ( &quot;&quot; =&amp;gt; ( ( &quot;host&quot; =&amp;gt; &quot;10.0.0.1&quot;, &quot;port&quot; =&amp;gt;  3000 ),
                                ( &quot;host&quot; =&amp;gt; &quot;10.0.0.2&quot;, &quot;port&quot; =&amp;gt;  3000 ) ) )
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;magnet.attract-physical-path-to = ( &quot;/var/www/cache_mephisto.lua&quot; )&lt;/code&gt; is the magic trick.
 &lt;code&gt;cache_mephisto.lua&lt;/code&gt; is a script written in &lt;a href=&quot;http://www.lua.org/&quot;&gt;lua&lt;/a&gt; programming language.
The whole script is: &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  local dir =  &quot;/path/to/mephisto/public/cache/&quot; .. lighty.request[&quot;Host&quot;]

  if ( lighty.env[&quot;request.uri&quot;] == nil or lighty.env[&quot;request.uri&quot;] == &quot;/&quot;) then
    file = dir .. &quot;/index.html&quot;
  else
    file = dir .. lighty.env[&quot;request.uri&quot;] ..  &quot;.html&quot;
  end

  if lighty.stat(file) then
  lighty.header[&quot;Content-Type&quot;] = &quot;text/html&quot;
  lighty.content = { { filename = file } }
  return 200
  end

 return lighty.RESTART_REQUEST
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Inside the script you should adapt the variable &lt;code&gt;dir&lt;/code&gt; to your Mephisto installation path. I need to append the virtual host name &lt;code&gt; lighty.request[&quot;Host&quot;] &lt;/code&gt; to the directory, for I run a multisite Mephisto installation; if you use a single site mephisto installation, probably you need to remove this append.&lt;/p&gt;

&lt;p&gt;Now for some benchmarks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;serving the file via Thin:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   Requests per second:    1.40 [#/sec] (mean)
   Time per request:       716.007 [ms] (mean)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;serving the file from the cache&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   Requests per second:    11.46 [#/sec] (mean)
   Time per request:       87.247 [ms] (mean)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost a tenfold improvement!&lt;/p&gt;

&lt;p&gt;Future works: serve from the cache the image files.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-04-20:157</id>
    <published>2008-04-20T20:06:00Z</published>
    <updated>2008-04-20T20:06:38Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="economy"/>
    <category term="usa"/>
    <link href="http://people.equars.com/2008/4/20/us-economy" rel="alternate" type="text/html"/>
    <title>US Economy</title>
<content type="html">
            &lt;p&gt;A thoughtful article: &lt;a href=&quot;http://www.falkvinge.com/2008/03/why-us-is-collapsing.html&quot;&gt;why Us economy is collapsing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A really interesting movie: &lt;a href=&quot;http://video.google.com/videoplay?docid=-9050474362583451279&quot;&gt;money as debt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;embed src=&quot;http://video.google.com/googleplayer.swf?docid=-9050474362583451279&amp;amp;amp;hl=en&quot;&gt; &amp;lt;/embed&gt;&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2008-03-13:156</id>
    <published>2008-03-13T11:19:00Z</published>
    <updated>2008-03-13T11:24:10Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="postgresql"/>
    <category term="rrdtool"/>
    <category term="ruby"/>
    <link href="http://people.equars.com/2008/3/13/postgresql-graph" rel="alternate" type="text/html"/>
    <title>Postgresql Graph</title>
<content type="html">
            &lt;p&gt;I wrote a small tool, &lt;a href=&quot;http://people.equars.com/~marco/software/postgresqlgraph&quot;&gt;postgresqlgraph&lt;/a&gt;, to monitor and plot the statistics of a &lt;a href=&quot;http://www.postgresql.org&quot;&gt;postgresql&lt;/a&gt; database, using &lt;a href=&quot;http://oss.oetiker.ch/rrdtool/&quot;&gt;rrdtool&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The tool is able to monitor every database created inside a postgresql installation.&lt;/p&gt;

&lt;p&gt;The parameters plotted for each database in the graph are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;numbackends: number of backends:&lt;/li&gt;
&lt;li&gt;xact_commit: transactions committed;&lt;/li&gt;
&lt;li&gt;xact_rollback: transactions rolled back;&lt;/li&gt;
&lt;li&gt;blks_read: blocks read from the disk;:&lt;/li&gt;
&lt;li&gt;blks_hit: blocks hit in the cache;&lt;/li&gt;
&lt;li&gt;tup_returned: tuples returned (only in postgresql 8.3)&lt;/li&gt;
&lt;li&gt;tup_fetched: tuples fetched (only in postgresql 8.3)&lt;/li&gt;
&lt;li&gt;tup_inserted: tuples inserted (only in postgresql 8.3)&lt;/li&gt;
&lt;li&gt;tup_updated: tuples updated (only in postgresql 8.3)&lt;/li&gt;
&lt;li&gt;tup_deleted: deleted (only in postgresql 8.3)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each parameter the graph shows the maximum and average values, and plots the derivative (rate change). &lt;/p&gt;

&lt;p&gt;The software is published under &lt;a href=&quot;http://www.fsf.org/licensing/licenses/gpl.html&quot;&gt;GPLv3&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;A demo is available &lt;a href=&quot;http://people.equars.com/~marco/software/postgresqlgraph/demo/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please feel free to submit me bugs, critics, improvements, or tell me if you find the tool of any worthwhileness.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-11-27:146</id>
    <published>2007-11-27T16:00:00Z</published>
    <updated>2007-11-27T16:10:38Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="law"/>
    <category term="software"/>
    <link href="http://people.equars.com/2007/11/27/snafu" rel="alternate" type="text/html"/>
    <title>SNAFU</title>
<content type="html">
            &lt;p&gt;I spent a frustrating week of problem solving (or at least trying to&#8230;) of obscure integration issues among different programs,
like trying to get &lt;a href=&quot;http://www.zabbix.org&quot;&gt;zabbix&lt;/a&gt; to talk with a &lt;a href=&quot;http://www.jabber.org&quot;&gt;jabber&lt;/a&gt; server (the solution was found in IPV6), reading  unuseful logs to debug problems (what the hell do you mean with &#8220;connection failed&#8221;? To what?) , recompiling software with arcane options, rebooting servers with the swap space full (&lt;a href=&quot;http://httpd.apache.org&quot;&gt;apache&lt;/a&gt;,  what are you doing?), or trying to stop a server that continues to reboot itself  at boot (&lt;a href=&quot;http://en.wikipedia.org/wiki/Xen&quot;&gt;Xen&lt;/a&gt;, please tell me why&#8230;), or  fighting with buggy &lt;a href=&quot;http://en.wikipedia.org/wiki/Spaghetti_code&quot;&gt;PHP&lt;/a&gt; frontend, and, last but not least, investigate why a &lt;a href=&quot;http://munin.projects.linpro.no/&quot;&gt;monitoring software&lt;/a&gt;  just stopped working.&lt;/p&gt;

&lt;p&gt;So I come to wonder if it exists a software that &#8220;just works&#8221;. If you ever happen to read this rambling and know such a software, please, please tell me. In the meanwhile I coined a law:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dela&#8217;s Law of software&lt;/strong&gt;: there is no software that &#8220;just works&#8221;&lt;br /&gt;
&lt;strong&gt;Corollary to the Dela&#8217;s Law of software&lt;/strong&gt;: if a software seems to &#8220;just work&#8221;, after some times it will stop to work for an obscure, unknown and very difficult to find reason.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-10-25:144</id>
    <published>2007-10-25T21:43:00Z</published>
    <updated>2007-10-25T22:30:12Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="machine"/>
    <category term="math"/>
    <link href="http://people.equars.com/2007/10/25/universal-turing-machine" rel="alternate" type="text/html"/>
    <title>Universal Turing Machine</title>
<content type="html">
            &lt;p&gt;So, it seems that the simplest &lt;a href=&quot;http://en.wikipedia.org/wiki/Universal_Turing_machine&quot;&gt;universal turing machine&lt;/a&gt; has been &lt;a href=&quot;http://blog.wolfram.com/2007/10/the_prize_is_won_the_simplest.html&quot;&gt;demonstrated&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The simplest universal turing machine (T. M.) is, well, the simplest: 2 states and 3 symbols (or colors, as they are called by &lt;a href=&quot;http://blog.wolfram.com/&quot;&gt; Stephen Wolfram&lt;/a&gt;), since a 2-states 2-symbols T.M. can not be universal. &lt;/p&gt;

&lt;p&gt;This particular machine has however a subtle issue, for it requires an infinite memory (or &#8221;tape&#8221; in the original definition of &lt;a href=&quot;http://en.wikipedia.org/wiki/Alan_Turing&quot;&gt;Turing&lt;/a&gt;), not satisfying perfectly the definition of universality given by &lt;a href=&quot;http://en.wikipedia.org/wiki/Martin_Davis&quot;&gt;Davis&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Marvin_Minsky&quot;&gt;Minsky&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The answer to the issue is that the pattern of bits in the memory can be set up without an universal  T.M., so the universality is independent from the encoding of the pattern. I wonder if a (2,3) universal T.M. can be built with finite memory.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-10-24:143</id>
    <published>2007-10-24T22:10:00Z</published>
    <updated>2008-01-09T22:23:02Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="asterisk"/>
    <category term="asteriskgui"/>
    <category term="snom"/>
    <link href="http://people.equars.com/2007/10/24/asterisk-username-mismatch" rel="alternate" type="text/html"/>
    <title>Asterisk Username Mismatch Workaround</title>
<content type="html">
            &lt;p&gt;I installed recently &lt;a href=&quot;http://www.asterisknow.org/&quot;&gt;AsteriskNow&lt;/a&gt; beta6, that is a &lt;a href=&quot;http://www.rpath.com/rbuilder/&quot;&gt;rpath&lt;/a&gt; based Linux distribution, which contains
&lt;a href=&quot;http://www.asterisk.org/&quot;&gt;Asterisk&lt;/a&gt; 1.4.9 and AsteriskGUI.&lt;/p&gt;

&lt;p&gt;While I was trying to  use with a &lt;a href=&quot;http://www.snom.com&quot;&gt;SNOM&lt;/a&gt; phone (which, by the way,
is a great product) with two identies configured on it, say 101 and 103, I stumbled on a problem well known on the web.&lt;/p&gt;

&lt;p&gt;If I try to use an identity calling out, everything is working fine; while if I try to use the other identity, I obtain the following error:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   WARNING[32233]: chan_sip.c:8126 check_auth: username mismatch, have &amp;lt;101&amp;gt;, digest has &amp;lt;103&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The users &lt;code&gt;101&lt;/code&gt; and &lt;code&gt;103&lt;/code&gt; are created with the GUI. If you look in &lt;code&gt;/etc/asterisk/users.conf&lt;/code&gt; you will find something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;   [101]
   callwaiting = yes
   cid_number = 
   context = numberplan-custom-1
   fullname = 101
   hasagent = no
   hasdirectory = no
   hasiax = no
   hasmanager = no
   hassip = yes
   hasvoicemail = yes
   host = dynamic
   mailbox = 101
   secret = xxx
   threewaycalling = yes
   vmsecret = xxx
   registersip = yes 
   canreinvite = yes
   nat = no
   dtmfmode = rfc2833
   disallow = all
   allow = ulaw,alaw

   [103]
   callwaiting = yesWorkaround
   cid_number = 
   context = numberplan-custom-1
   fullname = 103
   hasagent = no
   hasdirectory = no
   hasiax = no
   hasmanager = no
   hassip = yes
   hasvoicemail = yes
   host = dynamic
   mailbox = 103
   secret = xxx
   threewaycalling = yes
   vmsecret = xxx
   registersip = yes 
   canreinvite = yes
   nat = no
   dtmfmode = rfc2833
   disallow = all
   allow = ulaw,alaw
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;Workaround&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I solved the problem, at least in my installation, using a workaround. I just copied and adapted the above definitions in the file &lt;code&gt;/etc/asterik/sip.conf&lt;/code&gt;. This file is not touched by the GUI, so you can edit it safely. Just remember to modify it if you modify the users definition with the GUI, in order to reflect the variations of &lt;code&gt;users.conf&lt;/code&gt;. The relevant part of &lt;code&gt;sip.conf&lt;/code&gt; looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  [101]
  type = friend;
  context = numberplan-custom-1;
  secret = xxx
  host = dynamic ;
  dtmfmode = rfc2833;
  disallow = all
  allow = ulaw,alaw;
  canreinvite = yes

  [103]
  type = friend;
  context = numberplan-custom-1;
  secret = xxx
  host = dynamic ;
  dtmfmode = rfc2833;
  disallow = all
  allow = ulaw,alaw;
  canreinvite = yes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Well, it seems to work.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-10-14:142</id>
    <published>2007-10-14T21:32:00Z</published>
    <updated>2007-10-14T21:47:04Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="idn"/>
    <category term="unicode"/>
    <link href="http://people.equars.com/2007/10/14/unicode" rel="alternate" type="text/html"/>
    <title>Unicode </title>
<content type="html">
            &lt;p&gt;Inspired by &lt;a href=&quot;http://www.inference.phy.cam.ac.uk/cjb/codepoints.html&quot;&gt;http://www.inference.phy.cam.ac.uk/cjb/codepoints.html&lt;/a&gt;
I write some of my favourite Unicode Codepoints:&lt;/p&gt;

&lt;p&gt;U+0488       &amp;nbsp; &amp;nbsp;       ҈  &amp;nbsp;&amp;nbsp;  COMBINING CYRILLIC HUNDRED THOUSANDS SIGN&lt;/p&gt;

&lt;p&gt;U+0489  &amp;nbsp; &amp;nbsp;     ҉  &amp;nbsp;&amp;nbsp;  COMBINING CYRILLIC MILLIONS SIGN&lt;/p&gt;

&lt;p&gt;U+0F17  &amp;nbsp;&amp;nbsp;   ༗   &amp;nbsp;&amp;nbsp;  TIBETAN ASTROLOGICAL SIGN GRA GCAN -CHAR RTAGS&lt;/p&gt;

&lt;p&gt;U+0FCA  &amp;nbsp;&amp;nbsp;   ࿊   &amp;nbsp;&amp;nbsp;  TIBETAN SYMBOL NOR BU NYIS -KHYIL&lt;/p&gt;

&lt;p&gt;U+1697  &amp;nbsp;&amp;nbsp;   ᚗ   &amp;nbsp;&amp;nbsp;   OGHAM LETTER UILLEANN&lt;/p&gt;

&lt;p&gt;U+2121 &amp;nbsp;&amp;nbsp;    ℡ &amp;nbsp;&amp;nbsp;    TELEPHONE SIGN&lt;/p&gt;

&lt;p&gt;U+2618  &amp;nbsp;&amp;nbsp;   ☘ &amp;nbsp;&amp;nbsp;     SHAMROCK&lt;/p&gt;

&lt;p&gt;U+2620  &amp;nbsp;&amp;nbsp;   ☠   &amp;nbsp;&amp;nbsp;   SKULL AND CROSSBONES&lt;/p&gt;

&lt;p&gt;U+2623  &amp;nbsp;&amp;nbsp;   ☣  &amp;nbsp;&amp;nbsp;    BIOHAZARD SIGN&lt;/p&gt;

&lt;p&gt;U+20AC &amp;nbsp;&amp;nbsp;   ⨌  &amp;nbsp;&amp;nbsp;   QUADRUPLE INTEGRAL OPERATOR&lt;/p&gt;

&lt;p&gt;U+260F &amp;nbsp;&amp;nbsp;    ☏  &amp;nbsp;&amp;nbsp;   WHITE TELEPHONE&lt;/p&gt;

&lt;p&gt;U+2709  &amp;nbsp;&amp;nbsp;   ✉  &amp;nbsp;&amp;nbsp;    ENVELOPE&lt;/p&gt;

&lt;p&gt;𐌌𐌀𐌓𐌂𐌏&lt;/p&gt;

&lt;p&gt;P.s.
Does your browser support idn: &lt;a href=&quot;http://☠.equars.com&quot;&gt;http://☠.equars.com&lt;/a&gt; ?&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-10-04:140</id>
    <published>2007-10-04T11:17:00Z</published>
    <updated>2007-10-04T20:00:01Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="lost"/>
    <category term="social_networking"/>
    <link href="http://people.equars.com/2007/10/4/lost" rel="alternate" type="text/html"/>
    <title>Lost</title>
<content type="html">
            &lt;p&gt;&lt;a href=&quot;http://www.lost.eu/&quot;&gt;Lost&lt;/a&gt;: is a game, an experiment in social networking, or just bright marketing?
(Well, just in case you&#8217;d like to try it &lt;a href=&quot;http://www.lost.eu/6674b&quot;&gt;www.lost.eu/6674b&lt;/a&gt; ;) )&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://people.equars.com/">
    <author>
      <name>marco</name>
    </author>
    <id>tag:people.equars.com,2007-10-04:139</id>
    <published>2007-10-04T10:06:00Z</published>
    <updated>2007-10-04T11:19:36Z</updated>
    <category term="Hiraedd (Marco's blog)"/>
    <category term="bandaloop"/>
    <category term="dance"/>
    <link href="http://people.equars.com/2007/10/4/bandaloop-wow" rel="alternate" type="text/html"/>
    <title>Bandaloop: wow.</title>
<content type="html">
            &lt;p&gt;Yesterday I saw in Turin a performance of the &lt;a href=&quot;http://www.projectbandaloop.org/&quot;&gt;Bandaloop&lt;/a&gt;. It was absolutely speechless and breathtaking to see the dancers performing their aerial choreography and vertical dance at 70m of height in the air.&lt;/p&gt;
          </content>  </entry>
</feed>
