Created
May 8, 2018 16:19
-
-
Save renzon/e0f7532e944ae5036f5d231018efd986 to your computer and use it in GitHub Desktop.
Matrix Diagonal dominante
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def eh_diagonal_dominante(matriz): | |
... for i, linha in enumerate(matriz): | |
... soma = sum(linha) | |
... item_diagonal = linha[i] | |
... if item_diagonal <= (soma - item_diagonal): | |
... return False | |
... return True | |
... | |
>>> eh_diagonal_dominante([ | |
... [2, 1], | |
... [1, 2]]) | |
True | |
>>> eh_diagonal_dominante([ | |
... [2, 1], | |
... [2, 1]]) | |
False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment