]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/cone/doubly_nonnegative.py
mjo: replace xrange() with range() for python-3.x compatibility.
[sage.d.git] / mjo / cone / doubly_nonnegative.py
index 92184d15c4133e33f04e877352787378ae3739df..43a2f61c5e3fa858098175e8c9e37c08acc11e45 100644 (file)
@@ -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