Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/geometry/semialgebraic/semidefinite.py: Clarify that all mat…
Browse files Browse the repository at this point in the history
…rices are symmetric
  • Loading branch information
mkoeppe committed Jun 13, 2021
1 parent 899f4b7 commit 7e821cf
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/sage/geometry/semialgebraic/semidefinite.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
from sage.structure.unique_representation import UniqueRepresentation
from sage.geometry.convex_set import ConvexSet_closed, ConvexSet_relatively_open

class PositiveSemidefiniteMatrices_base(UniqueRepresentation):

class SemidefiniteMatrices_base(UniqueRepresentation):
r"""
Base class for convex sets of semidefinite matrices.
"""

def __init__(self, matrix_space):
r"""
Expand Down Expand Up @@ -54,9 +56,10 @@ def contains(self, point):

__contains__ = contains

class PositiveSemidefiniteMatrices(PositiveSemidefiniteMatrices_base, ConvexSet_closed):

class PositiveSemidefiniteMatrices(SemidefiniteMatrices_base, ConvexSet_closed):
r"""
The convex cone of positive semidefinite matrices
The convex cone of positive semidefinite symmetric matrices
EXAMPLES::
Expand All @@ -78,12 +81,19 @@ class PositiveSemidefiniteMatrices(PositiveSemidefiniteMatrices_base, ConvexSet_
sage: A in M_psd
True
And finally, an indefinite matrix::
An indefinite matrix::
sage: A = matrix(QQ, [ [0,1],
....: [1,0] ] )
sage: A in M_psd
False
And, finally, a non-symmetric matrix::
sage: A = matrix(QQ, [ [2,2],
....: [1,2] ] )
sage: A in M_psd
False
"""
def relative_interior(self):
return PositiveDefiniteMatrices(self._matrix_space)
Expand All @@ -97,9 +107,10 @@ def is_relatively_open(self):
def is_compact(self):
return self.dimension() == 0

class PositiveDefiniteMatrices(PositiveSemidefiniteMatrices_base, ConvexSet_relatively_open):

class PositiveDefiniteMatrices(SemidefiniteMatrices_base, ConvexSet_relatively_open):
r"""
The convex set of positive definite matrices
The convex set of positive definite symmetric matrices
EXAMPLES::
Expand All @@ -121,12 +132,19 @@ class PositiveDefiniteMatrices(PositiveSemidefiniteMatrices_base, ConvexSet_rela
sage: A in M_pd
False
And finally, an indefinite matrix::
An indefinite matrix::
sage: A = matrix(QQ, [ [0,1],
....: [1,0] ] )
sage: A in M_pd
False
And, finally, a non-symmetric matrix::
sage: A = matrix(QQ, [ [2,2],
....: [1,2] ] )
sage: A in M_pd
False
"""
def closure(self):
return PositiveSemidefiniteMatrices(self._matrix_space)
Expand Down

0 comments on commit 7e821cf

Please sign in to comment.