コード例 #1
0
    def test_generate_and_lll(self):
        h = 3
        N = 35
        f = [19, 14, 1]
        degree = 2
        k = 2
        X = math.ceil(
            (pow(2, - 1 / 2) * pow(h * k, -1 / (h * k - 1))) * pow(N, (h - 1) / (h * k - 1))) - 1
        gen = cs.generate(f, N, h, degree, X)

        ans = [[3, 8 * 2, -24 * 2 * 2, -8 * pow(2, 3), -1 * pow(2, 4), 2 * pow(2, 5)],
               [49, 50 * 2, 0 * 2 * 2, 20 *
                   pow(2, 3), 0 * pow(2, 4), 2 * pow(2, 5)],
               [115, -83 * 2, 4 * 2 * 2, 13 *
                   pow(2, 3), 6 * pow(2, 4), 2 * pow(2, 5)],
               [61, 16 * 2, 37 * 2 * 2, -16 *
                   pow(2, 3), 3 * pow(2, 4), 4 * pow(2, 5)],
               [21, -37 * 2, -14 * 2 * 2, 2 *
                   pow(2, 3), 14 * pow(2, 4), -4 * pow(2, 5)],
               [-201, 4 * 2, 33 * 2 * 2, -4 * pow(2, 3), -3 * pow(2, 4), 1 * pow(2, 5)]]

        self.assertEqual(cs.lll(gen), ans)
コード例 #2
0
 def test_lll_two(self):
     data = [[201, 37], [1648, 297]]
     ans = [[1, 32], [40, 1]]
     self.assertEqual(cs.lll(data, 0.75), ans)
コード例 #3
0
 def test_lll_three(self):
     data = [[15, 23, 11], [46, 15, 3], [32, 1, 1]]
     ans = [[1, 9, 9], [13, 5, -7], [6, -9, 15]]
     self.assertEqual(cs.lll(data, 0.75), data)
コード例 #4
0
 def test_lll_one(self):
     data = [[1, 1, 1], [-1, 0, 2], [3, 5, 6]]
     ans = [[0, 1, 0], [1, 0, 1], [-1, 0, 2]]
     self.assertEqual(cs.lll(data, 0.75), ans)