<div dir="ltr">That's what I was looking for, except that I want to be sure to generate all the possible combinations, and to have no repeated values.<div><br></div><div>Thanks</div><div><br></div><div>Edmondo</div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/25 Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="im"><span style="font-size:10pt">On Wed, Sep 25, 2013 at 8:06 AM, Edmondo Porcu <<a href="mailto:edmondo.porcu@gmail.com" target="_blank">edmondo.porcu@gmail.com</a>> wrote:</span><br>><br>
</div><div><div class="h5">> Dear all, <br>><br>> I am a Newbie with Numpy and I would need some advice on how to create a matrix with certain characteristics : <br>

><br>>  - Every entry should be minimum 0 maximum 1 with a step of 0.1 (legal values are 0,0.1,0.2,0.3 etc)<br>><br>> - The number of columns of the matrix is a parameter of this matrix creation algorithm<br>

><br>
> - Only the rows where the sum is 1 must be kept<br>><br>> Would great appreciate your advice and suggestions<br><br></div></div>Use a multinomial distribution with n=10, then divide by 10.0.<div><br></div><div>
For example, with 5 columns and 20 samples:</div>

<div><br></div><div><div>[~]</div><div>|4> np.random.multinomial(10, np.ones(5)/5.0, size=20) / 10.0</div><div>array([[ 0.1,  0.1,  0.4,  0.1,  0.3],</div><div>       [ 0.2,  0.4,  0.1,  0.3,  0. ],</div><div>       [ 0.3,  0.2,  0. ,  0.2,  0.3],</div>


<div>       [ 0. ,  0.4,  0.4,  0. ,  0.2],</div><div>       [ 0.2,  0.3,  0.1,  0.2,  0.2],</div><div>       [ 0.1,  0.5,  0.1,  0.1,  0.2],</div><div>       [ 0.4,  0. ,  0.2,  0.3,  0.1],</div><div>       [ 0.3,  0.3,  0.1,  0. ,  0.3],</div>


<div>       [ 0. ,  0.2,  0.5,  0.2,  0.1],</div><div>       [ 0.5,  0.1,  0. ,  0.2,  0.2],</div><div>       [ 0.1,  0.3,  0.2,  0.2,  0.2],</div><div>       [ 0.3,  0.1,  0.2,  0.2,  0.2],</div><div>       [ 0.2,  0.3,  0. ,  0.3,  0.2],</div>


<div>       [ 0.2,  0.3,  0.2,  0.3,  0. ],</div><div>       [ 0.1,  0.3,  0.2,  0. ,  0.4],</div><div>       [ 0.1,  0.1,  0.2,  0.5,  0.1],</div><div>       [ 0.1,  0.6,  0. ,  0. ,  0.3],</div><div>       [ 0.1,  0.2,  0.4,  0.1,  0.2],</div>


<div>       [ 0.3,  0.1,  0.2,  0.2,  0.2],</div><div>       [ 0.2,  0.1,  0.4,  0.2,  0.1]])</div><br>--<br>Robert Kern<br></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>