Exemple #1
0
 def test_monomials_linear(self) :
     L = MVPolyCube.monomials(2, 1)
     self.assertTrue(len(L) == 3)
     self.assertTrue((L[0].coef == [[1]]).all(),
                     "{0!s}".format(repr(L[0].coef)))
     self.assertTrue((L[1].coef == [[0, 0],
                                    [1, 0]]).all(),
                     "{0!s}".format(repr(L[1].coef)))
     self.assertTrue((L[2].coef == [[0, 1],
                                    [0, 0]]).all(),
                     "{0!s}".format(repr(L[2].coef)))
Exemple #2
0
 def test_monomials_quadratic(self) :
     L = MVPolyCube.monomials(2, 2)
     self.assertTrue(len(L) == 6)
     self.assertTrue((L[0].coef == [[1]]).all(),
                     "{0!s}".format(repr(L[0].coef)))
     self.assertTrue((L[1].coef == [[0, 0],
                                    [1, 0]]).all(),
                     "{0!s}".format(repr(L[1].coef)))
     self.assertTrue((L[2].coef == [[0, 1],
                                    [0, 0]]).all(),
                     "{0!s}".format(repr(L[2].coef)))
     self.assertTrue((L[3].coef == [[0, 0, 0],
                                    [0, 0, 0],
                                    [1, 0, 0]]).all(),
                     "{0!s}".format(repr(L[3].coef)))
     self.assertTrue((L[4].coef == [[0, 0, 0],
                                    [0, 1, 0],
                                    [0, 0, 0]]).all(),
                     "{0!s}".format(repr(L[4].coef)))
     self.assertTrue((L[5].coef == [[0, 0, 1],
                                    [0, 0, 0],
                                    [0, 0, 0]]).all(),
                     "{0!s}".format(repr(L[5].coef)))
Exemple #3
0
 def test_monomials_constant(self) :
     L = MVPolyCube.monomials(2, 0)
     self.assertTrue(len(L) == 1)
     self.assertTrue(L[0].coef == [[1]],
                     "{0!s}".format(repr(L[0].coef)))