X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fcone%2Fsymmetric_psd.py;h=e4be629447987bca42a6d3e795f1b9926bc378c8;hb=1ce1d354d9442cf64cb61d41b3354f55b8a4331d;hp=bb46fc926ec8dc23588ef08ea49a974060a02841;hpb=6bb77d76f9a639a94b836fc24f067a37a6186f42;p=sage.d.git diff --git a/mjo/cone/symmetric_psd.py b/mjo/cone/symmetric_psd.py index bb46fc9..e4be629 100644 --- a/mjo/cone/symmetric_psd.py +++ b/mjo/cone/symmetric_psd.py @@ -6,15 +6,6 @@ all symmetric positive-semidefinite matrices (as a subset of from sage.all import * -# Sage doesn't load ~/.sage/init.sage during testing (sage -t), so we -# have to explicitly mangle our sitedir here so that "mjo.symbolic" -# resolves. -from os.path import abspath -from site import addsitedir -addsitedir(abspath('../../')) -from mjo.symbolic import matrix_simplify_full - - def is_symmetric_psd(A): """ Determine whether or not the matrix ``A`` is symmetric @@ -153,7 +144,7 @@ def factor_psd(A): sage: A = matrix(SR, [[0, 2, 3], [2, 0, 0], [3, 0, 0]]) sage: X = factor_psd(A) - sage: A2 = matrix_simplify_full(X*X.transpose()) + sage: A2 = (X*X.transpose()).simplify_full() sage: A == A2 True @@ -301,9 +292,8 @@ def random_psd(V, accept_zero=True, rank=None): # Use the one the user gave us. rank_A = rank - # Begin with the zero matrix, and add projectors to it if we have - # any. - A = V.zero_element().column()*V.zero_element().row() + # Begin with the zero matrix, and add projectors to it if we have any. + A = V.zero().column()*V.zero().row() # Careful, begin at idx=1 so that we only generate a projector # when rank_A is greater than zero.