[Baypiggies] Question about collecting lower/upper triangle elements from a python array

Yiou Li liyiou at gmail.com
Mon Apr 11 23:24:13 CEST 2011


Dear all,

I have a N x N array and want to obtain the lower triangle half of the
array elements and arrange them into a 1-dimensional data vector.

I googled a bit and find the numpy.tril() function but it just zero
out the upper triangle elements so it doesn't work for me. I also
tried y = x(tril(x)!=0) but it gives me error.

You advise is very much appreciated!

Leo


More information about the Baypiggies mailing list