From: Michael Orlitzky Date: Sun, 4 Nov 2018 05:56:57 +0000 (-0400) Subject: cone/doubly_nonnegative.py: use generator expressions in two places. X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=0f625ccf86a08c314e79d203ba5cd1a69bf2ba34;p=sage.d.git cone/doubly_nonnegative.py: use generator expressions in two places. --- diff --git a/mjo/cone/doubly_nonnegative.py b/mjo/cone/doubly_nonnegative.py index 583c3c6..f0d2a62 100644 --- a/mjo/cone/doubly_nonnegative.py +++ b/mjo/cone/doubly_nonnegative.py @@ -56,7 +56,7 @@ def is_doubly_nonnegative(A): raise ValueError.new(msg) # Check that all of the entries of ``A`` are nonnegative. - if not all([ a >= 0 for a in A.list() ]): + if not all( a >= 0 for a in A.list() ): return False # It's nonnegative, so all we need to do is check that it's @@ -460,7 +460,7 @@ def random_doubly_nonnegative(V, accept_zero=True, rank=None): # one of them is nonnegative, then return that. A = random_psd(V, accept_zero, rank) - while not all([ x >= 0 for x in A.list() ]): + while not all( x >= 0 for x in A.list() ): A = random_psd(V, accept_zero, rank) return A