You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a function that takes in as input a matrix (as a numpy array) and returns True if the matrix is nonnegative and False otherwise.
A function like the following could be written:
importnumpyasnpdefis_nonnegative(mat: np.ndarray) ->bool:
"""Check if a matrix is nonnegative. A matrix is nonnegative if all of the entries in the matrix are >= 0 """returnnp.all(mat>=0)
One would also need to provide proper documentation, examples, and unit tests for this function as well.
The text was updated successfully, but these errors were encountered:
Provide a function that takes in as input a matrix (as a numpy array) and returns
True
if the matrix is nonnegative andFalse
otherwise.A function like the following could be written:
One would also need to provide proper documentation, examples, and unit tests for this function as well.
The text was updated successfully, but these errors were encountered: