]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/cone/symmetric_psd.py
mjo/cone: rename random_psd() to random_symmetric_psd().
[sage.d.git] / mjo / cone / symmetric_psd.py
index 1b3dd8ab6d8905a1af202eec3816c46ece906561..e75c152b86be407f2e235f7db7e2b4c51a42b8ad 100644 (file)
@@ -201,7 +201,7 @@ def factor_psd(A):
     return Q*root_D*Q.transpose()
 
 
-def random_psd(V, accept_zero=True, rank=None):
+def random_symmetric_psd(V, accept_zero=True, rank=None):
     """
     Generate a random symmetric positive-semidefinite matrix over the
     vector space ``V``. That is, the returned matrix will be a linear
@@ -242,14 +242,15 @@ def random_psd(V, accept_zero=True, rank=None):
 
     SETUP::
 
-        sage: from mjo.cone.symmetric_psd import is_symmetric_psd, random_psd
+        sage: from mjo.cone.symmetric_psd import (is_symmetric_psd,
+        ....:                                     random_symmetric_psd)
 
     EXAMPLES:
 
     Well, it doesn't crash at least::
 
         sage: V = VectorSpace(QQ, 2)
-        sage: A = random_psd(V)
+        sage: A = random_symmetric_psd(V)
         sage: A.matrix_space()
         Full MatrixSpace of 2 by 2 dense matrices over Rational Field
         sage: is_symmetric_psd(A)
@@ -258,26 +259,26 @@ def random_psd(V, accept_zero=True, rank=None):
     A matrix with the desired rank is returned::
 
         sage: V = VectorSpace(QQ, 5)
-        sage: A = random_psd(V,False,1)
+        sage: A = random_symmetric_psd(V,False,1)
         sage: A.rank()
         1
-        sage: A = random_psd(V,False,2)
+        sage: A = random_symmetric_psd(V,False,2)
         sage: A.rank()
         2
-        sage: A = random_psd(V,False,3)
+        sage: A = random_symmetric_psd(V,False,3)
         sage: A.rank()
         3
-        sage: A = random_psd(V,False,4)
+        sage: A = random_symmetric_psd(V,False,4)
         sage: A.rank()
         4
-        sage: A = random_psd(V,False,5)
+        sage: A = random_symmetric_psd(V,False,5)
         sage: A.rank()
         5
 
     If the user asks for a rank that's too high, we fail::
 
         sage: V = VectorSpace(QQ, 2)
-        sage: A = random_psd(V,False,3)
+        sage: A = random_symmetric_psd(V,False,3)
         Traceback (most recent call last):
         ...
         ValueError: The ``rank`` must be between 0 and the dimension of ``V``.
@@ -318,4 +319,4 @@ def random_psd(V, accept_zero=True, rank=None):
         return A
     else:
         # Uh oh, we need to generate a new one.
-        return random_psd(V, accept_zero, rank)
+        return random_symmetric_psd(V, accept_zero, rank)