Ejemplo n.º 1
0
    def belongs(self, mat, atol=gs.atol):
        """Check if a matrix is symmetric with positive eigenvalues.

        Parameters
        ----------
        mat : array-like, shape=[..., n, n]
            Matrix to be checked.
        atol : float
            Tolerance.
            Optional, default: backend atol.

        Returns
        -------
        belongs : array-like, shape=[...,]
            Boolean denoting if mat is an SPD matrix.
        """
        is_sym = self.ambient_space.belongs(mat, atol)
        is_pd = Matrices.is_pd(mat)
        belongs = gs.logical_and(is_sym, is_pd)
        return belongs