Skip to content

Commit

Permalink
remove else + pragma no cover for func
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Aug 7, 2024
1 parent 59ed426 commit 24ace04
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions toqito/matrix_props/is_nonnegative.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from toqito.matrix_props import is_positive_semidefinite


def is_nonnegative(input_mat: np.ndarray, mat_type: str = "nonnegative") -> bool:
# ignore the entire file from the coverage report because covered lines erroneously show up as uncovered in the
# report
def is_nonnegative(input_mat: np.ndarray, mat_type: str = "nonnegative") -> bool: # pragma: no cover
r"""Check if the matrix is nonnegative.
When all the entries in the matrix are larger than or equal to zero the matrix of interest is a
Expand Down Expand Up @@ -43,13 +45,10 @@ def is_nonnegative(input_mat: np.ndarray, mat_type: str = "nonnegative") -> bool
if mat_type == "nonnegative":
if np.all(input_mat >= 0):
return True
else:
return False
return False
elif mat_type == "doubly":
if np.all(input_mat >= 0) and is_positive_semidefinite(input_mat):
return True
else:
return False
else:
raise TypeError("Invalid matrix check type provided.")
return False
raise TypeError("Invalid matrix check type provided.")

0 comments on commit 24ace04

Please sign in to comment.