tags:

views:

91

answers:

1

Okay, so basically lets say i have a matrix:

matrix([[0, 1, 2, 3, 4],
        [0, 1, 2, 3, 4],
        [0, 1, 2, 3, 4],
        [0, 1, 2, 3, 4],
        [0, 1, 2, 3, 4]])

Is it possible to get the area below the diagonal easily when working with numpy matrixs? I looked around and could not find anything. I can do the standard, for loop way however wouldnt that somehow invalidate the performance gave by numpy?

I am working on calculating statististics ofcomparing model output results with actual results. The data i currently have been given, results in around a 10,000 x 10,000 matrix. I am mainly trying to just sum those elements.

Is there an easy way to do this?

+6  A: 

You could use tril and triu. See them here: http://docs.scipy.org/doc/numpy/reference/routines.array-creation.html

Dmitry Kochkin
Perfect, thanks!
UberJumper