X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fcone%2Fdoubly_nonnegative.py;h=43a2f61c5e3fa858098175e8c9e37c08acc11e45;hb=8698debba196d8746c1a32d8e6866085b6cb2161;hp=92184d15c4133e33f04e877352787378ae3739df;hpb=37f72edc947102d41a23c96ff01a51483185a21b;p=sage.d.git diff --git a/mjo/cone/doubly_nonnegative.py b/mjo/cone/doubly_nonnegative.py index 92184d1..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 xrange(A.ncols()): - for i in xrange(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