[SciPy-user] lower triangle matrix part: indexes of non-zeros

Nils Wagner nwagner@iam.uni-stuttgart...
Sat Oct 20 09:02:13 CDT 2007


On Sat, 20 Oct 2007 15:55:10 +0300
  dmitrey <dmitrey.kroshko@scipy.org> wrote:
> Hi all,
> I have a square symmetric matrix H (Hesse matrix).
> I need to obtain 3 vectors ind_0, ind_1, vals:
> vals[k] = H[ind_0[k], ind_1[k]]
> All those ind_0, ind_1, vals must be related to lower 
>triangle part of H 
> only.
> What's the best way to solve the problem?
> I'm usind H.nonzero() but it yields whole H, while I 
>need only lower 
> triangle.
> 
> Regards, D.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

Help on function tril in module numpy.lib.twodim_base:

tril(m, k=0)
     returns the elements on and below the k-th diagonal 
of m.  k=0 is the
     main diagonal, k > 0 is above and k < 0 is below the 
main diagonal.
  

Nils


More information about the SciPy-user mailing list