Mike;<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Not quite, because I can&#39;t add member functions that would<br>
perform &quot;horizontal&quot; operations (e.g. norm() for vectors, or draw() for<br>
probability arrays).<br>
<br>
</blockquote>
<br></div>
Sometimes I create public classes just as namespaces to encapsulate functionality.  You could have public class Probabilities that contains a bunch of static members and then create a Vector class that has-a float[] and whatever else it needs and wraps Probabilities.norm() in member function Vector.norm().<br>

<br>
Would that be a compromise?  Or am I missing something?<br>
<br></blockquote><div><br>I agree, particularly as the normalisation operation would most likely be applied to the vector (probably to yield a unity length) and it wouldn&#39;t be the array itself that would be normalised. So; if it would apply to the vector it could/should belong to the vector&#39;s properties/namespace I&#39;d say.<br>
<br>A separate question might be whether we would need some syntactic sugar to apply a single operation to all array entries in a given array (for example to normalise a set of a thousand vectors or to compute the absolute value of all floats in a given array). This might make sense but a simple &quot;for&quot; loop and a single line of code will do the job as well. For multi-dimensional arrays this quickly becomes so hard to generalise that I think for loops are perfectly fine, especially as they are so clear.<br>
<br>In practice much of this would depend on the exact issue we are trying to solve and how. We could look into some concrete examples if Cyrille has some and see where the issues arise. I myself would certainly start here with defining a class named &quot;vector&quot;, that would hold a array (of the vector&#39;s components) as well as member functions for normalising it, multiplying it by floats and possibly others, depending on the situation.<br>
</div></div><br>It takes a bit of work and thought but once done you can re-use it forever.<br><br>Yours,<br>Kas.<br>