Esempio n. 1
0
    def test_structure(self):
        """Test that B and H are spd and inverses of each other."""
        # Insert a few {s,y} pairs.
        for _ in range(self.npairs + 2):
            s = np.random.random(self.n)
            y = np.random.random(self.n)
            self.B.store(s, y)
            self.H.store(s, y)

        assert self.B.insert == 2
        assert self.H.insert == 2

        assert check_symmetric(self.B)
        assert check_symmetric(self.H)
        assert check_positive_definite(self.B)
        assert check_positive_definite(self.H)

        C = self.B * self.H
        assert np.allclose(C.full(), np.eye(self.n))
Esempio n. 2
0
 def test_positive_definite(self):
     """Check that the factorization is a positive-definite operator."""
     assert check_positive_definite(self.M)
Esempio n. 3
0
 def test_positive_definite(self):
     """Check that the factorization is a positive-definite operator."""
     assert check_positive_definite(self.M)