python - Check Upper or Lower Triangular Matrix -
is there way, using numpy or scipy, check if matrix lower or upper triangular matrix?. know how create function check this; i'd know if these modules have own functions themselves. i'm searching in documentation not have found anything.
i do
np.allclose(mat, np.tril(mat)) # check if lower triangular np.allclose(mat, np.triu(mat)) # check if upper triangular np.allclose(mat, np.diag(np.diag(mat))) # check if diagonal
http://docs.scipy.org/doc/numpy/reference/generated/numpy.tril.html http://docs.scipy.org/doc/numpy/reference/generated/numpy.triu.html http://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html http://docs.scipy.org/doc/numpy/reference/generated/numpy.diag.html python numpy scipy
No comments:
Post a Comment