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
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
# 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.