toqito icon indicating copy to clipboard operation
toqito copied to clipboard

Feature: Check if a matrix is doubly nonnegative

Open vprusso opened this issue 1 year ago • 0 comments

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.

vprusso avatar Apr 20 '24 16:04 vprusso