X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fcone%2Fdoubly_nonnegative.py;h=43a2f61c5e3fa858098175e8c9e37c08acc11e45;hb=8698debba196d8746c1a32d8e6866085b6cb2161;hp=f0d2a62b6e9223d3ca5539dab9768e2b6d2367e9;hpb=0f625ccf86a08c314e79d203ba5cd1a69bf2ba34;p=sage.d.git diff --git a/mjo/cone/doubly_nonnegative.py b/mjo/cone/doubly_nonnegative.py index f0d2a62..43a2f61 100644 --- a/mjo/cone/doubly_nonnegative.py +++ b/mjo/cone/doubly_nonnegative.py @@ -13,7 +13,9 @@ It is represented typically by either `\mathcal{D}^{n}` or from sage.all import * -from mjo.cone.symmetric_psd import factor_psd, is_symmetric_psd, random_psd +from mjo.cone.symmetric_psd import (factor_psd, + is_symmetric_psd, + random_symmetric_psd) from mjo.matrix_vector import isomorphism @@ -369,8 +371,8 @@ def is_extreme_doubly_nonnegative(A): # whenever we come across an index pair `$(i,j)$` with # `$A_{ij} = 0$`. spanning_set = [] - for j in range(0, A.ncols()): - for i in range(0,j): + for j in range(A.ncols()): + for i in range(j): if A[i,j] == 0: M = A.matrix_space() S = X.transpose() * (stdE(M,i,j) + stdE(M,j,i)) * X @@ -458,10 +460,10 @@ def random_doubly_nonnegative(V, accept_zero=True, rank=None): # Generate random symmetric positive-semidefinite matrices until # one of them is nonnegative, then return that. - A = random_psd(V, accept_zero, rank) + A = random_symmetric_psd(V, accept_zero, rank) while not all( x >= 0 for x in A.list() ): - A = random_psd(V, accept_zero, rank) + A = random_symmetric_psd(V, accept_zero, rank) return A