toqito
toqito copied to clipboard
Feature: Check if a matrix is doubly nonnegative
Provide a function that takes in as input a matrix (as an numpy array) and returns True if the matrix is doubly nonnegative and False otherwise.
A function like the following could be written:
import numpy as np
from toqito.matrix_props import is_positive_semidefinite
def is_doubly_nonnegative(mat: np.ndarray) -> bool:
"""Check if a matrix is doubly nonnegative.
A matrix is doubly nonnegative if it is nonnegative and positive
semidefinite.
"""
return is_nonnegative(mat) and is_positive_semidefinite(mat)
One would also need to provide proper documentation, examples, and unit tests for this function.