Adding a utility routine for querying the number of nonpositive entries in a dense or sparse matrix