The following gives a 1-d vector reading the lower triangular values by row.  There may be more efficient ways to do this, especially if you are guaranteed there aren&#39;t any lower triangular elements equal to 0.<div><br>
<div>import numpy as np</div><div>def lowerTri(x): </div><div>    return np.concatenate([ x[i][:i+1] for i in xrange(x.shape[0]) ])</div><div><br></div><div>A = np.array([[2,  4,  6],[8, 10, 12], [14, 16, 18]])</div><div>
lowerTri(A)</div><div>array([ 2, 8, 10, 14, 16, 18 ])<br><div class="gmail_quote"><br></div><div class="gmail_quote">-- Joe L.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Apr 11, 2011 at 2:24 PM, Yiou Li <span dir="ltr">&lt;<a href="mailto:liyiou@gmail.com">liyiou@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dear all,<br>
<br>
I have a N x N array and want to obtain the lower triangle half of the<br>
array elements and arrange them into a 1-dimensional data vector.<br>
<br>
I googled a bit and find the numpy.tril() function but it just zero<br>
out the upper triangle elements so it doesn&#39;t work for me. I also<br>
tried y = x(tril(x)!=0) but it gives me error.<br>
<br>
You advise is very much appreciated!<br>
<br>
Leo<br>
_______________________________________________<br>
Baypiggies mailing list<br>
<a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
To change your subscription options or unsubscribe:<br>
<a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
</blockquote></div><br></div></div>