diff --git a/Makefile b/Makefile index 0900896..0e7f16c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ install: check: $(PYTHON) tests/rundoctest.py + $(PYTHON) tests/unittests/alltest.py dist: chmod go+rX-w -R . diff --git a/tests/unittests/alltest.py b/tests/unittests/alltest.py new file mode 100644 index 0000000..8b423b6 --- /dev/null +++ b/tests/unittests/alltest.py @@ -0,0 +1,86 @@ +""" + alltest.py : Launch unittests modules in ``testmodules`` list. + + Each test module corresponds to a PARI-GP test file that was ported into a gmpy2 unittest. +""" +import unittest +import sys +from cypari2 import Pari, PariError + +pari = Pari() + +testmodules = [ + 'bern', + 'bit', + 'characteristic', + 'charpoly', + 'chinese', + 'contfrac', + 'disc', + 'ellmodulareqn', + 'factorint', + 'galpol', + 'idealappr', + 'isprime', + 'lambert', + 'lex', + 'lindep', + 'linear', + 'list', + 'log', + 'mathnf', + 'minim', + 'minmax', + 'modfun', + 'modular', + 'nfrootsof1', + 'norm', + 'number', + 'pol', + 'prec', + 'prime', + 'primes', + 'qfb', + 'qfbclassno', + 'qfsolve', + 'set', + 'subcyclo', + 'sumdedekind', + 'sumformal', + 'zeta' + ] + +require_galpol = ["galpol"] +require_seadata = ["ellmodulareqn"] + +galpol_installed = True +seadata_installed = True + +# test extensions presence. +try: + pari.ellmodulareqn(2) +except PariError as e: + if "error opening seadata file" in str(e): + seadata_installed = False + else: + raise e + +try: + pari.galoisgetpol(8) +except PariError as e: + if "error opening galpol file" in str(e): + galpol_installed = False + else: + raise e + +suite = unittest.TestSuite() + + +for t in testmodules: + if (galpol_installed or t not in require_galpol) and (seadata_installed or t not in require_seadata): + # Load all the test cases from the module. + suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t)) + +res = unittest.TextTestRunner().run(suite) +retcode = 0 if res.wasSuccessful() else 1 +sys.exit(retcode) diff --git a/tests/unittests/bern.py b/tests/unittests/bern.py new file mode 100644 index 0000000..89b040d --- /dev/null +++ b/tests/unittests/bern.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file bern : +bernfrac(0); +bernfrac(1); +for(k = 1, 20, print(bernfrac(k))); +for(k = 0, 5, print(bernpol(k))); +bernfrac(-1) +bernreal(-1) +bernpol(-1) +bernvec(30) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestBern(unittest.TestCase): + def test_bern(self): + pari.bernfrac(0); + pari.bernfrac(1); + + t = ('-1/2', '1/6', '0', '-1/30', '0', '1/42', '0', '-1/30', '0', '5/66', '0', '-691/2730', + '0', '7/6', '0', '-3617/510', '0', '43867/798', '0', '-174611/330') + for k in range(1, 21): + self.assertEquals(pari.bernfrac(k), t[k-1]) + + t = ('1', 'x - 1/2', 'x^2 - x + 1/6', 'x^3 - 3/2*x^2 + 1/2*x', 'x^4 - 2*x^3 + x^2 - 1/30', + 'x^5 - 5/2*x^4 + 5/3*x^3 - 1/6*x') + for k in range(0, 6): + self.assertEquals(pari.bernpol(k), t[k]) + + with self.assertRaises(PariError) as context: + pari.bernfrac(-1) + self.assertTrue('domain error in bernfrac: index < 0' in str(context.exception)) + + with self.assertRaises(PariError) as context: + pari.bernreal(-1) + self.assertTrue('domain error in bernreal: index < 0' in str(context.exception)) + + with self.assertRaises(PariError) as context: + pari.bernpol(-1) + + self.assertTrue('domain error in bernpol: index < 0' in str(context.exception)) + + def test_bernvec(self): + self.assertEquals(pari.bernvec(30), '[1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510, 43867/798,' + + ' -174611/330, 854513/138, -236364091/2730, 8553103/6, -23749461029/870, 8615841276005/1432' + + '2, -7709321041217/510, 2577687858367/6, -26315271553053477373/1919190, 2929993913841559/6,' + + ' -261082718496449122051/13530, 1520097643918070802691/1806, -27833269579301024235023/690, ' + + '596451111593912163277961/282, -5609403368997817686249127547/46410, 49505720524107964821247' + + '7525/66, -801165718135489957347924991853/1590, 29149963634884862421418123812691/798, -2479' + + '392929313226753685415739663229/870, 84483613348880041862046775994036021/354, -121523314048' + + '3755572040304994079820246041491/56786730]') diff --git a/tests/unittests/bit.py b/tests/unittests/bit.py new file mode 100644 index 0000000..b6bdcde --- /dev/null +++ b/tests/unittests/bit.py @@ -0,0 +1,429 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file bit : +hammingweight(15) +hammingweight(x^100 + 2*x + 1) +hammingweight([Mod(1,2), 2, Mod(0,3)]) +hammingweight(Vecsmall([0,1,2,3])) +hammingweight(matid(100)) +hammingweight(I) +N = 2^128+2^64+1; +[bittest(N, i) | i<-[60..70]] +{ + args = [0, 3, -3, 2^65-1, N, -N, I]; + funs = [bitand, bitnegimply, bitor, bitxor]; + for (a=1,#funs, + my (f = funs[a]); + print("#", f); + for (i=1,#args, + for (j=i,#args, + my(u=args[i], v=args[j]); + print([u,v,iferr(f(u,v),E,E)]) + ) + ) + ); + print("#bitneg"); + for (i=1, #args, + my (u=args[i]); + print(iferr([u, bitneg(u,65),bitneg(u)],E,E)) + ) +} + +bittest(-1,10) +bitneg(-2,64) +bitneg(1,-2) +bitneg(1,128) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestBit(unittest.TestCase): + def iferr(self,f, u, v): + """ + :param f: + :param u: + :param v: + :return: f result with u and v parameter or an error in string + """ + try: + return f(u,v) + except PariError as e: + return str(e) + + + def test_hammingweight(self): + x = pari('x') + self.assertEquals(str(pari.hammingweight(15)), '4') + self.assertEquals(str(pari.hammingweight(x ** 100 + 2 * x + 1)), '3') + self.assertEquals(str(pari.hammingweight([pari.Mod(1, 2), 2, pari.Mod(0, 3)])), '2') + self.assertEquals(str(pari.hammingweight(pari.Vecsmall([0, 1, 2, 3]))), '3') + self.assertEquals(str(pari.hammingweight(pari.matid(100))), '100') + with self.assertRaises(PariError) as context: + pari.hammingweight('I') + self.assertTrue('incorrect type in hammingweight (t_COMPLEX)' in str(context.exception)) + + def test_bit(self): + N = 2 ** 128 + 2 ** 64 + 1; + self.assertEquals(str([pari.bittest(N, i) for i in range(60, 71)]), '[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]') + + res = [['[0, 0, 0]', + '[0, 3, 0]', + '[0, -3, 0]', + '[0, 36893488147419103231, 0]', + '[0, 340282366920938463481821351505477763073, 0]', + '[0, -340282366920938463481821351505477763073, 0]', + '[0, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[3, 3, 3]', + '[3, -3, 1]', + '[3, 36893488147419103231, 3]', + '[3, 340282366920938463481821351505477763073, 1]', + '[3, -340282366920938463481821351505477763073, 3]', + '[3, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[-3, -3, -3]', + '[-3, 36893488147419103231, 36893488147419103229]', + '[-3, 340282366920938463481821351505477763073, 340282366920938463481821351505477763073]', + '[-3, -340282366920938463481821351505477763073, -340282366920938463481821351505477763075]', + '[-3, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[36893488147419103231, 36893488147419103231, 36893488147419103231]', + '[36893488147419103231, 340282366920938463481821351505477763073, 18446744073709551617]', + '[36893488147419103231, -340282366920938463481821351505477763073, 18446744073709551615]', + '[36893488147419103231, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[340282366920938463481821351505477763073, 340282366920938463481821351505477763073, ' + '340282366920938463481821351505477763073]', + '[340282366920938463481821351505477763073, -340282366920938463481821351505477763073, 1]', + '[340282366920938463481821351505477763073, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[-340282366920938463481821351505477763073, -340282366920938463481821351505477763073, ' + '-340282366920938463481821351505477763073]', + '[-340282366920938463481821351505477763073, I, forbidden bitwise and t_INT , t_COMPLEX]', + '[I, I, forbidden bitwise and t_COMPLEX , t_COMPLEX]'], + ['[0, 0, 0]', + '[0, 3, 0]', + '[0, -3, 0]', + '[0, 36893488147419103231, 0]', + '[0, 340282366920938463481821351505477763073, 0]', + '[0, -340282366920938463481821351505477763073, 0]', + '[0, I, forbidden bitwise negated imply t_INT , t_COMPLEX]', + '[3, 3, 0]', + '[3, -3, 2]', + '[3, 36893488147419103231, 0]', + '[3, 340282366920938463481821351505477763073, 2]', + '[3, -340282366920938463481821351505477763073, 0]', + '[3, I, forbidden bitwise negated imply t_INT , t_COMPLEX]', + '[-3, -3, 0]', + '[-3, 36893488147419103231, -36893488147419103232]', + '[-3, 340282366920938463481821351505477763073, -340282366920938463481821351505477763076]', + '[-3, -340282366920938463481821351505477763073, 340282366920938463481821351505477763072]', + '[-3, I, forbidden bitwise negated imply t_INT , t_COMPLEX]', + '[36893488147419103231, 36893488147419103231, 0]', + '[36893488147419103231, 340282366920938463481821351505477763073, 18446744073709551614]', + '[36893488147419103231, -340282366920938463481821351505477763073, 18446744073709551616]', + '[36893488147419103231, I, forbidden bitwise negated imply t_INT , t_COMPLEX]', + '[340282366920938463481821351505477763073, 340282366920938463481821351505477763073, 0]', + '[340282366920938463481821351505477763073, -340282366920938463481821351505477763073, ' + '340282366920938463481821351505477763072]', + '[340282366920938463481821351505477763073, I, forbidden bitwise negated imply t_INT , ' + 't_COMPLEX]', + '[-340282366920938463481821351505477763073, -340282366920938463481821351505477763073, 0]', + '[-340282366920938463481821351505477763073, I, forbidden bitwise negated imply t_INT , ' + 't_COMPLEX]', + '[I, I, forbidden bitwise negated imply t_COMPLEX , t_COMPLEX]'], + ['[0, 0, 0]', + '[0, 3, 3]', + '[0, -3, -3]', + '[0, 36893488147419103231, 36893488147419103231]', + '[0, 340282366920938463481821351505477763073, 340282366920938463481821351505477763073]', + '[0, -340282366920938463481821351505477763073, -340282366920938463481821351505477763073]', + '[0, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[3, 3, 3]', + '[3, -3, -1]', + '[3, 36893488147419103231, 36893488147419103231]', + '[3, 340282366920938463481821351505477763073, 340282366920938463481821351505477763075]', + '[3, -340282366920938463481821351505477763073, -340282366920938463481821351505477763073]', + '[3, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[-3, -3, -3]', + '[-3, 36893488147419103231, -1]', + '[-3, 340282366920938463481821351505477763073, -3]', + '[-3, -340282366920938463481821351505477763073, -1]', + '[-3, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[36893488147419103231, 36893488147419103231, 36893488147419103231]', + '[36893488147419103231, 340282366920938463481821351505477763073, ' + '340282366920938463500268095579187314687]', + '[36893488147419103231, -340282366920938463481821351505477763073, ' + '-340282366920938463463374607431768211457]', + '[36893488147419103231, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[340282366920938463481821351505477763073, 340282366920938463481821351505477763073, ' + '340282366920938463481821351505477763073]', + '[340282366920938463481821351505477763073, -340282366920938463481821351505477763073, -1]', + '[340282366920938463481821351505477763073, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[-340282366920938463481821351505477763073, -340282366920938463481821351505477763073, ' + '-340282366920938463481821351505477763073]', + '[-340282366920938463481821351505477763073, I, forbidden bitwise or t_INT , t_COMPLEX]', + '[I, I, forbidden bitwise or t_COMPLEX , t_COMPLEX]'], + ['[0, 0, 0]', + '[0, 3, 3]', + '[0, -3, -3]', + '[0, 36893488147419103231, 36893488147419103231]', + '[0, 340282366920938463481821351505477763073, 340282366920938463481821351505477763073]', + '[0, -340282366920938463481821351505477763073, -340282366920938463481821351505477763073]', + '[0, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[3, 3, 0]', + '[3, -3, -2]', + '[3, 36893488147419103231, 36893488147419103228]', + '[3, 340282366920938463481821351505477763073, 340282366920938463481821351505477763074]', + '[3, -340282366920938463481821351505477763073, -340282366920938463481821351505477763076]', + '[3, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[-3, -3, 0]', + '[-3, 36893488147419103231, -36893488147419103230]', + '[-3, 340282366920938463481821351505477763073, -340282366920938463481821351505477763076]', + '[-3, -340282366920938463481821351505477763073, 340282366920938463481821351505477763074]', + '[-3, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[36893488147419103231, 36893488147419103231, 0]', + '[36893488147419103231, 340282366920938463481821351505477763073, ' + '340282366920938463481821351505477763070]', + '[36893488147419103231, -340282366920938463481821351505477763073, ' + '-340282366920938463481821351505477763072]', + '[36893488147419103231, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[340282366920938463481821351505477763073, 340282366920938463481821351505477763073, 0]', + '[340282366920938463481821351505477763073, -340282366920938463481821351505477763073, -2]', + '[340282366920938463481821351505477763073, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[-340282366920938463481821351505477763073, -340282366920938463481821351505477763073, 0]', + '[-340282366920938463481821351505477763073, I, forbidden bitwise xor t_INT , t_COMPLEX]', + '[I, I, forbidden bitwise xor t_COMPLEX , t_COMPLEX]']] + + args = [0, 3, -3, 2 ** 65 - 1, N, -N, pari('I')]; + funs = [pari.bitand, pari.bitnegimply, pari.bitor, pari.bitxor]; + + for a in range(0, len(funs)): + f = funs[a]; + k = 0 + for i in range(0, len(args)): + for j in range(i, len(args)): + u = args[i] + v = args[j] + self.assertEquals("[%s, %s, %s]" % (u, v, self.iferr(f, u, v)), res[a][k]) + k += 1 + + pari.bittest(-1,10) + + def test_bitneg(self): + + def iferrbn(u): + try: + return '[%s, %s, %s]' % (u, pari.bitneg(u, 65), pari.bitneg(u)) + except PariError as e: + return str(e) + N = 2 ** 128 + 2 ** 64 + 1; + args = [0, 3, -3, 2 ** 65 - 1, N, -N, pari('I')]; + + res = ['[0, 36893488147419103231, -1]', + '[3, 36893488147419103228, -4]', + '[-3, 2, 2]', + '[36893488147419103231, 0, -36893488147419103232]', + '[340282366920938463481821351505477763073, 18446744073709551614, ' + '-340282366920938463481821351505477763074]', + '[-340282366920938463481821351505477763073, 18446744073709551616, 34028236692093846348182135150547776' + '3072]', + 'incorrect type in bitwise negation (t_COMPLEX)'] + + for i in range(0, len(args)): + u = args[i] + self.assertEquals(str(iferrbn(u)), res[i]) + + self.assertEquals(pari.bitneg(-2, 64), '1') + with self.assertRaises(PariError) as context: + pari.bitneg(1, -2) + self.assertTrue('domain error in bitwise negation: exponent < -1' in str(context.exception)) + self.assertEquals(pari.bitneg(1, 128), '340282366920938463463374607431768211454') + +"""**** Original expected results **** + +4 +3 +2 +3 +100 + *** at top-level: hammingweight(I) + *** ^---------------- + *** hammingweight: incorrect type in hammingweight (t_COMPLEX). +[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0] +#bitand +[0, 0, 0] +[0, 3, 0] +[0, -3, 0] +[0, 36893488147419103231, 0] +[0, 340282366920938463481821351505477763073, 0] +[0, -340282366920938463481821351505477763073, 0] +[0, I, error("forbidden bitwise and t_INT , t_COMPLEX.")] +[3, 3, 3] +[3, -3, 1] +[3, 36893488147419103231, 3] +[3, 340282366920938463481821351505477763073, 1] +[3, -340282366920938463481821351505477763073, 3] +[3, I, error("forbidden bitwise and t_INT , t_COMPLEX.")] +[-3, -3, -3] +[-3, 36893488147419103231, 36893488147419103229] +[-3, 340282366920938463481821351505477763073, 340282366920938463481821351505 +477763073] +[-3, -340282366920938463481821351505477763073, -3402823669209384634818213515 +05477763075] +[-3, I, error("forbidden bitwise and t_INT , t_COMPLEX.")] +[36893488147419103231, 36893488147419103231, 36893488147419103231] +[36893488147419103231, 340282366920938463481821351505477763073, 184467440737 +09551617] +[36893488147419103231, -340282366920938463481821351505477763073, 18446744073 +709551615] +[36893488147419103231, I, error("forbidden bitwise and t_INT , t_COMPLEX.")] +[340282366920938463481821351505477763073, 3402823669209384634818213515054777 +63073, 340282366920938463481821351505477763073] +[340282366920938463481821351505477763073, -340282366920938463481821351505477 +763073, 1] +[340282366920938463481821351505477763073, I, error("forbidden bitwise and t_ +INT , t_COMPLEX.")] +[-340282366920938463481821351505477763073, -34028236692093846348182135150547 +7763073, -340282366920938463481821351505477763073] +[-340282366920938463481821351505477763073, I, error("forbidden bitwise and t +_INT , t_COMPLEX.")] +[I, I, error("forbidden bitwise and t_COMPLEX , t_COMPLEX.")] +#bitnegimply +[0, 0, 0] +[0, 3, 0] +[0, -3, 0] +[0, 36893488147419103231, 0] +[0, 340282366920938463481821351505477763073, 0] +[0, -340282366920938463481821351505477763073, 0] +[0, I, error("forbidden bitwise negated imply t_INT , t_COMPLEX.")] +[3, 3, 0] +[3, -3, 2] +[3, 36893488147419103231, 0] +[3, 340282366920938463481821351505477763073, 2] +[3, -340282366920938463481821351505477763073, 0] +[3, I, error("forbidden bitwise negated imply t_INT , t_COMPLEX.")] +[-3, -3, 0] +[-3, 36893488147419103231, -36893488147419103232] +[-3, 340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763076] +[-3, -340282366920938463481821351505477763073, 34028236692093846348182135150 +5477763072] +[-3, I, error("forbidden bitwise negated imply t_INT , t_COMPLEX.")] +[36893488147419103231, 36893488147419103231, 0] +[36893488147419103231, 340282366920938463481821351505477763073, 184467440737 +09551614] +[36893488147419103231, -340282366920938463481821351505477763073, 18446744073 +709551616] +[36893488147419103231, I, error("forbidden bitwise negated imply t_INT , t_C +OMPLEX.")] +[340282366920938463481821351505477763073, 3402823669209384634818213515054777 +63073, 0] +[340282366920938463481821351505477763073, -340282366920938463481821351505477 +763073, 340282366920938463481821351505477763072] +[340282366920938463481821351505477763073, I, error("forbidden bitwise negate +d imply t_INT , t_COMPLEX.")] +[-340282366920938463481821351505477763073, -34028236692093846348182135150547 +7763073, 0] +[-340282366920938463481821351505477763073, I, error("forbidden bitwise negat +ed imply t_INT , t_COMPLEX.")] +[I, I, error("forbidden bitwise negated imply t_COMPLEX , t_COMPLEX.")] +#bitor +[0, 0, 0] +[0, 3, 3] +[0, -3, -3] +[0, 36893488147419103231, 36893488147419103231] +[0, 340282366920938463481821351505477763073, 3402823669209384634818213515054 +77763073] +[0, -340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763073] +[0, I, error("forbidden bitwise or t_INT , t_COMPLEX.")] +[3, 3, 3] +[3, -3, -1] +[3, 36893488147419103231, 36893488147419103231] +[3, 340282366920938463481821351505477763073, 3402823669209384634818213515054 +77763075] +[3, -340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763073] +[3, I, error("forbidden bitwise or t_INT , t_COMPLEX.")] +[-3, -3, -3] +[-3, 36893488147419103231, -1] +[-3, 340282366920938463481821351505477763073, -3] +[-3, -340282366920938463481821351505477763073, -1] +[-3, I, error("forbidden bitwise or t_INT , t_COMPLEX.")] +[36893488147419103231, 36893488147419103231, 36893488147419103231] +[36893488147419103231, 340282366920938463481821351505477763073, 340282366920 +938463500268095579187314687] +[36893488147419103231, -340282366920938463481821351505477763073, -3402823669 +20938463463374607431768211457] +[36893488147419103231, I, error("forbidden bitwise or t_INT , t_COMPLEX.")] +[340282366920938463481821351505477763073, 3402823669209384634818213515054777 +63073, 340282366920938463481821351505477763073] +[340282366920938463481821351505477763073, -340282366920938463481821351505477 +763073, -1] +[340282366920938463481821351505477763073, I, error("forbidden bitwise or t_I +NT , t_COMPLEX.")] +[-340282366920938463481821351505477763073, -34028236692093846348182135150547 +7763073, -340282366920938463481821351505477763073] +[-340282366920938463481821351505477763073, I, error("forbidden bitwise or t_ +INT , t_COMPLEX.")] +[I, I, error("forbidden bitwise or t_COMPLEX , t_COMPLEX.")] +#bitxor +[0, 0, 0] +[0, 3, 3] +[0, -3, -3] +[0, 36893488147419103231, 36893488147419103231] +[0, 340282366920938463481821351505477763073, 3402823669209384634818213515054 +77763073] +[0, -340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763073] +[0, I, error("forbidden bitwise xor t_INT , t_COMPLEX.")] +[3, 3, 0] +[3, -3, -2] +[3, 36893488147419103231, 36893488147419103228] +[3, 340282366920938463481821351505477763073, 3402823669209384634818213515054 +77763074] +[3, -340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763076] +[3, I, error("forbidden bitwise xor t_INT , t_COMPLEX.")] +[-3, -3, 0] +[-3, 36893488147419103231, -36893488147419103230] +[-3, 340282366920938463481821351505477763073, -34028236692093846348182135150 +5477763076] +[-3, -340282366920938463481821351505477763073, 34028236692093846348182135150 +5477763074] +[-3, I, error("forbidden bitwise xor t_INT , t_COMPLEX.")] +[36893488147419103231, 36893488147419103231, 0] +[36893488147419103231, 340282366920938463481821351505477763073, 340282366920 +938463481821351505477763070] +[36893488147419103231, -340282366920938463481821351505477763073, -3402823669 +20938463481821351505477763072] +[36893488147419103231, I, error("forbidden bitwise xor t_INT , t_COMPLEX.")] +[340282366920938463481821351505477763073, 3402823669209384634818213515054777 +63073, 0] +[340282366920938463481821351505477763073, -340282366920938463481821351505477 +763073, -2] +[340282366920938463481821351505477763073, I, error("forbidden bitwise xor t_ +INT , t_COMPLEX.")] +[-340282366920938463481821351505477763073, -34028236692093846348182135150547 +7763073, 0] +[-340282366920938463481821351505477763073, I, error("forbidden bitwise xor t +_INT , t_COMPLEX.")] +[I, I, error("forbidden bitwise xor t_COMPLEX , t_COMPLEX.")] +#bitneg +[0, 36893488147419103231, -1] +[3, 36893488147419103228, -4] +[-3, 2, 2] +[36893488147419103231, 0, -36893488147419103232] +[340282366920938463481821351505477763073, 18446744073709551614, -34028236692 +0938463481821351505477763074] +[-340282366920938463481821351505477763073, 18446744073709551616, 34028236692 +0938463481821351505477763072] +error("incorrect type in bitwise negation (t_COMPLEX).") +1 +1 + *** at top-level: bitneg(1,-2) + *** ^------------ + *** bitneg: domain error in bitwise negation: exponent < -1 +340282366920938463463374607431768211454 + +""" diff --git a/tests/unittests/characteristic.py b/tests/unittests/characteristic.py new file mode 100644 index 0000000..3ee1415 --- /dev/null +++ b/tests/unittests/characteristic.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file characteristic : +v=[1,1.,Mod(1,6),1/2,I+Mod(1,3), O(2), quadgen(5)*Mod(1,3), Mod(1,x)]; +for (i=1,#v, print(characteristic(v[i]))) +characteristic(v) +characteristic(matid(2)*Mod(1,2)) +characteristic([]) +characteristic(List()) +characteristic(ffgen(2^3)) +characteristic([ffgen(2),ffgen(3)]) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestCharacteristic(unittest.TestCase): + def test_characteristic(self): + v = [1, '1.', pari.Mod(1, 6), '1/2', 'I' + pari.Mod(1, 3), 'O(2)', pari.quadgen(5) * pari.Mod(1, 3), + pari.Mod(1, 'x')] + d = ['0', '0', '6', '0', '3', '0', '3', '0'] + for i in range(0,len(v)): + self.assertEquals(str(pari.characteristic(v[i])), d[i]) + self.assertEquals(str(pari.characteristic(v)), '3') + self.assertEquals(str(pari.characteristic(pari.matid(2)*pari.Mod(1,2))), '2') + self.assertEquals(str(pari.characteristic([])), '0') + self.assertEquals(str(pari.characteristic(pari.List())), '0') + self.assertEquals(str(pari.characteristic(pari.ffgen('2^3'))), '2') + with self.assertRaises(PariError) as context: + pari.characteristic([pari.ffgen(2), pari.ffgen(3)]) + self.assertTrue('inconsistent moduli in characteristic: 2 != 3' in str(context.exception)) + +"""**** Original expected results **** + +0 +0 +6 +0 +3 +0 +3 +0 +3 +2 +0 +0 +2 + *** at top-level: characteristic([ffge + *** ^-------------------- + *** characteristic: inconsistent moduli in characteristic: 2 != 3 + +""" diff --git a/tests/unittests/charpoly.py b/tests/unittests/charpoly.py new file mode 100644 index 0000000..4bddac8 --- /dev/null +++ b/tests/unittests/charpoly.py @@ -0,0 +1,223 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file charpoly : +charpoly([x,x+1;1,2],y,0) +charpoly([x,x+1;1,2],y,1) +charpoly([x,x+1;1,2],y,2) +charpoly([x,x+1;1,2],y,3) +charpoly([0,0,2,2;0,0,2,2;2,2,0,0;2,2,0,0]) +charpoly([0,0,2,2;0,0,2,2;2,2,0,0;2,2,0,0],,4) +minpoly(matrix(4,4,i,j,i/j)) + +default(realprecision,38); +A=[5/3,7/45;0,21/10]; +mateigen(A) +mateigen(A*1.) +mateigen(A,1) +M=[x,x+y;x+1,1];charpoly(M,w) +v=[1,1.,Mod(1,3),1/2,1+O(3),I,quadgen(5),matid(2)*Mod(1,3),matid(2)*Mod(1,2^64+13)]; +for(i=1,#v,print(charpoly(v[i]))) +charpoly(matid(4),,0) +charpoly(matid(4),,3) +charpoly(matid(4)*(2^64+13)) +m=[1,2,3,4;5,6,7,8;9,10,11,12;1,5,7,11]; +charpoly(m*Mod(1,3)) +charpoly(m*Mod(1,2^64+13)) +matadjoint(matid(2),1) +matadjoint([;]) +matadjoint(Mat(1)) +matadjoint([x,0,0;0,0,0;0,0,0]) +matadjoint([Mod(1,2)*x,0,0;0,0,0;0,0,0]) +charpoly(x*matid(3)) +minpoly(Mod(x+1,x^4+1)) +minpoly(Mod(x,x^2)) +minpoly(Mod(1,x^2+x+1)) +minpoly(Mod(1,x^24+1)) + +a=[1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;-1,-1,-1,4,0,0,0,0,-1,0,0,0,0,0,0,0,0;0,0,0,0,1,0,0,-1,0,0,0,0,0,0,0,0,0;0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0;0,0,0,0,-1,-1,-1,4,-1,0,0,0,0,0,0,0,0;0,0,0,-1,0,0,0,-1,4,-1,-1,0,0,0,0,0,0;0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0,0,0;0,0,0,0,0,0,0,0,-1,0,4,-1,-1,-1,0,0,0;0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0;0,0,0,0,0,0,0,0,0,0,-1,0,1,0,0,0,0;0,0,0,0,0,0,0,0,0,0,-1,0,0,3,-1,0,-1;0,0,0,0,0,0,0,0,0,0,0,0,0,-1,3,-2,0;0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,2,0;0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,1]; +mateigen(a); +mateigen([;]) +mateigen([;],1) +mateigen(Mat(1)) +mateigen(Mat(1),1) + +\\ Errors, keep at end of file +charpoly(Mod('b, 'b^2 + Mod('a,'a^2+1)), 'newvar) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestCharpoly(unittest.TestCase): + def setUp(self): + pari.set_real_precision(38) + + def tearDown(self): + pari.set_real_precision(15) + + def test_charpoly(self): + x = pari('x') + y = pari('y') + self.assertEquals(pari.charpoly('[x,x+1;1,2]', y, 0), '(-y + 1)*x + (y^2 - 2*y - 1)') + self.assertEquals(pari.charpoly('[x,x+1;1,2]', y, 1), '(-y + 1)*x + (y^2 - 2*y - 1)') + self.assertEquals(pari.charpoly('[x,x+1;1,2]', y, 2), '(-y + 1)*x + (y^2 - 2*y - 1)') + self.assertEquals(pari.charpoly('[x,x+1;1,2]', y, 3), '(-y + 1)*x + (y^2 - 2*y - 1)') + self.assertEquals(pari.charpoly('[0,0,2,2;0,0,2,2;2,2,0,0;2,2,0,0]'), 'x^4 - 16*x^2') + self.assertEquals(pari.charpoly('[0,0,2,2;0,0,2,2;2,2,0,0;2,2,0,0]', None, 4), 'x^4 - 16*x^2') + + M = '[x,x+y;x+1,1]'; + self.assertEquals(pari.charpoly(M, pari('w')), '-x^2 + (-y - w)*x + (-y + (w^2 - w))') + v = [1, pari('1.'), pari.Mod(1, 3), '1/2', '1+O(3)', 'I', + pari.quadgen(5), pari.matid(2) * pari.Mod(1, 3), + pari.matid(2) * pari.Mod(1, 2 ** 64 + 13)]; + + res = ['x - 1', + 'x - 1.0000000000000000000000000000000000000', + 'x + Mod(2, 3)', + 'x - 1/2', + 'x + (2 + O(3))', + 'x^2 + 1', + 'x^2 - x - 1', + 'Mod(1, 3)*x^2 + Mod(1, 3)*x + Mod(1, 3)', + 'Mod(1, 18446744073709551629)*x^2 + Mod(18446744073709551627, 18446744073709551629)*x + Mod(1, ' + '18446744073709551629)'] + + for i in range(0, len(v)): + self.assertEquals(pari.charpoly(v[i]), res[i]) + self.assertEquals(pari.charpoly(pari.matid(4), None, 0), 'x^4 - 4*x^3 + 6*x^2 - 4*x + 1') + self.assertEquals(pari.charpoly(pari.matid(4), None, 3), 'x^4 - 4*x^3 + 6*x^2 - 4*x + 1') + self.assertEquals(pari.charpoly(pari.matid(4) * (2 ** 64 + 13)), + 'x^4 - 73786976294838206516*x^3 + 2041694201525630783657939720089299321846*x^2 - ' + '25108406941546723108427206932497066002105857518694949724756*x + ' + '115792089237316195749980275248795307917777354730270819790751905975615430356881' + ) + m = pari('[1,2,3,4;5,6,7,8;9,10,11,12;1,5,7,11]'); + self.assertEquals(pari.charpoly(m * pari.Mod(1, 3)), + 'Mod(1, 3)*x^4 + Mod(1, 3)*x^3 + Mod(1, 3)*x^2 + Mod(1, 3)*x') + self.assertEquals(pari.charpoly(m * pari.Mod(1, 2 ** 64 + 13)), + 'Mod(1, 18446744073709551629)*x^4 + Mod(18446744073709551600, 18446744073709551629)*x^3 + ' + 'Mod(46, 18446744073709551629)*x^2 + Mod(16, 18446744073709551629)*x') + with self.assertRaises(PariError) as context: + pari.charpoly(x * pari.matid(3)) + self.assertTrue('incorrect priority in charpoly: variable x = x' in str(context.exception)) + + def test_matadjoint(self): + self.assertEquals(pari.matadjoint(pari.matid(2), 1), '[1, 0; 0, 1]') + self.assertEquals(pari.matadjoint('[;]'), '[;]') + self.assertEquals(pari.matadjoint(pari.Mat(1)), 'Mat(1)') + self.assertEquals(pari.matadjoint('[x,0,0;0,0,0;0,0,0]'), '[0, 0, 0; 0, 0, 0; 0, 0, 0]') + self.assertEquals(pari.matadjoint('[Mod(1,2)*x,0,0;0,0,0;0,0,0]'), + '[Mod(0, 2), Mod(0, 2), Mod(0, 2); Mod(0, 2), Mod(0, 2), Mod(0, 2)' + '; Mod(0, 2), Mod(0, 2), Mod(0, 2)]') + + def test_minpoly(self): + x = pari('x') + self.assertEquals(pari.minpoly(pari.Mod(x + 1, x ** 4 + 1)), 'x^4 - 4*x^3 + 6*x^2 - 4*x + 2') + self.assertEquals(pari.minpoly(pari.Mod(x, x ** 2)), 'x^2') + self.assertEquals(pari.minpoly(pari.Mod(1, x ** 2 + x + 1)), 'x - 1') + self.assertEquals(pari.minpoly(pari.Mod(1, x ** 24 + 1)), 'x - 1') + + def test_mateigen(self): + A = '[5/3,7/45;0,21/10]'; + self.assertEquals(pari.mateigen(A), '[1, 14/39; 0, 1]') + self.assertEquals(str(pari.mateigen(A * pari('1.'), precision=128)), + '[1, 0.35897435897435897435897435897435897438; 0, 1]') + self.assertEquals(pari.mateigen(A, 1), '[[5/3, 21/10], [1, 14/39; 0, 1]]') + + a = ('[1,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;0,1,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0;0,0,1,-1,0,0,0,0,' + '0,0,0,0,0,0,0,0,0;-1,-1,-1,4,0,0,0,0,-1,0,0,0,0,0,0,0,0;0,0,0,0,1,0,0,-1,0,0,0,0,0,0,0,0' + ',0;0,0,0,0,0,1,0,-1,0,0,0,0,0,0,0,0,0;0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0;0,0,0,0,-1,-1,-' + '1,4,-1,0,0,0,0,0,0,0,0;0,0,0,-1,0,0,0,-1,4,-1,-1,0,0,0,0,0,0;0,0,0,0,0,0,0,0,-1,1,0,0,0,' + '0,0,0,0;0,0,0,0,0,0,0,0,-1,0,4,-1,-1,-1,0,0,0;0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,0;0,0,0,0' + ',0,0,0,0,0,0,-1,0,1,0,0,0,0;0,0,0,0,0,0,0,0,0,0,-1,0,0,3,-1,0,-1;0,0,0,0,0,0,0,0,0,0,0,0' + ',0,-1,3,-2,0;0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,2,0;0,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,1]') + + pari.mateigen(a, precision=128) + self.assertEquals(pari.mateigen('[;]', precision=128), '[]') + self.assertEquals(pari.mateigen('[;]', 1, precision=128), '[[], [;]]') + self.assertEquals(pari.mateigen(pari.Mat(1), precision=128), 'Mat(1)') + self.assertEquals(pari.mateigen(pari.Mat(1), 1, precision=128), '[[1], Mat(1)]') +"""**** Original expected results **** + +(-y + 1)*x + (y^2 - 2*y - 1) +(-y + 1)*x + (y^2 - 2*y - 1) +(-y + 1)*x + (y^2 - 2*y - 1) +(-y + 1)*x + (y^2 - 2*y - 1) +x^4 - 16*x^2 +x^4 - 16*x^2 +x^2 - 4*x + +[1 14/39] + +[0 1] + + +[1 0.35897435897435897435897435897435897438] + +[0 1] + +[[5/3, 21/10], [1, 14/39; 0, 1]] +-x^2 + (-y - w)*x + (-y + (w^2 - w)) +x - 1 +x - 1.0000000000000000000000000000000000000 +x + Mod(2, 3) +x - 1/2 +x + (2 + O(3)) +x^2 + 1 +x^2 - x - 1 +Mod(1, 3)*x^2 + Mod(1, 3)*x + Mod(1, 3) +Mod(1, 18446744073709551629)*x^2 + Mod(18446744073709551627, 184467440737095 +51629)*x + Mod(1, 18446744073709551629) +x^4 - 4*x^3 + 6*x^2 - 4*x + 1 +x^4 - 4*x^3 + 6*x^2 - 4*x + 1 +x^4 - 73786976294838206516*x^3 + 2041694201525630783657939720089299321846*x^ +2 - 25108406941546723108427206932497066002105857518694949724756*x + 11579208 +9237316195749980275248795307917777354730270819790751905975615430356881 +Mod(1, 3)*x^4 + Mod(1, 3)*x^3 + Mod(1, 3)*x^2 + Mod(1, 3)*x +Mod(1, 18446744073709551629)*x^4 + Mod(18446744073709551600, 184467440737095 +51629)*x^3 + Mod(46, 18446744073709551629)*x^2 + Mod(16, 1844674407370955162 +9)*x + +[1 0] + +[0 1] + +[;] + +[1] + + +[0 0 0] + +[0 0 0] + +[0 0 0] + + +[Mod(0, 2) Mod(0, 2) Mod(0, 2)] + +[Mod(0, 2) Mod(0, 2) Mod(0, 2)] + +[Mod(0, 2) Mod(0, 2) Mod(0, 2)] + + *** at top-level: charpoly(x*matid(3)) + *** ^-------------------- + *** charpoly: incorrect priority in charpoly: variable x = x +x^4 - 4*x^3 + 6*x^2 - 4*x + 2 +x^2 +x - 1 +x - 1 +[] +[[], [;]] + +[1] + +[[1], Mat(1)] + *** at top-level: charpoly(Mod('b,'b^2 + *** ^-------------------- + *** charpoly: incorrect priority in RgXQ_charpoly: variable newvar < a + +""" diff --git a/tests/unittests/chinese.py b/tests/unittests/chinese.py new file mode 100644 index 0000000..01dbd78 --- /dev/null +++ b/tests/unittests/chinese.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file chinese : +chinese(Mod(x,x^2+1),Mod(x,x^2+1)) +chinese(Mod(x,x^2+1),Mod(x,x^2-1)) +chinese(Mod(1,2)*x+Mod(1,2), Mod(2,3)*x^2+Mod(1,3)*x+Mod(1,3)) +chinese([Mod(1,2),Mod(1,3)], [Mod(1,4),Mod(1,2)]) +chinese(1) +chinese([]) +chinese(Mod(1+x,x^2),Mod(0,1)) +chinese(Mod(1+x,x^2),Mod(1,2)) +chinese(Mod(0,1),Mod(1+x,x^2)) + +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestChinese(unittest.TestCase): + def test_chinese(self): + self.assertEquals(pari.chinese(pari.Mod('x', 'x^2+1'), pari.Mod('x', 'x^2+1')), 'Mod(x, x^2 + 1)') + self.assertEquals(pari.chinese(pari.Mod('x', 'x^2+1'), pari.Mod('x', 'x^2-1')), 'Mod(x, x^4 - 1)') + self.assertEquals(str(pari.chinese(pari.Mod(1, 2) * 'x' + pari.Mod(1, 2), + pari.Mod(2, 3) * 'x^2' + pari.Mod(1, 3) * 'x' + pari.Mod(1, 3))), + 'Mod(2, 3)*x^2 + Mod(1, 6)*x + Mod(1, 6)') + self.assertEquals(pari.chinese([pari.Mod(1, 2), pari.Mod(1, 3)], [pari.Mod(1, 4), pari.Mod(1, 2)]), + '[Mod(1, 4), Mod(1, 6)]') + with self.assertRaises(PariError) as context: + pari.chinese(1) + self.assertTrue('incorrect type in association (t_INT)' in str(context.exception)) + self.assertEquals(pari.chinese([]), 'Mod(0, 1)') + self.assertEquals(pari.chinese(pari.Mod('1+x', 'x^2'), pari.Mod(0, 1)), 'Mod(x + 1, x^2)') + self.assertEquals(pari.chinese(pari.Mod('1+x', 'x^2'), pari.Mod(1, 2)), 'Mod(x + 1, 2*x^2)') + self.assertEquals(pari.chinese(pari.Mod(0, 1), pari.Mod('1+x', 'x^2')), 'Mod(x + 1, x^2)') + + +"""**** Original expected results **** + +Mod(x, x^2 + 1) +Mod(x, x^4 - 1) +Mod(2, 3)*x^2 + Mod(1, 6)*x + Mod(1, 6) +[Mod(1, 4), Mod(1, 6)] + *** at top-level: chinese(1) + *** ^---------- + *** chinese: incorrect type in association (t_INT). +Mod(0, 1) +Mod(x + 1, x^2) +Mod(x + 1, 2*x^2) +Mod(x + 1, x^2) + +""" diff --git a/tests/unittests/contfrac.py b/tests/unittests/contfrac.py new file mode 100644 index 0000000..bf767e3 --- /dev/null +++ b/tests/unittests/contfrac.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file contfrac : +contfrac(1,[],-1) +contfracpnqn(Vecsmall([])) +contfracpnqn([]) +contfracpnqn([],0) +contfracpnqn([],1) +contfracpnqn([2]) +contfracpnqn([2],0) +contfracpnqn([2],1) +v=[1,2,3]; +contfracpnqn(v) +contfracpnqn(v,0) +contfracpnqn(v,1) +contfracpnqn(v,2) +v=[1,2,3;4,5,6]; +contfracpnqn(v) +contfracpnqn(v,0) +contfracpnqn(v,1) +contfracpnqn(v,2) +s=exp(x); +contfracinit(s,0) +contfracinit(s,1) +contfracinit(s,2) +e=contfracinit([]) +contfraceval(e,1) +e=contfracinit(s) +contfraceval(e,1,10) +contfraceval(e,1, 8) +contfraceval(e,1, 6) +contfraceval(e,1) +contfracinit([1,2,3]) +contfracinit(Pol(0)) +contfracinit(1); +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestContfrac(unittest.TestCase): + def test_contfrac(self): + with self.assertRaises(PariError) as context: + pari.contfrac(1, '[]', -1) + self.assertTrue('domain error in contfrac: nmax < 0' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.contfracpnqn(pari.Vecsmall('[]')) + self.assertTrue('incorrect type in pnqn (t_VECSMALL)' in str(context.exception)) + self.assertEqual(pari.contfracpnqn('[]'), '[1, 0; 0, 1]') + self.assertEqual(pari.contfracpnqn('[]', 0), '[;]') + self.assertEqual(pari.contfracpnqn('[]', 1), '[;]') + self.assertEqual(pari.contfracpnqn([2]), '[2, 1; 1, 0]') + self.assertEqual(pari.contfracpnqn([2], 0), '[2; 1]') + self.assertEqual(pari.contfracpnqn([2], 1), '[2; 1]') + + v = [1, 2, 3]; + self.assertEqual(pari.contfracpnqn(v), '[10, 3; 7, 2]') + self.assertEqual(pari.contfracpnqn(v, 0), '[1; 1]') + self.assertEqual(pari.contfracpnqn(v, 1), '[1, 3; 1, 2]') + self.assertEqual(pari.contfracpnqn(v, 2), '[1, 3, 10; 1, 2, 7]') + + v = '[1,2,3;4,5,6]'; + self.assertEqual(pari.contfracpnqn(v), '[144, 22; 33, 5]') + self.assertEqual(pari.contfracpnqn(v, 0), '[4; 1]') + self.assertEqual(pari.contfracpnqn(v, 1), '[4, 22; 1, 5]') + self.assertEqual(pari.contfracpnqn(v, 2), '[4, 22, 144; 1, 5, 33]') + + s = pari.exp('x'); + self.assertEqual(pari.contfracinit(s, 0), '[[], []]') + self.assertEqual(pari.contfracinit(s, 1), '[[-1], []]') + self.assertEqual(pari.contfracinit(s, 2), '[[-1], [1/2]]') + + e = pari.contfracinit('[]') + self.assertEqual(pari.contfraceval(e, 1), '[[], []]') + + e = pari.contfracinit(s) + self.assertEquals(e, '[[-1, 1/3, 1/15, 1/35, 1/63, 1/99, 1/143, 1/195], [1/2, 1/36, 1/100, 1/196, ' + + '1/324, 1/484, 1/676, 1/900]]') + + with self.assertRaises(PariError) as context: + pari.contfraceval(e, 1, 10) + self.assertTrue('non-existent component in contfraceval: index > 8' in str(context.exception)) + self.assertEqual(pari.contfraceval(e, 1, 8), '410105312/150869313') + self.assertEqual(pari.contfraceval(e, 1, 6), '517656/190435') + self.assertEqual(pari.contfraceval(e, 1), '410105312/150869313') + self.assertEquals(pari.contfracinit([1, 2, 3]), '[[-2], [1]]') + self.assertEqual(pari.contfracinit(pari.Pol(0)), '[[], []]') + with self.assertRaises(PariError) as context: + pari.contfracinit(1); + self.assertTrue('incorrect type in contfracinit (t_INT)' in str(context.exception)) + +"""**** Original expected results **** + *** at top-level: contfrac(1,[],-1) + *** ^----------------- + *** contfrac: domain error in contfrac: nmax < 0 + *** at top-level: contfracpnqn(Vecsmal + *** ^-------------------- + *** contfracpnqn: incorrect type in pnqn (t_VECSMALL). +[1 0] +[0 1] +[;] +[;] +[2 1] +[1 0] +[2] +[1] +[2] +[1] +[10 3] +[ 7 2] +[1] +[1] +[1 3] +[1 2] +[1 3 10] +[1 2 7] +[144 22] +[ 33 5] +[4] +[1] +[4 22] +[1 5] +[4 22 144] +[1 5 33] +[[], []] +[[-1], []] +[[-1], [1/2]] +[[], []] +0 +[[-1, 1/3, 1/15, 1/35, 1/63, 1/99, 1/143, 1/195], [1/2, 1/36, 1/100, 1/196, +1/324, 1/484, 1/676, 1/900]] + *** at top-level: contfraceval(e,1,10) + *** ^-------------------- + *** contfraceval: non-existent component in contfraceval: index > 8 +410105312/150869313 +517656/190435 +410105312/150869313 +[[-2], [1]] +[[], []] + *** at top-level: contfracinit(1) + *** ^--------------- + *** contfracinit: incorrect type in contfracinit (t_INT). +""" diff --git a/tests/unittests/disc.py b/tests/unittests/disc.py new file mode 100644 index 0000000..26bce58 --- /dev/null +++ b/tests/unittests/disc.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file disc : +poldisc(Mod(1, 2)*x) +poldisc(Mod(1, 3)*(2*x^3+x^2+5)) +poldisc(Mod(1, 3)*(2*x^3+x+5)) +poldisc((a*x^3+b*x^2+c*x+d)) +poldisc((a*x^3+b*x^2+c*x+d)*Mod(1,3)) +poldisc((a*x^3+c*x+d)*Mod(1,3)) + +\\ #1830 +p=Pol([1,12,-41,-1046,-1152,39768,128414,-829340,-4525890,8899442,94079590,4385944,-1307089619,-1852433280,12494993027,34801502551,-77942248052,-390957423498,215189990152,3107265788332,1420485007463,-18347443916369,-23277245912959,80992666070621,174175172136656,-256947893746801,-907981487991468,484717098540915,3624070471203629,223320207786810,-11495832122433637,-5970240860086125,29459554866159718,27626780885543732,-61174934576020682,-85453537075841594,101601090502467492,205071787088061635,-128623032844198712,-402298722797595630,103257810302253206,661593554032027685,13023738437946757,-924770373478411117,-228669477020600489,1106930103187315214,501417832370076217,-1137744012688843614,-748484700066174875,1002096690610670198,887074929263872304,-749681502970099140,-878282874862417133,466192451440777121,743397334132464078,-228293327650766293,-544343133811559511,73246386276267014,346915388490966115,2655042441806609,-192876875700267550,-25542640982995001,93481097097188652,23309890824202258,-39341812220193672,-14459562353785875,14260775252163516,7110363380474628,-4385795657650451,-2904911553101253,1111356927314961,1003888928894249,-216866559082696,-295159994592569,25722943511905,73725762974324,1493634668853,-15527611742629,-1817577645774,2717078090720,579368368367,-384681131682,-124276266074,41834786710,20049074850,-3059594663,-2480136051,67764972,231104576,16656470,-15345258,-2573079,629755,190125,-7992,-7579,-537,116,21,1]); +poldisc(p) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestDisc(unittest.TestCase): + def test_disc(self): + self.assertEquals(pari.poldisc(pari.Mod(1, 2)*'x'), 'Mod(1, 2)') + self.assertEquals(pari.poldisc(pari.Mod(1, 3)*'(2*x^3+x^2+5)'), 'Mod(1, 3)') + self.assertEquals(pari.poldisc(pari.Mod(1, 3)*'(2*x^3+x+5)'), 'Mod(1, 3)') + self.assertEquals(pari.poldisc('(a*x^3+b*x^2+c*x+d)'), + '-27*d^2*a^2 + (18*d*c*b - 4*c^3)*a + (-4*d*b^3 + c^2*b^2)') + self.assertEquals(pari.poldisc('(a*x^3+b*x^2+c*x+d)' * pari.Mod(1, 3)), + 'Mod(2, 3)*c^3*a + (Mod(2, 3)*d*b^3 + Mod(1, 3)*c^2*b^2)') + self.assertEquals(pari.poldisc('(a*x^3+c*x+d)'*pari.Mod(1,3)), 'Mod(2, 3)*c^3*a') + + p = pari.Pol( + [1, 12, -41, -1046, -1152, 39768, 128414, -829340, -4525890, 8899442, 94079590, 4385944, -1307089619, + -1852433280, 12494993027, 34801502551, -77942248052, -390957423498, 215189990152, 3107265788332, + 1420485007463, -18347443916369, -23277245912959, 80992666070621, 174175172136656, -256947893746801, + -907981487991468, 484717098540915, 3624070471203629, 223320207786810, -11495832122433637, + -5970240860086125, 29459554866159718, 27626780885543732, -61174934576020682, -85453537075841594, + 101601090502467492, 205071787088061635, -128623032844198712, -402298722797595630, 103257810302253206, + 661593554032027685, 13023738437946757, -924770373478411117, -228669477020600489, 1106930103187315214, + 501417832370076217, -1137744012688843614, -748484700066174875, 1002096690610670198, 887074929263872304, + -749681502970099140, -878282874862417133, 466192451440777121, 743397334132464078, -228293327650766293, + -544343133811559511, 73246386276267014, 346915388490966115, 2655042441806609, -192876875700267550, + -25542640982995001, 93481097097188652, 23309890824202258, -39341812220193672, -14459562353785875, + 14260775252163516, 7110363380474628, -4385795657650451, -2904911553101253, 1111356927314961, + 1003888928894249, -216866559082696, -295159994592569, 25722943511905, 73725762974324, 1493634668853, + -15527611742629, -1817577645774, 2717078090720, 579368368367, -384681131682, -124276266074, 41834786710, + 20049074850, -3059594663, -2480136051, 67764972, 231104576, 16656470, -15345258, -2573079, 629755, 190125, + -7992, -7579, -537, 116, 21, 1]); + self.assertEquals(pari.poldisc(p), '-1466510154829726293392657799494718982280019324678223081569643138650941' + + '8786507377255173112139726969385025460405653232785506791516185715571718938055758748427882' + + '056024408462365432062266407566752265468717307291') + +"""**** Original expected results **** + +Mod(1, 2) +Mod(1, 3) +Mod(1, 3) +-27*d^2*a^2 + (18*d*c*b - 4*c^3)*a + (-4*d*b^3 + c^2*b^2) +Mod(2, 3)*c^3*a + (Mod(2, 3)*d*b^3 + Mod(1, 3)*c^2*b^2) +Mod(2, 3)*c^3*a +-146651015482972629339265779949471898228001932467822308156964313865094187865 +0737725517311213972696938502546040565323278550679151618571557171893805575874 +8427882056024408462365432062266407566752265468717307291 + +""" diff --git a/tests/unittests/ellmodulareqn.py b/tests/unittests/ellmodulareqn.py new file mode 100644 index 0000000..731f278 --- /dev/null +++ b/tests/unittests/ellmodulareqn.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file ellmodulareqn : +\\package:seadata + +ellmodulareqn(2) +ellmodulareqn(11) +ellmodulareqn(3,y,z) +\\ errors +ellmodulareqn(1) +ellmodulareqn(2,y,x) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestEllmodulareqn(unittest.TestCase): + + def test_ellmodulareqn(self): + self.assertEquals(pari.ellmodulareqn(2), '[x^3 + 48*x^2 + (-y + 768)*x + 4096, 0]') + self.assertEquals(pari.ellmodulareqn(11), '[x^12 + (-y + 744)*x^11 + 196680*x^10 + (187*y + 21354080)*x' + + '^9 + (506*y + 830467440)*x^8 + (-11440*y + 16875327744)*x^7 + (-57442*y + 2085649589' + + '76)*x^6 + (184184*y + 1678582287360)*x^5 + (1675784*y + 9031525113600)*x^4 + (186771' + + '2*y + 32349979904000)*x^3 + (-8252640*y + 74246810880000)*x^2 + (-19849600*y + 98997' + + '734400000)*x + (y^2 - 8720000*y + 58411072000000), 1]') + self.assertEquals(pari.ellmodulareqn(3, 'y', 'z'), '[y^4 + 36*y^3 + 270*y^2 + (-z + 756)*y + 729, 0]') + + def test_ellmodulareqn_errors(self): + with self.assertRaises(PariError) as context: + pari.ellmodulareqn(1) + self.assertTrue('not a prime number in ellmodulareqn (level): 1' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.ellmodulareqn(2, 'y', 'x') + self.assertTrue('incorrect priority in ellmodulareqn: variable y >= x' in str(context.exception)) + +"""**** Original expected results **** + +[x^3 + 48*x^2 + (-y + 768)*x + 4096, 0] +[x^12 + (-y + 744)*x^11 + 196680*x^10 + (187*y + 21354080)*x^9 + (506*y + 83 +0467440)*x^8 + (-11440*y + 16875327744)*x^7 + (-57442*y + 208564958976)*x^6 + + (184184*y + 1678582287360)*x^5 + (1675784*y + 9031525113600)*x^4 + (186771 +2*y + 32349979904000)*x^3 + (-8252640*y + 74246810880000)*x^2 + (-19849600*y + + 98997734400000)*x + (y^2 - 8720000*y + 58411072000000), 1] +[y^4 + 36*y^3 + 270*y^2 + (-z + 756)*y + 729, 0] + *** at top-level: ellmodulareqn(1) + *** ^---------------- + *** ellmodulareqn: not a prime number in ellmodulareqn (level): 1. + *** at top-level: ellmodulareqn(2,y,x) + *** ^-------------------- + *** ellmodulareqn: incorrect priority in ellmodulareqn: variable y >= x + +""" diff --git a/tests/unittests/factorint.py b/tests/unittests/factorint.py new file mode 100644 index 0000000..5651b20 --- /dev/null +++ b/tests/unittests/factorint.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file factorint : +factorint(-33623546348886051018593728804851,1) +factorint(691160558642,1) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestFactorint(unittest.TestCase): + def test_factorint(self): + self.assertEquals(str(pari.factorint(-33623546348886051018593728804851, 1)), + '[-1, 1; 3, 5; 73, 1; 181, 1; 223, 1; 293, 2; 4157, 2; 112573, 1; 281191, 1]') + self.assertEquals(str(pari.factorint(691160558642,1)), '[2, 1; 397, 1; 27031, 1; 32203, 1]') + +"""**** Original expected results **** + + +[ -1 1] + +[ 3 5] + +[ 73 1] + +[ 181 1] + +[ 223 1] + +[ 293 2] + +[ 4157 2] + +[112573 1] + +[281191 1] + + +[ 2 1] + +[ 397 1] + +[27031 1] + +[32203 1] + + +""" diff --git a/tests/unittests/galpol.py b/tests/unittests/galpol.py new file mode 100644 index 0000000..43db99a --- /dev/null +++ b/tests/unittests/galpol.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file galpol : +\\ package: galpol + +galoisgetpol(8) +for(i=1,5,print(galoisgetpol(8,i))) +for(i=1,5,print(galoisgetpol(8,i,2))) +galoisgetpol(8,6) +galoisgetpol(3,1,3) +galoisgetpol(3,1,2) +test(n,k)= + if(galoisidentify(galoisinit(galoisgetpol(n,k)[1])) != [n,k], error([n,k])); +test(8,3) +test(18,5) +test(27,3) +test(45,2) +test(30,4) +test(32,4) +test(32,13) +test(32,30) +test(32,32) +test(42,2) +test(48,12) +test(64,3) +test(64,14) +test(64,16) +test(64,48) +test(64,51) +test(64,70) +test(64,68) +test(64,80) +test(64,44) +galoisidentify(galoisinit(polcyclo(390))) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestGalpol(unittest.TestCase): + def test_galpol(self): + # package: galpol + + self.assertEquals(pari.galoisgetpol(8), '5') + l = ['[x^8 - x^7 - 7*x^6 + 6*x^5 + 15*x^4 - 10*x^3 - 10*x^2 + 4*x + 1, 1]', + '[x^8 - 7*x^6 + 14*x^4 - 8*x^2 + 1, 1]', + '[x^8 - 4*x^7 - 8*x^6 + 24*x^5 + 30*x^4 - 16*x^3 - 20*x^2 + 2, 3]', + '[x^8 - 12*x^6 + 36*x^4 - 36*x^2 + 9, 3]', + '[x^8 - 12*x^6 + 23*x^4 - 12*x^2 + 1, 7]'] + for i in range(1,6): + self.assertEquals(pari.galoisgetpol(8,i), l[i-1]) + l = ['[x^8 + 8*x^6 + 20*x^4 + 16*x^2 + 2, 1]', + '[x^8 - x^7 + x^5 - x^4 + x^3 - x + 1, 1]', + '[x^8 + 3*x^4 + 1, 1]', + '[x^8 + 12*x^6 + 36*x^4 + 36*x^2 + 9, 3]', + '[x^8 - x^4 + 1, 1]'] + for i in range(1, 6): + self.assertEquals(pari.galoisgetpol(8, i, 2), l[i - 1]) + with self.assertRaises(PariError) as context: + pari.galoisgetpol(8, 6) + self.assertTrue('domain error in galoisgetpol: group index > 5' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.galoisgetpol(3, 1, 3) + self.assertTrue('invalid flag in galoisgetpol' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.galoisgetpol(3, 1, 2) + self.assertTrue('domain error in galoisgetpol: s > 1' in str(context.exception)) + # test(n,k)= + # if(pari.galoisidentify(pari.galoisinit(pari.galoisgetpol(n,k)[1])) != [n,k], error([n,k])); + # test(8,3) + # test(18,5) + # test(27,3) + # test(45,2) + # test(30,4) + # test(32,4) + # test(32,13) + # test(32,30) + # test(32,32) + # test(42,2) + # test(48,12) + # test(64,3) + # test(64,14) + # test(64,16) + # test(64,48) + # test(64,51) + # test(64,70) + # test(64,68) + # test(64,80) + # test(64,44) + self.assertEquals(pari.galoisidentify(pari.galoisinit(pari.polcyclo(390))), '[96, 161]') + +"""**** Original expected results **** + +5 +[x^8 - x^7 - 7*x^6 + 6*x^5 + 15*x^4 - 10*x^3 - 10*x^2 + 4*x + 1, 1] +[x^8 - 7*x^6 + 14*x^4 - 8*x^2 + 1, 1] +[x^8 - 4*x^7 - 8*x^6 + 24*x^5 + 30*x^4 - 16*x^3 - 20*x^2 + 2, 3] +[x^8 - 12*x^6 + 36*x^4 - 36*x^2 + 9, 3] +[x^8 - 12*x^6 + 23*x^4 - 12*x^2 + 1, 7] +[x^8 + 8*x^6 + 20*x^4 + 16*x^2 + 2, 1] +[x^8 - x^7 + x^5 - x^4 + x^3 - x + 1, 1] +[x^8 + 3*x^4 + 1, 1] +[x^8 + 12*x^6 + 36*x^4 + 36*x^2 + 9, 3] +[x^8 - x^4 + 1, 1] + *** at top-level: galoisgetpol(8,6) + *** ^----------------- + *** galoisgetpol: domain error in galoisgetpol: group index > 5 + *** at top-level: galoisgetpol(3,1,3) + *** ^------------------- + *** galoisgetpol: invalid flag in galoisgetpol. + *** at top-level: galoisgetpol(3,1,2) + *** ^------------------- + *** galoisgetpol: domain error in galoisgetpol: s > 1 +[96, 161] + +""" diff --git a/tests/unittests/idealappr.py b/tests/unittests/idealappr.py new file mode 100644 index 0000000..f718641 --- /dev/null +++ b/tests/unittests/idealappr.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file idealappr : +idealaddtoone(nfinit(x),[1,[;]]); +K=nfinit(x^2+23); A=idealhnf(K,x/2); +idealtwoelt(K, 3, 6) +idealtwoelt(K, A) +idealtwoelt(K, A, x) +idealtwoelt(K, [;]) +idealtwoelt(K, [;], 1) +idealtwoelt(K, [;], 0) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestIdealappr(unittest.TestCase): + def test_idealappr(self): + pari.idealaddtoone(pari.nfinit('x'),'[1,[;]]'); + K=pari.nfinit('x^2+23'); A=pari.idealhnf(K,'x/2'); + + self.assertEquals(str(pari.idealtwoelt(K, 3, 6)), '3') + self.assertEquals(str(pari.idealtwoelt(K, A)), '[23/2, [6, 1/2]~]') + self.assertEquals(str(pari.idealtwoelt(K, A, 'x')), '-23/2') + self.assertEquals(str(pari.idealtwoelt(K, '[;]')), '[0, 0]') + with self.assertRaises(PariError) as context: + pari.idealtwoelt(K, '[;]', 1) + self.assertTrue('domain error in idealtwoelt2: element mod ideal != 0' in str(context.exception)) + self.assertEquals(str(pari.idealtwoelt(K, '[;]', 0)), '0') + +"""**** Original expected results **** + +3 +[23/2, [6, 1/2]~] +-23/2 +[0, 0] + *** at top-level: idealtwoelt(K,[;],1) + *** ^-------------------- + *** idealtwoelt: domain error in idealtwoelt2: element mod ideal != 0 +0 + +""" diff --git a/tests/unittests/isprime.py b/tests/unittests/isprime.py new file mode 100644 index 0000000..721ad98 --- /dev/null +++ b/tests/unittests/isprime.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file isprime : +isprime(5368962301599408606279497323618896374219) +isprime(4309513411435775833571) +isprime(26959946667150639794667015087019630673557916260026308143510066298881) + +p=10^6+3; q=10^6+33; +isprime(1+24*p*q, 1) +isprime(1+232*p^2*q^3, 1) + +isprime([2,3,4]) +isprime([2,3,4],1) +isprime([2,3,4],2) +ispseudoprime([1,3,4,5],2) +\\isprime(2^3515+159, 2) 10 min +\\isprime(2^2000+841, 2) 1 min +\\isprime(2^1600+895, 2) 27s +isprime(2^1000+297, 2) + +isprime(2^256+5721) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestIsprime(unittest.TestCase): + def test_isprime(self): + self.assertEquals(pari.isprime(5368962301599408606279497323618896374219), '1') + self.assertEquals(pari.isprime(4309513411435775833571), '1') + self.assertEquals(pari.isprime(26959946667150639794667015087019630673557916260026308143510066298881), '1') + + p = 10 ** 6 + 3; + q = 10 ** 6 + 33; + self.assertEquals(pari.isprime(1 + 24 * p * q, 1), '[2, 5, 1; 3, 2, 1; 1000003, 2, 1]') + x = pari.isprime(1 + 232 * p ** 2 * q ** 3, 1) + self.assertEquals(x, '[2, 3, 1; 29, 2, 1; 1000003, 2, 1]') + + self.assertEquals(pari.isprime([2, 3, 4]), '[1, 1, 0]') + self.assertEquals(pari.isprime([2, 3, 4], 1), '[1, Mat([2, 2, 1]), 0]') + self.assertEquals(pari.isprime([2, 3, 4], 2), '[1, 1, 0]') + self.assertEquals(pari.ispseudoprime([1, 3, 4, 5], 2), '[0, 1, 0, 1]') + # pari.isprime(2^3515+159, 2) 10 min + # pari.isprime(2^2000+841, 2) 1 min + # pari.isprime(2^1600+895, 2) 27s + self.assertEquals(pari.isprime(2 ** 1000 + 297, 2), '1') + + self.assertEquals(pari.isprime(2 ** 256 + 5721), '1') + +"""**** Original expected results **** + +1 +1 +1 + +[ 2 5 1] + +[ 3 2 1] + +[1000003 2 1] + + +[ 2 3 1] + +[ 29 2 1] + +[1000003 2 1] + +[1, 1, 0] +[1, Mat([2, 2, 1]), 0] +[1, 1, 0] +[0, 1, 0, 1] +1 +1 + +""" diff --git a/tests/unittests/lambert.py b/tests/unittests/lambert.py new file mode 100644 index 0000000..2460eeb --- /dev/null +++ b/tests/unittests/lambert.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file lambert : +do(y)=my(x = lambertw(y)); exp(x)*x / y; +do(-1) +do(I) +default(realprecision,38); +do(2) +default(realprecision,211); +do(1e14) +do(y)= +{ my(x = lambertw(y), e = normlp(Vec(exp(x)*x - y))); + if (e > 5e-38, error([e, y])); +} +default(realprecision,38); +do(O(x^10)) +do(O(x^30)) +do(3+O(x^10)) +do(3+O(x^30)) +do(x) +do(x+O(x^10)) +do(x+O(x^30)) +do(3+O(x)) +do(3+x) +do(3+x+O(x^10)) +do(3+x+O(x^30)) +do(x^2-2*x^3) +do(x^2-2*x^3+O(x^10)) +do(x^2-2*x^3+O(x^30)) +do(3+x^2-2*x^3) +do(3+x^2-2*x^3+O(x^10)) +do(3+x^2-2*x^3+O(x^30)) +lambertw(1/x) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestLambert(unittest.TestCase): + def test_lambert(self): + def do(y, precision=128): + x = pari.lambertw(y, precision=precision) + return pari.exp(x)*x/y; + with self.assertRaises(PariError) as context: + do(-1) + self.assertTrue('domain error in Lw: y < 0' in str(context.exception)) + with self.assertRaises(PariError) as context: + do('I') + self.assertTrue('sorry, lambert(t_COMPLEX) is not yet implemented' in str(context.exception)) + pari.set_real_precision(38) + self.assertEquals(do(2), '1.0000000000000000000000000000000000000') + pari.set_real_precision(211) + self.assertEquals(do('1e14', precision=701), + '0.9999999999999999999999999999999999999999999999999999999999999999999' + + '999999999999999999999999999999999999999999999999999999999999999999999999999999999' + + '999999999999999999999999999999999999999999999999999999999999999') + + def do2(y, precision=128): + x = pari.lambertw(y, precision=precision) + e = pari.normlp(pari.Vec(pari.exp(x)*x - y)) + self.assertLessEqual(e, 5e-38) + + pari.set_real_precision(38) + do2('O(x^10)') + do2('O(x^30)') + do2('3+O(x^10)') + do2('3+O(x^30)') + do2('x') + do2('x+O(x^10)') + do2('x+O(x^30)') + do2('3+O(x)') + do2('3+x') + do2('3+x+O(x^10)') + do2('3+x+O(x^30)') + do2('x^2-2*x^3') + do2('x^2-2*x^3+O(x^10)') + do2('x^2-2*x^3+O(x^30)') + do2('3+x^2-2*x^3') + do2('3+x^2-2*x^3+O(x^10)') + do2('3+x^2-2*x^3+O(x^30)') + with self.assertRaises(PariError) as context: + pari.lambertw('1/x') + self.assertTrue('domain error in lambertw: valuation < 0' in str(context.exception)) + +"""**** Original expected results **** + + *** at top-level: do(-1) + *** ^------ + *** in function do: my(x=lambertw(y));exp(x)* + *** ^-------------------- + *** lambertw: domain error in Lw: y < 0 + *** at top-level: do(I) + *** ^----- + *** in function do: my(x=lambertw(y));exp(x)* + *** ^-------------------- + *** lambertw: sorry, lambert(t_COMPLEX) is not yet implemented. +1.0000000000000000000000000000000000000 +0.99999999999999999999999999999999999999999999999999999999999999999999999999 +9999999999999999999999999999999999999999999999999999999999999999999999999999 +9999999999999999999999999999999999999999999999999999999999999 + *** at top-level: lambertw(1/x) + *** ^------------- + *** lambertw: domain error in lambertw: valuation < 0 + +""" diff --git a/tests/unittests/lex.py b/tests/unittests/lex.py new file mode 100644 index 0000000..202a501 --- /dev/null +++ b/tests/unittests/lex.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file lex : +v = [0, 2, [1,2], [1,2;3,4], [1,0;1,2], [1,2,3]~, [1,2,3;4,5,6]]; + +isvec(x) = type(x) == "t_VEC" || type(x) == "t_COL"; +{ + for (i = 1, #v, + for (j = i, #v, + s = lex(v[i],v[j]); + print([i,j,s]); + if (s != -lex(v[j], v[i]), error(2)); + if (isvec(v[i]) && lex(Vecsmall(v[i]), v[j]) != s, error(3)); + if (isvec(v[j]) && lex(v[i], Vecsmall(v[j])) != s, error(4)); + + ) + ); +} + +v = Vecsmall([1,2,3]); +lex(v, [1,2,3]) +lex(v, [1,2]) +lex(v, [1,2,4]) +lex(v, [4,2,3]) +lex(v, [0,2,3]) +lex(v, [[1,2,3],2,3]) +lex(v, [[0,2,3],2,3]) +lex(v, [[],2,3]) +lex(v, [Vecsmall([]),2,3]) +lex(v, [Vecsmall(1),2,3]) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestLex(unittest.TestCase): + def test_lex(self): + v = [0, 2, [1, 2], '[1,2;3,4]', '[1,0;1,2]', '[1,2,3]~', '[1,2,3;4,5,6]']; + + def isvec(x): + return pari.type(x) == "t_VEC" or pari.type(x) == "t_COL" + + l = ['[1, 1, 0]', + '[1, 2, -1]', + '[1, 3, -1]', + '[1, 4, -1]', + '[1, 5, -1]', + '[1, 6, -1]', + '[1, 7, -1]', + '[2, 2, 0]', + '[2, 3, 1]', + '[2, 4, 1]', + '[2, 5, 1]', + '[2, 6, 1]', + '[2, 7, 1]', + '[3, 3, 0]', + '[3, 4, -1]', + '[3, 5, 1]', + '[3, 6, -1]', + '[3, 7, -1]', + '[4, 4, 0]', + '[4, 5, 1]', + '[4, 6, 1]', + '[4, 7, -1]', + '[5, 5, 0]', + '[5, 6, -1]', + '[5, 7, -1]', + '[6, 6, 0]', + '[6, 7, -1]', + '[7, 7, 0]'] + k = 0 + for i in range(0, len(v)): + for j in range(i, len(v)): + s = pari.lex(v[i], v[j]); + self.assertEquals(str([i + 1, j + 1, s]), l[k]); + self.assertEquals(s, -pari.lex(v[j], v[i])) + if isvec(v[j]): + self.assertEquals(s, pari.lex(pari.Vecsmall(v[i]), v[j])) + self.assertEquals(s, pari.lex(v[i], pari.Vecsmall(v[j]))) + k += 1 + + v = pari.Vecsmall([1, 2, 3]); + pari.lex(v, [1, 2, 3]) + pari.lex(v, [1, 2]) + pari.lex(v, [1, 2, 4]) + pari.lex(v, [4, 2, 3]) + pari.lex(v, [0, 2, 3]) + pari.lex(v, [[1, 2, 3], 2, 3]) + pari.lex(v, [[0, 2, 3], 2, 3]) + pari.lex(v, [[], 2, 3]) + pari.lex(v, [pari.Vecsmall([]), 2, 3]) + pari.lex(v, [pari.Vecsmall(1), 2, 3]) + +"""**** Original expected results **** + +[1, 1, 0] +[1, 2, -1] +[1, 3, -1] +[1, 4, -1] +[1, 5, -1] +[1, 6, -1] +[1, 7, -1] +[2, 2, 0] +[2, 3, 1] +[2, 4, 1] +[2, 5, 1] +[2, 6, 1] +[2, 7, 1] +[3, 3, 0] +[3, 4, -1] +[3, 5, 1] +[3, 6, -1] +[3, 7, -1] +[4, 4, 0] +[4, 5, 1] +[4, 6, 1] +[4, 7, -1] +[5, 5, 0] +[5, 6, -1] +[5, 7, -1] +[6, 6, 0] +[6, 7, -1] +[7, 7, 0] +0 +1 +-1 +-1 +1 +-1 +1 +1 +1 +-1 + +""" diff --git a/tests/unittests/lindep.py b/tests/unittests/lindep.py new file mode 100644 index 0000000..fdddac1 --- /dev/null +++ b/tests/unittests/lindep.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file lindep : +lindep([sqrt(2), sqrt(3), sqrt(2)+sqrt(3)]) +lindep([1, 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)]) +lindep([1,2,3;4,5,6;7,8,9]) +lindep([x*y, x^2 + y, x^2*y + x*y^2, 1]) +z = sqrt(1+5*y+y^2+y^3); +seralgdep(z, 2,3) +seralgdep(z, 2,2) +seralgdep(1/(1-y+O(y^5)), 1,1) +seralgdep(1+5*y+O(y^3), 1,10) +lindep([]) +lindep([0]) +lindep([1]) +lindep([1,I]) +algdep(1,0) +algdep(1,-1) +z=sqrt(2+O(7^4)); algdep(z,2) +lindep(Mod([E*x, E*x + E, E^2*x^2 + E*x + 2*E], E^3)) +lindep([[1,0,0],[0,1,0],[1,1,0]]) +lindep([[1,0,0]~,[0,1,0]~,[1,1,0]~]) +lindep([[1,0,0]~,[0,1,0]~,[1,1,1]~]) +lindep([[1,0,0]~,[0,1,0],[1,1,0]]) +lindep([[1,0,0]~,[0,1,0]~,[1,1,0]~]) + +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestLindep(unittest.TestCase): + def setUp(self): + pari.set_real_precision(15) + def test_lindep(self): + self.assertEquals(pari.lindep([pari.sqrt(2), pari.sqrt(3), pari.sqrt(2) + pari.sqrt(3)]), '[-1, -1, 1]~') + self.assertEquals(pari.lindep('[1, 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)]'), '[1, -2]~') + self.assertEquals(pari.lindep('[1,2,3;4,5,6;7,8,9]'), '[1, -2, 1]~') + self.assertEquals(pari.lindep(['x*y', 'x^2 + y', 'x^2*y + x*y^2', 1]), '[y, y, -1, -y^2]~') + self.assertEquals(pari.lindep([]), '[]~') + self.assertEquals(pari.lindep([0]), '[1]~') + self.assertEquals(pari.lindep([1]), '[]~') + self.assertEquals(pari.lindep([1, 'I']), '[]~') + self.assertEquals(pari.lindep(pari.Mod(['E*x', 'E*x + E', 'E^2*x^2 + E*x + 2*E'], 'E^3')), + '[Mod(0, E^3), Mod(0, E^3), Mod(0, E^3)]~') + self.assertEquals(pari.lindep([[1, 0, 0], [0, 1, 0], [1, 1, 0]]), '[1, 1, -1]~') + self.assertEquals(pari.lindep(['[1,0,0]~', '[0,1,0]~', '[1,1,0]~']), '[1, 1, -1]~') + self.assertEquals(pari.lindep(['[1,0,0]~', '[0,1,0]~', '[1,1,1]~']), '[]~') + with self.assertRaises(PariError) as context: + pari.lindep(['[1,0,0]~', [0, 1, 0], [1, 1, 0]]) + self.assertTrue('incorrect type in lindep (t_VEC)' in str(context.exception)) + self.assertEquals(pari.lindep(['[1,0,0]~', '[0,1,0]~', '[1,1,0]~']), '[1, 1, -1]~') + + def test_seralgdep(self): + z = pari.sqrt('1+5*y+y^2+y^3'); + self.assertEquals(pari.seralgdep(z, 2, 3), 'x^2 + (-y^3 - y^2 - 5*y - 1)') + self.assertEquals(pari.seralgdep(z, 2, 2), '0') + self.assertEquals(pari.seralgdep('1/(1-y+O(y^5))', 1, 1), '(-y + 1)*x - 1') + self.assertEquals(pari.seralgdep('1+5*y+O(y^3)', 1, 10), '-x + (5*y + 1)') + + def test_algdep(self): + self.assertEquals(pari.algdep(1, 0), '1') + with self.assertRaises(PariError) as context: + pari.algdep(1, -1) + self.assertTrue('domain error in algdep: degree < 0' in str(context.exception)) + z = pari.sqrt('2+O(7^4)'); + self.assertEquals(pari.algdep(z, 2), 'x^2 - 2') + + +"""**** Original expected results **** + +[-1, -1, 1]~ +[1, -2]~ +[1, -2, 1]~ +[y, y, -1, -y^2]~ +x^2 + (-y^3 - y^2 - 5*y - 1) +0 +(-y + 1)*x - 1 +-x + (5*y + 1) +[]~ +[1]~ +[]~ +[]~ +1 + *** at top-level: algdep(1,-1) + *** ^------------ + *** algdep: domain error in algdep: degree < 0 +x^2 - 2 +[Mod(0, E^3), Mod(0, E^3), Mod(0, E^3)]~ +[1, 1, -1]~ +[1, 1, -1]~ +[]~ + *** at top-level: lindep([[1,0,0]~,[0, + *** ^-------------------- + *** lindep: incorrect type in lindep (t_VEC). +[1, 1, -1]~ + +""" diff --git a/tests/unittests/linear.py b/tests/unittests/linear.py new file mode 100644 index 0000000..c97fe8d --- /dev/null +++ b/tests/unittests/linear.py @@ -0,0 +1,1053 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file linear : +HEAP=[98, if(precision(1.)==38,10174,10354)]; +default(realprecision,38); +\e +algdep(2*cos(2*Pi/13),6) +algdep(2*cos(2*Pi/13),6,15) +charpoly([1,2;3,4],z) +charpoly(Mod(x^2+x+1,x^3+5*x+1),z) +charpoly([1,2;3,4],z,1) +charpoly(Mod(1,8191)*[1,2;3,4],z,2) +lindep(Mod(1,7)*[2,-1;1,3]) +lindep([(1-3*sqrt(2))/(3-2*sqrt(3)),1,sqrt(2),sqrt(3),sqrt(6)]) +lindep([(1-3*sqrt(2))/(3-2*sqrt(3)),1,sqrt(2),sqrt(3),sqrt(6)],14) +matadjoint([1,2;3,4]) +matcompanion(x^5-12*x^3+0.0005) +matdet([1,2,3;1,5,6;9,8,7]) +matdet([1,2,3;1,5,6;9,8,7],1) +matdetint([1,2,3;4,5,6]) +matdiagonal([2,4,6]) +mateigen([1,2,3;4,5,6;7,8,9]) +mathess(mathilbert(7)) +mathilbert(5) +amat=1/mathilbert(7) +mathnf(amat) +mathnf(amat,1) +mathnf(amat,4) +mathnf(amat,5) +mathnfmod(amat,matdetint(amat)) +mathnfmodid(amat,123456789*10^100) +matid(5) +matimage([1,3,5;2,4,6;3,5,7]) +matimage([1,3,5;2,4,6;3,5,7],1) +matimage(Pi*[1,3,5;2,4,6;3,5,7]) +matimagecompl([1,3,5;2,4,6;3,5,7]) +matimagecompl(Pi*[1,3,5;2,4,6;3,5,7]) +matindexrank([1,1,1;1,1,1;1,1,2]) +matintersect([1,2;3,4;5,6],[2,3;7,8;8,9]) +matinverseimage([1,1;2,3;5,7],[2,2,6]~) +matisdiagonal([1,0,0;0,5,0;0,0,0]) +matker(matrix(4,4,x,y,x/y)) +matker(matrix(4,4,x,y,sin(x+y))) +matker(matrix(4,4,x,y,x+y),1) +matkerint(matrix(4,4,x,y,x*y)) +matkerint(matrix(4,4,x,y,x*y),1) +matkerint(matrix(4,6,x,y,2520/(x+y))) +matmuldiagonal(amat,[1,2,3,4,5,6,7]) +matmultodiagonal(amat^-1,%) +matpascal(8) +matrank(matrix(5,5,x,y,x+y)) +matrix(5,5,x,y,gcd(x,y)) +matrixqz([1,3;3,5;5,7],0) +matrixqz([1/3,1/4,1/6;1/2,1/4,-1/4;1/3,1,0],-1) +matrixqz([1,3;3,5;5,7],-2) +matsize([1,2;3,4;5,6]) +matsnf(1/mathilbert(6)) +matsnf(x*matid(5)-matrix(5,5,j,k,1),2) +matsolve(mathilbert(10),[1,2,3,4,5,6,7,8,9,0]~) +matsolvemod([2,3;5,4],[7,11]~,[1,4]~) +matsolvemod([2,3;5,4],[7,11]~,[1,4]~,1) +matsupplement([1,3;2,4;3,6]) +mattranspose(vector(2,x,x)) +%*%~ +norml2(vector(10,x,x)) +qfgaussred(mathilbert(5)) +qfjacobi(mathilbert(6)) +m=1/mathilbert(7) +mp=concat(m,matid(7)) +qflll(m) +qflllgram(m) +qflllgram(m,1) +qflllgram(mp~*mp,4) +qflll(m,1) +qflll(m,2) +qflll(mp,4) +qfminim([2,1;1,2],4,6) +qfperfection([2,0,1;0,2,1;1,1,2]) +qfsign(mathilbert(5)-0.11*matid(5)) +trace(1+I) +trace(Mod(x+5,x^3+x+1)) +Vec(sin(x)) +vecmax([-3,7,-2,11]) +vecmin([-3,7,-2,11]) +concat([1,2],[3,4]) +concat(Mat(vector(4,x,x)~),vector(4,x,10+x)~) +vecextract([1,2,3,4,5,6,7,8,9,10],1000) +vecextract(matrix(15,15,x,y,x+y),vector(5,x,3*x),vector(3,y,3*y)) +round((1.*mathilbert(7))^(-1) << 77) / 2^77 +vecsort([8,7,6,5],,1) +vecsort([[1,5],[2,4],[1,5,1],[1,4,2]]) +vecsort(vector(17,x,5*x%17)) +vecsort([[1,8,5],[2,5,8],[3,6,-6],[4,8,6]],2) +vecsort([[1,8,5],[2,5,8],[3,6,-6],[4,8,6]],[2,1]) +vector(10,x,1/x) +if (getheap()!=HEAP, getheap()) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestLinear(unittest.TestCase): + def setUp(self): + pari.set_real_precision(38) + + def test_algdep(self): + self.assertEquals(pari.algdep(2 * pari.cos('2*Pi/13'), 6), 'x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1') + self.assertEquals(pari.algdep(2 * pari.cos('2*Pi/13'), 6, 15), 'x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1') + + def test_chapoly(self): + self.assertEquals(pari.charpoly('[1,2;3,4]', 'z'), 'z^2 - 5*z - 2') + self.assertEquals(pari.charpoly(pari.Mod('x^2+x+1', 'x^3+5*x+1'), 'z'), 'z^3 + 7*z^2 + 16*z - 19') + self.assertEquals(pari.charpoly('[1,2;3,4]', 'z', 1), 'z^2 - 5*z - 2') + self.assertEquals(pari.charpoly(pari.Mod(1, 8191) * '[1,2;3,4]', 'z', 2), + 'z^2 + Mod(8186, 8191)*z + Mod(8189, 8191)') + + def test_lindep(self): + self.assertEquals(pari.lindep(pari.Mod(1, 7) * '[2,-1;1,3]'), '[-3, 1]~') + + self.assertEquals(pari.lindep([float(1 - 3 * pari.sqrt(2)) / (3 - 2 * pari.sqrt(3)), 1, pari.sqrt(2), + pari.sqrt(3), pari.sqrt(6)]), '[3, 3, -9, 2, -6]~') + + self.assertEquals(pari.lindep([float(1 - 3 * pari.sqrt(2)) / (3 - 2 * pari.sqrt(3)), 1, pari.sqrt(2), + pari.sqrt(3), pari.sqrt(6)], 14), '[-3, -3, 9, -2, 6]~') + + def test_mathnf(self): + amat = 1 / pari.mathilbert(7) + self.assertEquals(amat, + '[49, -1176, 8820, -29400, 48510, -38808, 12012; -1176, 37632, -317520, 1128960, -1940400' + + ', 1596672, -504504; 8820, -317520, 2857680, -10584000, 18711000, -15717240, 5045040; -29' + + '400, 1128960, -10584000, 40320000, -72765000, 62092800, -20180160; 48510, -1940400, 1871' + + '1000, -72765000, 133402500, -115259760, 37837800; -38808, 1596672, -15717240, 62092800, ' + + '-115259760, 100590336, -33297264; 12012, -504504, 5045040, -20180160, 37837800, -3329726' + + '4, 11099088]') + + self.assertEquals(pari.mathnf(amat), + '[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, 1260; ' + + '0, 0, 0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0' + + ', 0, 0, 0, 0, 12012]') + + self.assertEquals(pari.mathnf(amat, 1), + '[[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, 1260; 0, 0,' + + ' 0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0, 0, 0, 0, ' + + '0, 12012], [420, 420, 840, 630, 2982, 1092, 4159; 210, 280, 630, 504, 2415, 876, 3395; 1' + + '40, 210, 504, 420, 2050, 749, 2901; 105, 168, 420, 360, 1785, 658, 2542; 84, 140, 360, 3' + + '15, 1582, 588, 2266; 70, 120, 315, 280, 1421, 532, 2046; 60, 105, 280, 252, 1290, 486, 1' + + '866]]') + self.assertEquals(pari.mathnf(amat, 4), + '[[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, 1260; 0, 0, ' + + '0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0, 0, 0, 0, 0' + + ', 12012], [420, 420, 840, 630, 2982, 1092, 4159; 210, 280, 630, 504, 2415, 876, 3395; ' + + '140, 210, 504, 420, 2050, 749, 2901; 105, 168, 420, 360, 1785, 658, 2542; 84, 140, 360, ' + + '315, 1582, 588, 2266; 70, 120, 315, 280, 1421, 532, 2046; 60, 105, 280, 252, 1290, 486' + + ', 1866]]') + self.assertEquals(pari.mathnf(amat, 5), + '[[360360, 0, 0, 0, 0, 144144, 300300; 0, 27720, 0, 0, 0, 0, 22176; 0, 0, 27720, 0, 0, 0,' + + ' 6930; 0, 0, 0, 2520, 0, 0, 840; 0, 0, 0, 0, 2520, 0, 1260; 0, 0, 0, 0, 0, 168, 0; 0, 0,' + + ' 0, 0, 0, 0, 7], [51480, 4620, 5544, 630, 840, 20676, 48619; 45045, 3960, 4620, 504, 630' + + ', 18074, 42347; 40040, 3465, 3960, 420, 504, 16058, 37523; 36036, 3080, 3465, 360, 420, ' + + '14448, 33692; 32760, 2772, 3080, 315, 360, 13132, 30574; 30030, 2520, 2772, 280, 315, 12' + + '036, 27986; 27720, 2310, 2520, 252, 280, 11109, 25803], Vecsmall([7, 6, 5, 4, 3, 2, 1])]') + self.assertEquals(pari.mathnfmod(amat, pari.matdetint(amat)), + '[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, 1260; 0, 0, ' + + '0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0, 0, 0, 0, 0' + + ', 12012]') + self.assertEquals(pari.mathnfmodid(amat, '123456789*10^100'), + '[60, 0, 0, 0, 30, 24, 35; 0, 120, 0, 0, 0, 0, 24; 0, 0, 360, 0, 0, 0, 180; 0, 0, 0, 360,' + + ' 0, 0, 240; 0, 0, 0, 0, 180, 0, 90; 0, 0, 0, 0, 0, 72, 0; 0, 0, 0, 0, 0, 0, 12]') + + def test_qflll(self): + m = 1 / pari.mathilbert(7) + self.assertEquals(m, + '[49, -1176, 8820, -29400, 48510, -38808, 12012; -1176, 37632, -317520, 1128960, -1940400' + + ', 1596672, -504504; 8820, -317520, 2857680, -10584000, 18711000, -15717240, 5045040; -29' + + '400, 1128960, -10584000, 40320000, -72765000, 62092800, -20180160; 48510, -1940400, 1871' + + '1000, -72765000, 133402500, -115259760, 37837800; -38808, 1596672, -15717240, 62092800, ' + + '-115259760, 100590336, -33297264; 12012, -504504, 5045040, -20180160, 37837800, -3329726' + + '4, 11099088]') + mp = pari.concat(m, pari.matid(7)) + self.assertEquals(mp, + '[49, -1176, 8820, -29400, 48510, -38808, 12012, 1, 0, 0, 0, 0, 0, 0; -1176, 37632, -3175' + + '20, 1128960, -1940400, 1596672, -504504, 0, 1, 0, 0, 0, 0, 0; 8820, -317520, 2857680, -1' + + '0584000, 18711000, -15717240, 5045040, 0, 0, 1, 0, 0, 0, 0; -29400, 1128960, -10584000, ' + + '40320000, -72765000, 62092800, -20180160, 0, 0, 0, 1, 0, 0, 0; 48510, -1940400, 18711000' + + ', -72765000, 133402500, -115259760, 37837800, 0, 0, 0, 0, 1, 0, 0; -38808, 1596672, -157' + + '17240, 62092800, -115259760, 100590336, -33297264, 0, 0, 0, 0, 0, 1, 0; 12012, -504504, ' + + '5045040, -20180160, 37837800, -33297264, 11099088, 0, 0, 0, 0, 0, 0, 1]') + + self.assertEquals(pari.qflll(m), + '[-420, -420, 840, 630, -1092, 757, 2982; -210, -280, 630, 504, -876, 700, 2415; -140, -2' + + '10, 504, 420, -749, 641, 2050; -105, -168, 420, 360, -658, 589, 1785; -84, -140, 360, 31' + + '5, -588, 544, 1582; -70, -120, 315, 280, -532, 505, 1421; -60, -105, 280, 252, -486, 471' + + ', 1290]') + self.assertEquals(pari.qflllgram(m), + '[1, 1, 27, -27, 69, 0, 141; 0, 1, 4, -23, 34, -24, 49; 0, 1, 3, -22, 18, -24, 23; 0, 1, ' + + '3, -21, 10, -19, 13; 0, 1, 3, -20, 6, -14, 8; 0, 1, 3, -19, 4, -10, 5; 0, 1, 3, -18, 3, ' + + '-7, 3]') + self.assertEquals(pari.qflllgram(m, 1), + '[1, 1, 27, -27, 69, 0, 141; 0, 1, 4, -23, 34, -24, 49; 0, 1, 3, -22, 18, -24, 23; 0, 1, ' + + '3, -21, 10, -19, 13; 0, 1, 3, -20, 6, -14, 8; 0, 1, 3, -19, 4, -10, 5; 0, 1, 3, -18, 3, ' + + '-7, 3]') + self.assertEquals(pari.qflll(m, 1), + '[-420, -420, 840, 630, -1092, 757, 2982; -210, -280, 630, 504, -876, 700, 2415; -140, -2' + + '10, 504, 420, -749, 641, 2050; -105, -168, 420, 360, -658, 589, 1785; -84, -140, 360, 31' + + '5, -588, 544, 1582; -70, -120, 315, 280, -532, 505, 1421; -60, -105, 280, 252, -486, 471' + + ', 1290]') + self.assertEquals(pari.qflll(m, 2), + '[-420, -420, -630, 840, 1092, 2982, -83; -210, -280, -504, 630, 876, 2415, 70; -140, -21' + + '0, -420, 504, 749, 2050, 137; -105, -168, -360, 420, 658, 1785, 169; -84, -140, -315, 36' + + '0, 588, 1582, 184; -70, -120, -280, 315, 532, 1421, 190; -60, -105, -252, 280, 486, 1290' + + ', 191]') + self.assertEquals(pari.qflll(mp, 4), + '[[-420, -420, 840, 630, 2982, -1092, 757; -210, -280, 630, 504, 2415, -876, 700; -140, -' + + '210, 504, 420, 2050, -749, 641; -105, -168, 420, 360, 1785, -658, 589; -84, -140, 360, 3' + + '15, 1582, -588, 544; -70, -120, 315, 280, 1421, -532, 505; -60, -105, 280, 252, 1290, -4' + + '86, 471; 420, 0, 0, 0, -210, 168, 35; 0, 840, 0, 0, 0, 0, 336; 0, 0, -2520, 0, 0, 0, -12' + + '60; 0, 0, 0, -2520, 0, 0, -840; 0, 0, 0, 0, -13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, ' + + '0, 0, 0, 0, 0, -12012], [0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; ' + + '0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 1, 0' + + ', 0, 0, 0, 0, 0; 0, 1, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0, 0; 0, 0, 0, 1, 0, 0, 0; 0, 0, 0,' + + ' 0, 1, 0, 0; 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 1]]') + + def test_linear(self): + # HEAP=[98, if(pari.precision(1.)==38,10174,10354)]; + + self.assertEquals(pari.matadjoint("[1,2;3,4]"), '[4,-2;-3,1]') + + self.assertEquals(pari.matcompanion('x^5-12*x^3+0.0005'), + '[0,0,0,0,-0.00050000000000000000000000000000000000000;1,0,0,0,0;0,1,0,0,0;0,0,1,0' + + ',12;0,0,0,1,0]') + self.assertEquals(pari.matdet('[1,2,3;1,5,6;9,8,7]'), '-30') + self.assertEquals(pari.matdet('[1,2,3;1,5,6;9,8,7]',1), '-30') + self.assertEquals(pari.matdetint('[1,2,3;4,5,6]'), '3') + self.assertEquals(pari.matdiagonal('[2,4,6]'), '[2,0,0;0,4,0;0,0,6]') + self.assertEquals(str(pari.mateigen('[1,2,3;4,5,6;7,8,9]', precision=128)), + '[1, -1.2833494518006402717978106547571267252, 0.2833494518006402717978' + + '1065475712672521; -2, -0.14167472590032013589890532737856336261, 0.6416' + + '7472590032013589890532737856336260; 1, 1, 1]') + self.assertEquals(pari.mathess(pari.mathilbert(7)), + '[1, 90281/58800, -1919947/4344340, 4858466341/1095033030, -77651417539/8196787326, 33868' + + '88964/106615355, 1/2; 1/3, 43/48, 38789/5585580, 268214641/109503303, -581330123627/1264' + + '64718744, 4365450643/274153770, 1/4; 0, 217/2880, 442223/7447440, 53953931/292008808, -3' + + '2242849453/168619624992, 1475457901/1827691800, 1/80; 0, 0, 1604444/264539275, 24208141/' + + '149362505292, 847880210129/47916076768560, -4544407141/103873817300, -29/40920; 0, 0, 0,' + + ' 9773092581/35395807550620, -24363634138919/107305824577186620, 72118203606917/604813510' + + '61158500, 55899/3088554700; 0, 0, 0, 0, 67201501179065/8543442888354179988, -99705564266' + + '29/740828619992676600, -3229/13661312210; 0, 0, 0, 0, 0, -258198800769/9279048099409000,' + + ' -13183/38381527800]') + + self.assertEquals(pari.mathilbert(5), + '[1, 1/2, 1/3, 1/4, 1/5; 1/2, 1/3, 1/4, 1/5, 1/6; 1/3, 1/4, 1/5, 1/6, 1/7; 1/4, 1/5, 1/6,' + + ' 1/7, 1/8; 1/5, 1/6, 1/7, 1/8, 1/9]') + + + self.assertEquals(pari.matid(5), '[1, 0, 0, 0, 0; 0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 0, 0, 0, 0, 1]') + self.assertEquals(pari.matimage('[1,3,5;2,4,6;3,5,7]'), '[1, 3; 2, 4; 3, 5]') + self.assertEquals(pari.matimage('[1,3,5;2,4,6;3,5,7]',1), '[3, 5; 4, 6; 5, 7]') + self.assertEquals(str(pari.matimage('Pi*[1,3,5;2,4,6;3,5,7]')), + '[3.1415926535897932384626433832795028842, 9.4247779607693797153879301498385086526; 6.283' + + '1853071795864769252867665590057684, 12.566370614359172953850573533118011537; 9.424777960' + + '7693797153879301498385086526, 15.707963267948966192313216916397514421]') + self.assertEquals(pari.matimagecompl('[1,3,5;2,4,6;3,5,7]'), 'Vecsmall([3])') + self.assertEquals(pari.matimagecompl('Pi*[1,3,5;2,4,6;3,5,7]'), 'Vecsmall([3])') + self.assertEquals(pari.matindexrank('[1,1,1;1,1,1;1,1,2]'), '[Vecsmall([1, 3]), Vecsmall([1, 3])]') + self.assertEquals(pari.matintersect('[1,2;3,4;5,6]', '[2,3;7,8;8,9]'), '[-1; -1; -1]') + self.assertEquals(pari.matinverseimage('[1,1;2,3;5,7]', '[2,2,6]~'), "[4, -2]~") + self.assertEquals(str(pari.matisdiagonal('[1,0,0;0,5,0;0,0,0]')), '1') + + # self.assertEquals(pari.matker(pari.matrix(4, 4, 'x', 'y', 'x/y')), + # '[-1/2, -1/3, -1/4; 1, 0, 0; 0, 1, 0; 0, 0, 1]') + # + # self.assertEquals(pari.matker(pari.matrix(4, 4, 'x', 'y', pari.sin('x+y'))), + # '[1.0000000000000000000000000000000000000, 1.0806046117362794348018732148859532075; -1.08' + + # '06046117362794348018732148859532075, -0.16770632690571522600486354099847562047; 1, 0; 0,' + + # ' 1]') + # + # self.assertEquals(pari.matker(pari.matrix(4, 4, 'x', 'y', 'x+y'), 1), '[ 1, 2; -2, -3; 1, 0; 0, 1]') + # + # self.assertEquals(pari.matkerint(pari.matrix(4, 4, 'x', 'y', 'x*y')), + # '[ 1, -1, -1; 0, -1, 1; 1, 1, 1; -1, 0, -1]') + # + # self.assertEquals(pari.matkerint(pari.matrix(4, 4, 'x', 'y', 'x*y'), 1), + # '[ 1, -1, -1; 0, -1, 1; 1, 1, 1; -1, 0, -1]') + # + # self.assertEquals(pari.matkerint(pari.matrix(4, 6, 'x', 'y', '2520/(x+y)')), + # '[ -3, -1; 30, 15; -70, -70; 0, 140; 126, -126; -84, 42]') + amat = 1 / pari.mathilbert(7) + self.assertEquals(pari.matmuldiagonal(amat, [1, 2, 3, 4, 5, 6, 7]), + '[49, -2352, 26460, -117600, 242550, -232848, 84084; -1176, 75264, -952560, 4515840, -970' + + '2000, 9580032, -3531528; 8820, -635040, 8573040, -42336000, 93555000, -94303440, 3531528' + + '0; -29400, 2257920, -31752000, 161280000, -363825000, 372556800, -141261120; 48510, -388' + + '0800, 56133000, -291060000, 667012500, -691558560, 264864600; -38808, 3193344, -47151720' + + ', 248371200, -576298800, 603542016, -233080848; 12012, -1009008, 15135120, -80720640, 18' + + '9189000, -199783584, 77693616]') + # self.assertEquals(pari.matmultodiagonal(pow(amat, -1), '%'), + # '[1, 0, 0, 0, 0, 0, 0; 0, 2, 0, 0, 0, 0, 0; 0, 0, 3, 0, 0, 0, 0; 0, 0, 0, 4, 0, 0, 0; 0, ' + + # '0, 0, 0, 5, 0, 0; 0, 0, 0, 0, 0, 6, 0; 0, 0, 0, 0, 0, 0, 7]') + self.assertEquals(pari.matpascal(8), + '[1, 0, 0, 0, 0, 0, 0, 0, 0; 1, 1, 0, 0, 0, 0, 0, 0, 0; 1, 2, 1, 0, 0, 0, 0, 0, 0; 1, 3, ' + + '3, 1, 0, 0, 0, 0, 0; 1, 4, 6, 4, 1, 0, 0, 0, 0; 1, 5, 10, 10, 5, 1, 0, 0, 0; 1, 6, 15, 2' + + '0, 15, 6, 1, 0, 0; 1, 7, 21, 35, 35, 21, 7, 1, 0; 1, 8, 28, 56, 70, 56, 28, 8, 1]') + # self.assertEquals(pari.matrank(pari.matrix(5,5,x,y,x+y)) + # self.assertEquals(pari.matrix(5,5,x,y,pari.gcd(x,y)) + # self.assertEquals(pari.matrixqz([1,3;3,5;5,7],0) + # self.assertEquals(pari.matrixqz([1/3,1/4,1/6;1/2,1/4,-1/4;1/3,1,0],-1) + # self.assertEquals(pari.matrixqz([1,3;3,5;5,7],-2) + self.assertEquals(pari.matsize('[1,2;3,4;5,6]'), '[3, 2]') + self.assertEquals(pari.matsnf(1/pari.mathilbert(6)), '[27720, 2520, 2520, 840, 210, 6]') + self.assertEquals(pari.matsnf('x*matid(5)-matrix(5,5,j,k,1)', 2), '[x^2 - 5*x, x, x, x, 1]') + self.assertEquals(pari.matsolve(pari.mathilbert(10), '[1,2,3,4,5,6,7,8,9,0]~'), + '[9236800, -831303990, 18288515520, -170691240720, 832112321040, -2329894066500, 38831' + + '23564320, -3803844432960, 2020775945760, -449057772020]~') + self.assertEquals(pari.matsolvemod('[2,3;5,4]', '[7,11]~', '[1,4]~'), '[-5, -1]~') + self.assertEquals(pari.matsolvemod('[2,3;5,4]', '[7,11]~', '[1,4]~', 1), '[[-5, -1]~, [4, 9; -5, 8]]') + self.assertEquals(pari.matsupplement('[1,3;2,4;3,6]'), '[1, 3, 0; 2, 4, 0; 3, 6, 1]') + # self.assertEquals(pari.mattranspose(pari.vector(2, 'x', 'x')), '[1, 2]~') + # + # self.assertEquals(pari.norml2(pari.vector(10,'x','x')), '385') + self.assertEquals(pari.qfgaussred(pari.mathilbert(5)), + '[1, 1/2, 1/3, 1/4, 1/5; 0, 1/12, 1, 9/10, 4/5; 0, 0, 1/180, 3/2, 12/7; 0, 0, 0, 1/2800, ' + + '2; 0, 0, 0, 0, 1/44100]') + self.assertEquals(str(pari.qfjacobi(pari.mathilbert(6), precision=128)), + '[[1.0827994845655497685388772372251778091 E-7, 1.2570757122625194922982397996498755378 E' + + '-5, 0.00061574835418265769764919938428527140434, 0.0163215213198758221243450795641915058' + + '90, 0.24236087057520955213572841585070114077, 1.6188998589243390969705881471257800713]~,' + + ' [-0.0012481940840821751169398163046387836342, 0.011144320930724710530678340374220998345' + + ', -0.062226588150197681775152126611810492941, 0.24032536934252330399154228873240534569, ' + + '-0.61454482829258676899320019644273870646, 0.74871921887909485900280109200517845109; 0.0' + + '35606642944287635266122848131812051370, -0.17973275724076003758776897803740640779, 0.490' + + '83920971092436297498316169060045043, -0.69765137527737012296208335046678265583, 0.211082' + + '48167867048675227675845247769095, 0.44071750324351206127160083580231701802; -0.240679079' + + '58842295837736719558855680218, 0.60421220675295973004426567844103061740, -0.535476921621' + + '07486593474491750949545605, -0.23138937333290388042251363554209048307, 0.365893607303026' + + '14149086554211117169623, 0.32069686982225190106359024326699463107; 0.6254603865492272445' + + '7753441039459331707, -0.44357471627623954554460416705180104473, -0.417037692218978868404' + + '94514780771076351, 0.13286315850933553530333839628101576048, 0.3947067760950175678309463' + + '6145991581709, 0.25431138634047419251788312792590944672; -0.6898071992938366841980173800' + + '6926828754, -0.44153664101228966222143649752977204448, 0.0470340189331156497056145184665' + + '41245344, 0.36271492146487147525299457604461742112, 0.3881904338738864286311144882599241' + + '8974, 0.21153084007896524664213667673977991960; 0.27160545336631286930015536176213646338' + + ', 0.45911481681642960284551392793050867151, 0.54068156310385293880022293448123781988, 0.' + + '50276286675751538489260566368647786274, 0.37069590776736280861775501084807394603, 0.1814' + + '4297664876947372217005457727093716]]') + + self.assertEquals(pari.qfminim('[2,1;1,2]', 4, 6), '[6, 2, [0, 1, 1; 1, -1, 0]]') + self.assertEquals(pari.qfperfection('[2,0,1;0,2,1;1,1,2]'), '6') + self.assertEquals(pari.qfsign(pari.mathilbert(5) - 0.11 * pari.matid(5)), '[2, 3]') + self.assertEquals(pari.trace('1+I'), '2') + self.assertEquals(pari.trace(pari.Mod('x+5','x^3+x+1')), '15') + self.assertEquals(pari.Vec(pari.sin('x')), + '[1, 0, -1/6, 0, 1/120, 0, -1/5040, 0, 1/362880, 0, -1/39916800, 0, 1/6227020800, 0, -1/1' + + '307674368000, 0]') + self.assertEquals(pari('[-3,7,-2,11]').vecmax(), '11') + self.assertEquals(pari('[-3,7,-2,11]').vecmin(), '-3') + self.assertEquals(pari.concat([1, 2], [3, 4]), '[1, 2, 3, 4]') + # self.assertEquals(pari.concat(pari.Mat(pari.vector(4,x,x)~),pari.vector(4,x,10+x)~) + self.assertEquals(pari.vecextract([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 1000), '[4, 6, 7, 8, 9, 10]') + # self.assertEquals(pari.vecextract(pari.matrix(15,15,x,y,x+y),pari.vector(5,x,3*x),pari.vector(3,y,3*y)) + # round((1.*pari.mathilbert(7))^(-1) << 77) / 2^77 + self.assertEquals(pari.vecsort([8, 7, 6, 5], None, 1), 'Vecsmall([4, 3, 2, 1])') + self.assertEquals(pari.vecsort([[1, 5], [2, 4], [1, 5, 1], [1, 4, 2]]), + '[[1, 4, 2], [1, 5], [1, 5, 1], [2, 4]]') + # self.assertEquals(pari.vecsort(pari.vector(17,x,5*x%17)) + self.assertEquals(pari.vecsort([[1, 8, 5], [2, 5, 8], [3, 6, -6], [4, 8, 6]], 2), + '[[2, 5, 8], [3, 6, -6], [1, 8, 5], [4, 8, 6]]') + self.assertEquals(pari.vecsort([[1, 8, 5], [2, 5, 8], [3, 6, -6], [4, 8, 6]], [2, 1]), + '[[2, 5, 8], [3, 6, -6], [1, 8, 5], [4, 8, 6]]') + # self.assertEquals(pari.vector(10,x,1/x) + # if (pari.getheap()!=HEAP, pari.getheap()) + +"""**** Original expected results **** + + echo = 1 (on) +? algdep(2*cos(2*Pi/13),6) +x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1 +? algdep(2*cos(2*Pi/13),6,15) +x^6 + x^5 - 5*x^4 - 4*x^3 + 6*x^2 + 3*x - 1 +? charpoly([1,2;3,4],z) +z^2 - 5*z - 2 +? charpoly(Mod(x^2+x+1,x^3+5*x+1),z) +z^3 + 7*z^2 + 16*z - 19 +? charpoly([1,2;3,4],z,1) +z^2 - 5*z - 2 +? charpoly(Mod(1,8191)*[1,2;3,4],z,2) +z^2 + Mod(8186, 8191)*z + Mod(8189, 8191) +? lindep(Mod(1,7)*[2,-1;1,3]) +[-3, 1]~ +? lindep([(1-3*sqrt(2))/(3-2*sqrt(3)),1,sqrt(2),sqrt(3),sqrt(6)]) +[3, 3, -9, 2, -6]~ +? lindep([(1-3*sqrt(2))/(3-2*sqrt(3)),1,sqrt(2),sqrt(3),sqrt(6)],14) +[-3, -3, 9, -2, 6]~ +? matadjoint([1,2;3,4]) + +[ 4 -2] + +[-3 1] + +? matcompanion(x^5-12*x^3+0.0005) + +[0 0 0 0 -0.00050000000000000000000000000000000000000] + +[1 0 0 0 0] + +[0 1 0 0 0] + +[0 0 1 0 12] + +[0 0 0 1 0] + +? matdet([1,2,3;1,5,6;9,8,7]) +-30 +? matdet([1,2,3;1,5,6;9,8,7],1) +-30 +? matdetint([1,2,3;4,5,6]) +3 +? matdiagonal([2,4,6]) + +[2 0 0] + +[0 4 0] + +[0 0 6] + +? mateigen([1,2,3;4,5,6;7,8,9]) + +[1 -1.2833494518006402717978106547571267252 0.283349451800640271797810654757 +12672521] + +[-2 -0.14167472590032013589890532737856336261 0.6416747259003201358989053273 +7856336260] + +[1 1 1] + +? mathess(mathilbert(7)) + +[1 90281/58800 -1919947/4344340 4858466341/1095033030 -77651417539/819678732 +6 3386888964/106615355 1/2] + +[1/3 43/48 38789/5585580 268214641/109503303 -581330123627/126464718744 4365 +450643/274153770 1/4] + +[0 217/2880 442223/7447440 53953931/292008808 -32242849453/168619624992 1475 +457901/1827691800 1/80] + +[0 0 1604444/264539275 24208141/149362505292 847880210129/47916076768560 -45 +44407141/103873817300 -29/40920] + +[0 0 0 9773092581/35395807550620 -24363634138919/107305824577186620 72118203 +606917/60481351061158500 55899/3088554700] + +[0 0 0 0 67201501179065/8543442888354179988 -9970556426629/74082861999267660 +0 -3229/13661312210] + +[0 0 0 0 0 -258198800769/9279048099409000 -13183/38381527800] + +? mathilbert(5) + +[ 1 1/2 1/3 1/4 1/5] + +[1/2 1/3 1/4 1/5 1/6] + +[1/3 1/4 1/5 1/6 1/7] + +[1/4 1/5 1/6 1/7 1/8] + +[1/5 1/6 1/7 1/8 1/9] + +? amat=1/mathilbert(7) + +[ 49 -1176 8820 -29400 48510 -38808 12012] + +[ -1176 37632 -317520 1128960 -1940400 1596672 -504504] + +[ 8820 -317520 2857680 -10584000 18711000 -15717240 5045040] + +[-29400 1128960 -10584000 40320000 -72765000 62092800 -20180160] + +[ 48510 -1940400 18711000 -72765000 133402500 -115259760 37837800] + +[-38808 1596672 -15717240 62092800 -115259760 100590336 -33297264] + +[ 12012 -504504 5045040 -20180160 37837800 -33297264 11099088] + +? mathnf(amat) + +[420 0 0 0 210 168 175] + +[ 0 840 0 0 0 0 504] + +[ 0 0 2520 0 0 0 1260] + +[ 0 0 0 2520 0 0 840] + +[ 0 0 0 0 13860 0 6930] + +[ 0 0 0 0 0 5544 0] + +[ 0 0 0 0 0 0 12012] + +? mathnf(amat,1) +[[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, + 1260; 0, 0, 0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, +5544, 0; 0, 0, 0, 0, 0, 0, 12012], [420, 420, 840, 630, 2982, 1092, 4159; 21 +0, 280, 630, 504, 2415, 876, 3395; 140, 210, 504, 420, 2050, 749, 2901; 105, + 168, 420, 360, 1785, 658, 2542; 84, 140, 360, 315, 1582, 588, 2266; 70, 120 +, 315, 280, 1421, 532, 2046; 60, 105, 280, 252, 1290, 486, 1866]] +? mathnf(amat,4) +[[420, 0, 0, 0, 210, 168, 175; 0, 840, 0, 0, 0, 0, 504; 0, 0, 2520, 0, 0, 0, + 1260; 0, 0, 0, 2520, 0, 0, 840; 0, 0, 0, 0, 13860, 0, 6930; 0, 0, 0, 0, 0, +5544, 0; 0, 0, 0, 0, 0, 0, 12012], [420, 420, 840, 630, 2982, 1092, 4159; 21 +0, 280, 630, 504, 2415, 876, 3395; 140, 210, 504, 420, 2050, 749, 2901; 105, + 168, 420, 360, 1785, 658, 2542; 84, 140, 360, 315, 1582, 588, 2266; 70, 120 +, 315, 280, 1421, 532, 2046; 60, 105, 280, 252, 1290, 486, 1866]] +? mathnf(amat,5) +[[360360, 0, 0, 0, 0, 144144, 300300; 0, 27720, 0, 0, 0, 0, 22176; 0, 0, 277 +20, 0, 0, 0, 6930; 0, 0, 0, 2520, 0, 0, 840; 0, 0, 0, 0, 2520, 0, 1260; 0, 0 +, 0, 0, 0, 168, 0; 0, 0, 0, 0, 0, 0, 7], [51480, 4620, 5544, 630, 840, 20676 +, 48619; 45045, 3960, 4620, 504, 630, 18074, 42347; 40040, 3465, 3960, 420, +504, 16058, 37523; 36036, 3080, 3465, 360, 420, 14448, 33692; 32760, 2772, 3 +080, 315, 360, 13132, 30574; 30030, 2520, 2772, 280, 315, 12036, 27986; 2772 +0, 2310, 2520, 252, 280, 11109, 25803], Vecsmall([7, 6, 5, 4, 3, 2, 1])] +? mathnfmod(amat,matdetint(amat)) + +[420 0 0 0 210 168 175] + +[ 0 840 0 0 0 0 504] + +[ 0 0 2520 0 0 0 1260] + +[ 0 0 0 2520 0 0 840] + +[ 0 0 0 0 13860 0 6930] + +[ 0 0 0 0 0 5544 0] + +[ 0 0 0 0 0 0 12012] + +? mathnfmodid(amat,123456789*10^100) + +[60 0 0 0 30 24 35] + +[ 0 120 0 0 0 0 24] + +[ 0 0 360 0 0 0 180] + +[ 0 0 0 360 0 0 240] + +[ 0 0 0 0 180 0 90] + +[ 0 0 0 0 0 72 0] + +[ 0 0 0 0 0 0 12] + +? matid(5) + +[1 0 0 0 0] + +[0 1 0 0 0] + +[0 0 1 0 0] + +[0 0 0 1 0] + +[0 0 0 0 1] + +? matimage([1,3,5;2,4,6;3,5,7]) + +[1 3] + +[2 4] + +[3 5] + +? matimage([1,3,5;2,4,6;3,5,7],1) + +[3 5] + +[4 6] + +[5 7] + +? matimage(Pi*[1,3,5;2,4,6;3,5,7]) + +[3.1415926535897932384626433832795028842 9.424777960769379715387930149838508 +6526] + +[6.2831853071795864769252867665590057684 12.56637061435917295385057353311801 +1537] + +[9.4247779607693797153879301498385086526 15.70796326794896619231321691639751 +4421] + +? matimagecompl([1,3,5;2,4,6;3,5,7]) +Vecsmall([3]) +? matimagecompl(Pi*[1,3,5;2,4,6;3,5,7]) +Vecsmall([3]) +? matindexrank([1,1,1;1,1,1;1,1,2]) +[Vecsmall([1, 3]), Vecsmall([1, 3])] +? matintersect([1,2;3,4;5,6],[2,3;7,8;8,9]) + +[-1] + +[-1] + +[-1] + +? matinverseimage([1,1;2,3;5,7],[2,2,6]~) +[4, -2]~ +? matisdiagonal([1,0,0;0,5,0;0,0,0]) +1 +? matker(matrix(4,4,x,y,x/y)) + +[-1/2 -1/3 -1/4] + +[ 1 0 0] + +[ 0 1 0] + +[ 0 0 1] + +? matker(matrix(4,4,x,y,sin(x+y))) + +[1.0000000000000000000000000000000000000 1.080604611736279434801873214885953 +2075] + +[-1.0806046117362794348018732148859532075 -0.1677063269057152260048635409984 +7562047] + +[1 0] + +[0 1] + +? matker(matrix(4,4,x,y,x+y),1) + +[ 1 2] + +[-2 -3] + +[ 1 0] + +[ 0 1] + +? matkerint(matrix(4,4,x,y,x*y)) + +[ 1 -1 -1] + +[ 0 -1 1] + +[ 1 1 1] + +[-1 0 -1] + +? matkerint(matrix(4,4,x,y,x*y),1) + +[ 1 -1 -1] + +[ 0 -1 1] + +[ 1 1 1] + +[-1 0 -1] + +? matkerint(matrix(4,6,x,y,2520/(x+y))) + +[ -3 -1] + +[ 30 15] + +[-70 -70] + +[ 0 140] + +[126 -126] + +[-84 42] + +? matmuldiagonal(amat,[1,2,3,4,5,6,7]) + +[ 49 -2352 26460 -117600 242550 -232848 84084] + +[ -1176 75264 -952560 4515840 -9702000 9580032 -3531528] + +[ 8820 -635040 8573040 -42336000 93555000 -94303440 35315280] + +[-29400 2257920 -31752000 161280000 -363825000 372556800 -141261120] + +[ 48510 -3880800 56133000 -291060000 667012500 -691558560 264864600] + +[-38808 3193344 -47151720 248371200 -576298800 603542016 -233080848] + +[ 12012 -1009008 15135120 -80720640 189189000 -199783584 77693616] + +? matmultodiagonal(amat^-1,%) + +[1 0 0 0 0 0 0] + +[0 2 0 0 0 0 0] + +[0 0 3 0 0 0 0] + +[0 0 0 4 0 0 0] + +[0 0 0 0 5 0 0] + +[0 0 0 0 0 6 0] + +[0 0 0 0 0 0 7] + +? matpascal(8) + +[1 0 0 0 0 0 0 0 0] + +[1 1 0 0 0 0 0 0 0] + +[1 2 1 0 0 0 0 0 0] + +[1 3 3 1 0 0 0 0 0] + +[1 4 6 4 1 0 0 0 0] + +[1 5 10 10 5 1 0 0 0] + +[1 6 15 20 15 6 1 0 0] + +[1 7 21 35 35 21 7 1 0] + +[1 8 28 56 70 56 28 8 1] + +? matrank(matrix(5,5,x,y,x+y)) +2 +? matrix(5,5,x,y,gcd(x,y)) + +[1 1 1 1 1] + +[1 2 1 2 1] + +[1 1 3 1 1] + +[1 2 1 4 1] + +[1 1 1 1 5] + +? matrixqz([1,3;3,5;5,7],0) + +[1 1] + +[3 2] + +[5 3] + +? matrixqz([1/3,1/4,1/6;1/2,1/4,-1/4;1/3,1,0],-1) + +[19 12 2] + +[ 0 1 0] + +[ 0 0 1] + +? matrixqz([1,3;3,5;5,7],-2) + +[2 -1] + +[1 0] + +[0 1] + +? matsize([1,2;3,4;5,6]) +[3, 2] +? matsnf(1/mathilbert(6)) +[27720, 2520, 2520, 840, 210, 6] +? matsnf(x*matid(5)-matrix(5,5,j,k,1),2) +[x^2 - 5*x, x, x, x, 1] +? matsolve(mathilbert(10),[1,2,3,4,5,6,7,8,9,0]~) +[9236800, -831303990, 18288515520, -170691240720, 832112321040, -23298940665 +00, 3883123564320, -3803844432960, 2020775945760, -449057772020]~ +? matsolvemod([2,3;5,4],[7,11]~,[1,4]~) +[-5, -1]~ +? matsolvemod([2,3;5,4],[7,11]~,[1,4]~,1) +[[-5, -1]~, [4, 9; -5, 8]] +? matsupplement([1,3;2,4;3,6]) + +[1 3 0] + +[2 4 0] + +[3 6 1] + +? mattranspose(vector(2,x,x)) +[1, 2]~ +? %*%~ + +[1 2] + +[2 4] + +? norml2(vector(10,x,x)) +385 +? qfgaussred(mathilbert(5)) + +[1 1/2 1/3 1/4 1/5] + +[0 1/12 1 9/10 4/5] + +[0 0 1/180 3/2 12/7] + +[0 0 0 1/2800 2] + +[0 0 0 0 1/44100] + +? qfjacobi(mathilbert(6)) +[[1.0827994845655497685388772372251778091 E-7, 1.257075712262519492298239799 +6498755378 E-5, 0.00061574835418265769764919938428527140434, 0.0163215213198 +75822124345079564191505890, 0.24236087057520955213572841585070114077, 1.6188 +998589243390969705881471257800713]~, [-0.00124819408408217511693981630463878 +36342, 0.011144320930724710530678340374220998345, -0.06222658815019768177515 +2126611810492941, 0.24032536934252330399154228873240534569, -0.6145448282925 +8676899320019644273870646, 0.74871921887909485900280109200517845109; 0.03560 +6642944287635266122848131812051370, -0.1797327572407600375877689780374064077 +9, 0.49083920971092436297498316169060045043, -0.6976513752773701229620833504 +6678265583, 0.21108248167867048675227675845247769095, 0.44071750324351206127 +160083580231701802; -0.24067907958842295837736719558855680218, 0.60421220675 +295973004426567844103061740, -0.53547692162107486593474491750949545605, -0.2 +3138937333290388042251363554209048307, 0.36589360730302614149086554211117169 +623, 0.32069686982225190106359024326699463107; 0.625460386549227244577534410 +39459331707, -0.44357471627623954554460416705180104473, -0.41703769221897886 +840494514780771076351, 0.13286315850933553530333839628101576048, 0.394706776 +09501756783094636145991581709, 0.25431138634047419251788312792590944672; -0. +68980719929383668419801738006926828754, -0.441536641012289662221436497529772 +04448, 0.047034018933115649705614518466541245344, 0.362714921464871475252994 +57604461742112, 0.38819043387388642863111448825992418974, 0.2115308400789652 +4664213667673977991960; 0.27160545336631286930015536176213646338, 0.45911481 +681642960284551392793050867151, 0.54068156310385293880022293448123781988, 0. +50276286675751538489260566368647786274, 0.3706959077673628086177550108480739 +4603, 0.18144297664876947372217005457727093716]] +? m=1/mathilbert(7) + +[ 49 -1176 8820 -29400 48510 -38808 12012] + +[ -1176 37632 -317520 1128960 -1940400 1596672 -504504] + +[ 8820 -317520 2857680 -10584000 18711000 -15717240 5045040] + +[-29400 1128960 -10584000 40320000 -72765000 62092800 -20180160] + +[ 48510 -1940400 18711000 -72765000 133402500 -115259760 37837800] + +[-38808 1596672 -15717240 62092800 -115259760 100590336 -33297264] + +[ 12012 -504504 5045040 -20180160 37837800 -33297264 11099088] + +? mp=concat(m,matid(7)) + +[49 -1176 8820 -29400 48510 -38808 12012 1 0 0 0 0 0 0] + +[-1176 37632 -317520 1128960 -1940400 1596672 -504504 0 1 0 0 0 0 0] + +[8820 -317520 2857680 -10584000 18711000 -15717240 5045040 0 0 1 0 0 0 0] + +[-29400 1128960 -10584000 40320000 -72765000 62092800 -20180160 0 0 0 1 0 0 +0] + +[48510 -1940400 18711000 -72765000 133402500 -115259760 37837800 0 0 0 0 1 0 + 0] + +[-38808 1596672 -15717240 62092800 -115259760 100590336 -33297264 0 0 0 0 0 +1 0] + +[12012 -504504 5045040 -20180160 37837800 -33297264 11099088 0 0 0 0 0 0 1] + +? qflll(m) + +[-420 -420 840 630 -1092 757 2982] + +[-210 -280 630 504 -876 700 2415] + +[-140 -210 504 420 -749 641 2050] + +[-105 -168 420 360 -658 589 1785] + +[ -84 -140 360 315 -588 544 1582] + +[ -70 -120 315 280 -532 505 1421] + +[ -60 -105 280 252 -486 471 1290] + +? qflllgram(m) + +[1 1 27 -27 69 0 141] + +[0 1 4 -23 34 -24 49] + +[0 1 3 -22 18 -24 23] + +[0 1 3 -21 10 -19 13] + +[0 1 3 -20 6 -14 8] + +[0 1 3 -19 4 -10 5] + +[0 1 3 -18 3 -7 3] + +? qflllgram(m,1) + +[1 1 27 -27 69 0 141] + +[0 1 4 -23 34 -24 49] + +[0 1 3 -22 18 -24 23] + +[0 1 3 -21 10 -19 13] + +[0 1 3 -20 6 -14 8] + +[0 1 3 -19 4 -10 5] + +[0 1 3 -18 3 -7 3] + +? qflllgram(mp~*mp,4) +[[-420, -420, 840, 630, 2982, -1092, 757; -210, -280, 630, 504, 2415, -876, +700; -140, -210, 504, 420, 2050, -749, 641; -105, -168, 420, 360, 1785, -658 +, 589; -84, -140, 360, 315, 1582, -588, 544; -70, -120, 315, 280, 1421, -532 +, 505; -60, -105, 280, 252, 1290, -486, 471; 420, 0, 0, 0, -210, 168, 35; 0, + 840, 0, 0, 0, 0, 336; 0, 0, -2520, 0, 0, 0, -1260; 0, 0, 0, -2520, 0, 0, -8 +40; 0, 0, 0, 0, -13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0, 0, 0, 0, 0, - +12012], [0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0 +, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, + 0; 1, 0, 0, 0, 0, 0, 0; 0, 1, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0, 0; 0, 0, 0, +1, 0, 0, 0; 0, 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 1]] +? qflll(m,1) + +[-420 -420 840 630 -1092 757 2982] + +[-210 -280 630 504 -876 700 2415] + +[-140 -210 504 420 -749 641 2050] + +[-105 -168 420 360 -658 589 1785] + +[ -84 -140 360 315 -588 544 1582] + +[ -70 -120 315 280 -532 505 1421] + +[ -60 -105 280 252 -486 471 1290] + +? qflll(m,2) + +[-420 -420 -630 840 1092 2982 -83] + +[-210 -280 -504 630 876 2415 70] + +[-140 -210 -420 504 749 2050 137] + +[-105 -168 -360 420 658 1785 169] + +[ -84 -140 -315 360 588 1582 184] + +[ -70 -120 -280 315 532 1421 190] + +[ -60 -105 -252 280 486 1290 191] + +? qflll(mp,4) +[[-420, -420, 840, 630, 2982, -1092, 757; -210, -280, 630, 504, 2415, -876, +700; -140, -210, 504, 420, 2050, -749, 641; -105, -168, 420, 360, 1785, -658 +, 589; -84, -140, 360, 315, 1582, -588, 544; -70, -120, 315, 280, 1421, -532 +, 505; -60, -105, 280, 252, 1290, -486, 471; 420, 0, 0, 0, -210, 168, 35; 0, + 840, 0, 0, 0, 0, 336; 0, 0, -2520, 0, 0, 0, -1260; 0, 0, 0, -2520, 0, 0, -8 +40; 0, 0, 0, 0, -13860, 0, 6930; 0, 0, 0, 0, 0, 5544, 0; 0, 0, 0, 0, 0, 0, - +12012], [0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0 +, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, + 0; 1, 0, 0, 0, 0, 0, 0; 0, 1, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0, 0; 0, 0, 0, +1, 0, 0, 0; 0, 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 1]] +? qfminim([2,1;1,2],4,6) +[6, 2, [0, 1, 1; 1, -1, 0]] +? qfperfection([2,0,1;0,2,1;1,1,2]) +6 +? qfsign(mathilbert(5)-0.11*matid(5)) +[2, 3] +? trace(1+I) +2 +? trace(Mod(x+5,x^3+x+1)) +15 +? Vec(sin(x)) +[1, 0, -1/6, 0, 1/120, 0, -1/5040, 0, 1/362880, 0, -1/39916800, 0, 1/6227020 +800, 0, -1/1307674368000, 0] +? vecmax([-3,7,-2,11]) +11 +? vecmin([-3,7,-2,11]) +-3 +? concat([1,2],[3,4]) +[1, 2, 3, 4] +? concat(Mat(vector(4,x,x)~),vector(4,x,10+x)~) + +[1 11] + +[2 12] + +[3 13] + +[4 14] + +? vecextract([1,2,3,4,5,6,7,8,9,10],1000) +[4, 6, 7, 8, 9, 10] +? vecextract(matrix(15,15,x,y,x+y),vector(5,x,3*x),vector(3,y,3*y)) + +[ 6 9 12] + +[ 9 12 15] + +[12 15 18] + +[15 18 21] + +[18 21 24] + +? round((1.*mathilbert(7))^(-1)<<77)/2^77 + +[49 -1176 8820 -29400 48510 -38808 12012] + +[-1176 37632 -317520 1128960 -1940400 1596672 -504504] + +[8820 -317520 2857680 -10584000 18711000 -15717240 5045040] + +[-29400 1128960 -10584000 6092986130857731040519127040001/151115727451828646 +838272 -10995935908032311487186862080001/151115727451828646838272 9383198641 +520905802399455641601/151115727451828646838272 -20180160] + +[48510 -1940400 18711000 -10995935908032311487186862080001/15111572745182864 +6838272 10079607915696285529921290240001/75557863725914323419136 -8708781239 +161590697851994767361/75557863725914323419136 37837800] + +[-38808 1596672 -15717240 9383198641520905802399455641601/151115727451828646 +838272 -8708781239161590697851994767361/75557863725914323419136 152007817992 +63867399887118139393/151115727451828646838272 -33297264] + +[12012 -504504 5045040 -20180160 37837800 -33297264 11099088] + +? vecsort([8,7,6,5],,1) +Vecsmall([4, 3, 2, 1]) +? vecsort([[1,5],[2,4],[1,5,1],[1,4,2]]) +[[1, 4, 2], [1, 5], [1, 5, 1], [2, 4]] +? vecsort(vector(17,x,5*x%17)) +[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] +? vecsort([[1,8,5],[2,5,8],[3,6,-6],[4,8,6]],2) +[[2, 5, 8], [3, 6, -6], [1, 8, 5], [4, 8, 6]] +? vecsort([[1,8,5],[2,5,8],[3,6,-6],[4,8,6]],[2,1]) +[[2, 5, 8], [3, 6, -6], [1, 8, 5], [4, 8, 6]] +? vector(10,x,1/x) +[1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10] +? if(getheap()!=HEAP,getheap()) + +""" diff --git a/tests/unittests/list.py b/tests/unittests/list.py new file mode 100644 index 0000000..57ea6d1 --- /dev/null +++ b/tests/unittests/list.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file list : +L = List(); +for (i=1,10^5,listput(L,i)) +L = List([1,2,3]); +for (i=1,5000,listinsert(L,i,3)) +L = List([1,2,3,3]); +concat(L,5) +concat(1,L) +L = concat(L,L) +listsort(L); L +listsort(L,1); L +listpop(L); L +listpop(L,1); L +\\ +L = List([[1,2,3], 2]) +L[1][1] = 3 +L +L = List([Vecsmall([1,2,3]), 2]) +L[1][1] = 3 + +L = List(); listput(L,1); listpop(L); listpop(L); + +matdiagonal(List([0])) +g(L)=for(i=1,5,listput(L,5-i));L; +l=List([10,9,8,7,6,5]); g(l) +l +listkill(l) +listcreate() + +subst(List([x,x^2+y]),x,1) +substvec(List([x,y]), [x,y], [y,x]) +substpol(List([x^2,x^3]), x^2, y) + +getheap()[1] + +chinese(List()) +chinese(List([Mod(1,3)])) +chinese(List([Mod(0,2),Mod(1,3),Mod(2,5)])) +liftint(List([0,1])) + +L = List([1,2,3]); +L[1] +L[1]*=2 +L +L[1]=3 +L +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestList(unittest.TestCase): + def test_list(self): + L = pari.List(); + + for i in range(1, int(pow(10, 5) + 1)): + pari.listput(L, i) + + L = pari.List([1, 2, 3]); + for i in range(1, 5000): + pari.listinsert(L, i, 3) + + L = pari.List([1, 2, 3, 3]); + self.assertEquals(pari.concat(L, 5), 'List([1, 2, 3, 3, 5])') + self.assertEquals(pari.concat(1, L), 'List([1, 1, 2, 3, 3])') + L = pari.concat(L, L) + self.assertEquals(L, 'List([1, 2, 3, 3, 1, 2, 3, 3])') + pari.listsort(L); + self.assertEquals(L, 'List([1, 1, 2, 2, 3, 3, 3, 3])') + pari.listsort(L, 1); + self.assertEquals(L,'List([1, 2, 3])') + pari.listpop(L); + self.assertEquals(L, 'List([1, 2])') + pari.listpop(L, 1); + self.assertEquals(L, 'List([2])') + + L = pari.List([[1,2,3], 2]) + # L[0][0] = 3 + # self.assertEquals(L, 'List([[3, 2, 3], 2])') + L = pari.List([pari.Vecsmall([1,2,3]), 2]) + self.assertEquals(L, 'List([Vecsmall([1, 2, 3]), 2])') + + L = pari.List(); + pari.listput(L, 1); + pari.listpop(L); + pari.listpop(L); + + # self.assertEquals(pari.matdiagonal(pari.List([0])), '[List([0])]') + def g(L): + res = pari.List(L) + for i in range(1, 6): + pari.listput(res, 5-i) + return res + + l = pari.List([10, 9, 8, 7, 6, 5]); + self.assertEquals(g(l), 'List([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0])') + self.assertEquals(l, 'List([10, 9, 8, 7, 6, 5])') + pari.listkill(l) + self.assertEquals(pari.List(), 'List([])') + + self.assertEquals(pari.subst(pari.List(['x', 'x^2+y']), 'x', 1), 'List([1, y + 1])') + self.assertEquals(pari.substvec(pari.List(['x', 'y']), ['x', 'y'], ['y', 'x']), 'List([y, x])') + self.assertEquals(pari.substpol(pari.List(['x^2', 'x^3']), 'x^2', 'y'), 'List([y, y*x])') + + self.assertEquals(pari.chinese(pari.List()), 'Mod(0, 1)') + self.assertEquals(pari.chinese(pari.List([pari.Mod(1, 3)])), 'Mod(1, 3)') + self.assertEquals(pari.chinese(pari.List([pari.Mod(0, 2), pari.Mod(1, 3), pari.Mod(2, 5)])), 'Mod(22, 30)') + self.assertEquals(pari.liftint(pari.List([0, 1])), 'List([0, 1])') + + L = pari.List([1, 2, 3]); + self.assertEquals(L[0], '1') + # L[1]*=2 + # L + # L[1]=3 + # L + +"""**** Original expected results **** + +List([1, 2, 3, 3, 5]) +List([1, 1, 2, 3, 3]) +List([1, 2, 3, 3, 1, 2, 3, 3]) +List([1, 1, 2, 2, 3, 3, 3, 3]) +List([1, 2, 3]) +List([1, 2]) +List([2]) +List([[1, 2, 3], 2]) +3 +List([[3, 2, 3], 2]) +List([Vecsmall([1, 2, 3]), 2]) +3 + +[List([0])] + +List([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) +List([10, 9, 8, 7, 6, 5]) +List([]) +List([1, y + 1]) +List([y, x]) +List([y, y*x]) +127 +Mod(0, 1) +Mod(1, 3) +Mod(22, 30) +List([0, 1]) +1 +2 +List([2, 2, 3]) +3 +List([3, 2, 3]) + +""" diff --git a/tests/unittests/log.py b/tests/unittests/log.py new file mode 100644 index 0000000..d8bbbde --- /dev/null +++ b/tests/unittests/log.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file log : +default(realprecision,38); +log(1+10^-30) +lngamma(1+10^-30) +lngamma(10^-30) +iferr(log(2+O(33)),E,E) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestLog(unittest.TestCase): + def test_log(self): + oldprec = pari.set_real_precision(38) + + self.assertEquals(str(pari.log('1+10^-30', precision=128)), '9.9999999999999999999999999999950000000 E-31') + self.assertEquals(str(pari.lngamma('1+10^-30', precision=128)), '-5.7721566490153286060651209008157996401 E-31') + self.assertEquals(str(pari.lngamma('10^-30', precision=128)), '69.077552789821370520539743640530349012') + with self.assertRaises(PariError) as context: + pari.log('2+O(33)', precision=128) + self.assertTrue('not a prime number in p-adic log: 33' in str(context.exception)) + + pari.set_real_precision(oldprec) + +"""**** Original expected results **** + +9.9999999999999999999999999999950000000 E-31 +-5.7721566490153286060651209008157996401 E-31 +69.077552789821370520539743640530349012 +error("not a prime number in p-adic log: 33.") + +""" diff --git a/tests/unittests/mathnf.py b/tests/unittests/mathnf.py new file mode 100644 index 0000000..a19ceb9 --- /dev/null +++ b/tests/unittests/mathnf.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file mathnf : +\e +mathnf([0,2]) +mathnf([0,2], 1) +mathnf([0,x]) +mathnf([0,x], 1) +mathnf([x,x^2+1; x^3+x+1, x+2]*Mod(1,5)) +v=[116085838, 181081878, 314252913,10346840]; +[H,U]=mathnf(v, 1); [v*U, norml2(U)] +[H,U]=mathnf(v, 5); [v*U, norml2(U)] +mathnf([]) +mathnf([],1) +mathnf([;]) +mathnf([;],1) +mathnfmodid(matrix(0,2), []) +mathnfmodid([0,7;-1,0;-1,-1], [6,2,2]) + +matsolvemod([;],[]~,[]~,1) +matsolvemod([;],[],[]~,1) +matsolvemod([;],[]~,[],1) +matsolvemod([;],1,1,1) +matsolvemod([1,2;3,4],1,2,1) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestMathnf(unittest.TestCase): + def test_mathnf(self): + self.assertEqual(pari.mathnf([0, 2]), 'Mat(2)') + self.assertEqual(pari.mathnf([0, 2], 1), '[Mat(2), [1, 0; 0, 1]]') + self.assertEqual(pari.mathnf([0, 'x']), 'Mat(x)') + self.assertEqual(pari.mathnf([0, 'x'], 1), '[Mat(x), [1, 0; 0, 1]]') + self.assertEqual(str(pari.mathnf('[x,x^2+1; x^3+x+1, x+2]*Mod(1,5)')), + '[Mod(1, 5)*x^5 + Mod(2, 5)*x^3 + Mod(4,' + + ' 5)*x + Mod(1, 5), Mod(4, 5)*x^4 + Mod(2, 5)*x^3 + Mod(4, 5)*x^2 + Mod(3, 5)*x; 0, 1]') + v = [116085838, 181081878, 314252913, 10346840]; + U = pari.mathnf(v, 1)[1]; + self.assertEqual(pari.norml2(U), '2833319') + U = pari.mathnf(v, 5)[1]; + self.assertEqual(pari.norml2(U), '765585180708864230567243002686057927228240493') + self.assertEqual(pari.mathnf('[]'), '[;]') + self.assertEqual(pari.mathnf('[]', 1), '[[;], [;]]') + self.assertEqual(pari.mathnf('[;]'), '[;]') + self.assertEqual(pari.mathnf('[;]', 1), '[[;], [;]]') + + def test_mathnfmodid(self): + self.assertEqual(pari.mathnfmodid('[;]', '[]'), '[;]') + self.assertEqual(pari.mathnfmodid('[0,7;-1,0;-1,-1]', [6, 2, 2]), '[2, 1, 1; 0, 1, 0; 0, 0, 1]') + + def test_matsolvemod(self): + self.assertEqual(pari.matsolvemod('[;]', '[]~', '[]~', 1), '0') + with self.assertRaises(PariError) as context: + pari.matsolvemod('[;]', '[]', '[]~', 1) + self.assertTrue('incorrect type in gaussmodulo (t_VEC)' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.matsolvemod('[;]', '[]~', '[]', 1) + self.assertTrue('incorrect type in gaussmodulo (t_VEC)' in str(context.exception)) + self.assertEqual(pari.matsolvemod('[;]', 1, 1, 1), '0') + self.assertEqual(pari.matsolvemod('[1,2;3,4]', 1, 2, 1), '[[0, 0]~, [-1, 0; 0, 1]]') + +"""**** Original expected results **** + + echo = 1 (on) +? mathnf([0,2]) + +[2] + +? mathnf([0,2],1) +[Mat(2), [1, 0; 0, 1]] +? mathnf([0,x]) + +[x] + +? mathnf([0,x],1) +[Mat(x), [1, 0; 0, 1]] +? mathnf([x,x^2+1;x^3+x+1,x+2]*Mod(1,5)) + +[Mod(1, 5)*x^5 + Mod(2, 5)*x^3 + Mod(4, 5)*x + Mod(1, 5) Mod(4, 5)*x^4 + Mod +(2, 5)*x^3 + Mod(4, 5)*x^2 + Mod(3, 5)*x] + +[0 1] + +? v=[116085838,181081878,314252913,10346840]; +? [H,U]=mathnf(v,1);[v*U,norml2(U)] +[[0, 0, 0, 1], 2833319] +? [H,U]=mathnf(v,5);[v*U,norml2(U)] +[[0, 0, 0, 1], 765585180708864230567243002686057927228240493] +? mathnf([]) +[;] +? mathnf([],1) +[[;], [;]] +? mathnf([;]) +[;] +? mathnf([;],1) +[[;], [;]] +? mathnfmodid(matrix(0,2),[]) +[;] +? mathnfmodid([0,7;-1,0;-1,-1],[6,2,2]) + +[2 1 1] + +[0 1 0] + +[0 0 1] + +? matsolvemod([;],[]~,[]~,1) +0 +? matsolvemod([;],[],[]~,1) + *** at top-level: matsolvemod([;],[],[ + *** ^-------------------- + *** matsolvemod: incorrect type in gaussmodulo (t_VEC). +? matsolvemod([;],[]~,[],1) + *** at top-level: matsolvemod([;],[]~, + *** ^-------------------- + *** matsolvemod: incorrect type in gaussmodulo (t_VEC). +? matsolvemod([;],1,1,1) +0 +? matsolvemod([1,2;3,4],1,2,1) +[[0, 0]~, [-1, 0; 0, 1]] + +""" diff --git a/tests/unittests/minim.py b/tests/unittests/minim.py new file mode 100644 index 0000000..77d0517 --- /dev/null +++ b/tests/unittests/minim.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file minim : +{d=[4,2,-2,-2,2,1,-2,2,2; 2,4,-2,0,0,0,-1,0,2; -2,-2,4,2,-2,1,1,-1,-2; +-2,0,2,4,-3,1,0,-2,0; 2,0,-2,-3,4,-1,0,2,0; 1,0,1,1,-1,4,0,-1,1; +-2,-1,1,0,0,0,4,-2,-2; 2,0,-1,-2,2,-1,-2,4,0; 2,2,-2,0,0,1,-2,0,4];} +qfperfection(d) +{d=[4,2,-2,2,2,-2,-1,0;2,4,-2,0,2,-2,1,-1; -2,-2,4,-2,0,2,1,-1; +2,0,-2,4,1,0,-2,0; 2,2,0,1,4,-1,1,-2;-2,-2,2,0,-1,4,-1,-1; +-1,1,1,-2,1,-1,4,0;0,-1,-1,0,-2,-1,0,4];} +qfperfection(d) + +d=[2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;-1,2,1,0,1,1,1,1,1,1,1,1;-1,1,2,1,1,1,1,1, 1,1,1,1;-1,0,1,2,1,1,1,1,1,1,1,1;-1,1,1,1,2,1,1,1,1,1,1,1;-1,1,1,1,1,2,1,1,1,1,1 ,1;-1,1,1,1,1,1,2,1,1,1,1,1;-1,1,1,1,1,1,1,2,1,1,1,1;-1,1,1,1,1,1,1,1,2,1,1,1;-1 ,1,1,1,1,1,1,1,1,2,1,1;-1,1,1,1,1,1,1,1,1,1,2,1;-1,1,1,1,1,1,1,1,1,1,1,2]; +qfperfection(d) + +d=[84,-42,42,-34,49,42,44,-5,42,-42,42,34;-42,84,-42,-8,-44,-42,-47,-20,-22,0,-17,8;42,-42,84,-34,49,42,47,-22,22,-42,22,20;-34,-8,-34,84,3,-34,-31,0,8,34,-5,-42;49,-44,49,3,98,49,49,-27,49,-27,49,-8;42,-42,42,-34,49,84,42,-8,22,-20,24,-8;44,-47,47,-31,49,42,94,20,2,-22,2,25;-5,-20,-22,0,-27,-8,20,84,-42,42,-5,-8;42,-22,22,8,49,22,2,-42,84,-42,42,9;-42,0,-42,34,-27,-20,-22,42,-42,84,-5,-28;42,-17,22,-5,49,24,2,-5,42,-5,84,1;34,8,20,-42,-8,-8,25,-8,9,-28,1,84]; +qfperfection(d) + +d = [11870535336,4926369655,32404766,5833735188,-260286973,1176994945,-938673930,1133212506,-1074526606,-70224083,-516302409,2824815072,-4372545965,-3541960809,-934179491,1051267712;4926369655,11870535336,-1490432686,-875900356,3641011352,-133471097,5248732172,5339909303,1977366972,2112029217,1618397291,1453763043,-5074494971,3402204872,-6089917,-2536340118;32404766,-1490432686,11870535336,123881942,1472835948,538053943,-2072520281,-2111014772,-243328180,66329388,-1668343637,5366171257,-1644082716,1999937160,1862466413,-2684624269;5833735188,-875900356,123881942,11870535336,-4482992193,724356870,-2581885607,-1123344860,-5909559285,-374057682,-1737269060,1373350629,-685882364,-2860185796,1915679243,-2582189975;-260286973,3641011352,1472835948,-4482992193,11870535336,-3382162923,-2727082036,-172926336,3957014148,4123782659,-869026456,-712184755,1975235830,598346444,-803583682,764543726;1176994945,-133471097,538053943,724356870,-3382162923,11870535336,4149099372,-1345152733,3238996158,-1859449765,788927568,627981303,-1997619722,-5100674624,1082079081,-4600113518;-938673930,5248732172,-2072520281,-2581885607,-2727082036,4149099372,11870535336,2778219046,565855490,-4509773947,2630869581,161812815,-2518706476,2620761340,1350174537,-1070307221;1133212506,5339909303,-2111014772,-1123344860,-172926336,-1345152733,2778219046,11870535336,1405373352,-94842121,5935267668,1644886404,-4169157373,1191448802,400673054,-137185759;-1074526606,1977366972,-243328180,-5909559285,3957014148,3238996158,565855490,1405373352,11870535336,-1017421319,-2747041871,-2019274686,1090295757,2591545854,433617674,63706423;-70224083,2112029217,66329388,-374057682,4123782659,-1859449765,-4509773947,-94842121,-1017421319,11870535336,-570490848,1731611845,-2658074571,-1297231573,-350469672,-40728837;-516302409,1618397291,-1668343637,-1737269060,-869026456,788927568,2630869581,5935267668,-2747041871,-570490848,11870535336,2791532769,26571128,-1302311714,1214830887,1283425367;2824815072,1453763043,5366171257,1373350629,-712184755,627981303,161812815,1644886404,-2019274686,1731611845,2791532769,11870535336,-3163139204,110178163,-49759695,-1512817003;-4372545965,-5074494971,-1644082716,-685882364,1975235830,-1997619722,-2518706476,-4169157373,1090295757,-2658074571,26571128,-3163139204,11870535336,-55032693,-2820423865,4651789746;-3541960809,3402204872,1999937160,-2860185796,598346444,-5100674624,2620761340,1191448802,2591545854,-1297231573,-1302311714,110178163,-55032693,11870535336,5683626972,-2169747194;-934179491,-6089917,1862466413,1915679243,-803583682,1082079081,1350174537,400673054,433617674,-350469672,1214830887,-49759695,-2820423865,5683626972,11870535336,-5697137302;1051267712,-2536340118,-2684624269,-2582189975,764543726,-4600113518,-1070307221,-137185759,63706423,-40728837,1283425367,-1512817003,4651789746,-2169747194,-5697137302,11870535336]; +qfperfection(d) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestMinim(unittest.TestCase): + def test_minim(self): + d = ('[4,2,-2,-2,2,1,-2,2,2; 2,4,-2,0,0,0,-1,0,2; -2,-2,4,2,-2,1,1,-1,-2;-2,0,2,4,-3,1,0,-2,0; 2,0,-2,-3' + ',4,-1,0,2,0; 1,0,1,1,-1,4,0,-1,1;-2,-1,1,0,0,0,4,-2,-2; 2,0,-1,-2,2,-1,-2,4,0; 2,2,-2,0,0,1,-2,0,4]'); + self.assertEquals(pari.qfperfection(d), '1') + + d = ('[4,2,-2,2,2,-2,-1,0;2,4,-2,0,2,-2,1,-1; -2,-2,4,-2,0,2,1,-1;' + '2,0,-2,4,1,0,-2,0; 2,2,0,1,4,-1,1,-2;-2,-2,2,0,-1,4,-1,-1;' + '-1,1,1,-2,1,-1,4,0;0,-1,-1,0,-2,-1,0,4]') + self.assertEquals(pari.qfperfection(d), '1') + + d = ('[2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;-1,2,1,0,1,1,1,1,1,1,1,1;-1,1,2,1,1,1,1,1, 1,1,1,1;' + '-1,0,1,2,1,1,1,1,1,1,1,1;-1,1,1,1,2,1,1,1,1,1,1,1;-1,1,1,1,1,2,1,1,1,1,1 ,1;-1,1,1,1,1,' + '1,2,1,1,1,1,1;-1,1,1,1,1,1,1,2,1,1,1,1;-1,1,1,1,1,1,1,1,2,1,1,1;-1 ,1,1,1,1,1,1,1,1,2,1' + ',1;-1,1,1,1,1,1,1,1,1,1,2,1;-1,1,1,1,1,1,1,1,1,1,1,2];') + self.assertEquals(pari.qfperfection(d), '78') + + d = ('[84,-42,42,-34,49,42,44,-5,42,-42,42,34;-42,84,-42,-8,-44,-42,-47,-20,-22,0,-17,8;' + '42,-42,84,-34,49,42,47,-22,22,-42,22,20;-34,-8,-34,84,3,-34,-31,0,8,34,-5,-42;49,-44,' + '49,3,98,49,49,-27,49,-27,49,-8;42,-42,42,-34,49,84,42,-8,22,-20,24,-8;44,-47,47,-31,4' + '9,42,94,20,2,-22,2,25;-5,-20,-22,0,-27,-8,20,84,-42,42,-5,-8;42,-22,22,8,49,22,2,-42,' + '84,-42,42,9;-42,0,-42,34,-27,-20,-22,42,-42,84,-5,-28;42,-17,22,-5,49,24,2,-5,42,-5,8' + '4,1;34,8,20,-42,-8,-8,25,-8,9,-28,1,84];') + self.assertEquals(pari.qfperfection(d), '77') + + d = ('[11870535336,4926369655,32404766,5833735188,-260286973,1176994945,-938673930,113' + '3212506,-1074526606,-70224083,-516302409,2824815072,-4372545965,-3541960809,-934' + '179491,1051267712;4926369655,11870535336,-1490432686,-875900356,3641011352,-1334' + '71097,5248732172,5339909303,1977366972,2112029217,1618397291,1453763043,-5074494' + '971,3402204872,-6089917,-2536340118;32404766,-1490432686,11870535336,123881942,1' + '472835948,538053943,-2072520281,-2111014772,-243328180,66329388,-1668343637,5366' + '171257,-1644082716,1999937160,1862466413,-2684624269;5833735188,-875900356,12388' + '1942,11870535336,-4482992193,724356870,-2581885607,-1123344860,-5909559285,-3740' + '57682,-1737269060,1373350629,-685882364,-2860185796,1915679243,-2582189975;-2602' + '86973,3641011352,1472835948,-4482992193,11870535336,-3382162923,-2727082036,-172' + '926336,3957014148,4123782659,-869026456,-712184755,1975235830,598346444,-8035836' + '82,764543726;1176994945,-133471097,538053943,724356870,-3382162923,11870535336,4' + '149099372,-1345152733,3238996158,-1859449765,788927568,627981303,-1997619722,-51' + '00674624,1082079081,-4600113518;-938673930,5248732172,-2072520281,-2581885607,-2' + '727082036,4149099372,11870535336,2778219046,565855490,-4509773947,2630869581,161' + '812815,-2518706476,2620761340,1350174537,-1070307221;1133212506,5339909303,-2111' + '014772,-1123344860,-172926336,-1345152733,2778219046,11870535336,1405373352,-948' + '42121,5935267668,1644886404,-4169157373,1191448802,400673054,-137185759;-1074526' + '606,1977366972,-243328180,-5909559285,3957014148,3238996158,565855490,1405373352' + ',11870535336,-1017421319,-2747041871,-2019274686,1090295757,2591545854,433617674' + ',63706423;-70224083,2112029217,66329388,-374057682,4123782659,-1859449765,-45097' + '73947,-94842121,-1017421319,11870535336,-570490848,1731611845,-2658074571,-12972' + '31573,-350469672,-40728837;-516302409,1618397291,-1668343637,-1737269060,-869026' + '456,788927568,2630869581,5935267668,-2747041871,-570490848,11870535336,279153276' + '9,26571128,-1302311714,1214830887,1283425367;2824815072,1453763043,5366171257,13' + '73350629,-712184755,627981303,161812815,1644886404,-2019274686,1731611845,279153' + '2769,11870535336,-3163139204,110178163,-49759695,-1512817003;-4372545965,-507449' + '4971,-1644082716,-685882364,1975235830,-1997619722,-2518706476,-4169157373,10902' + '95757,-2658074571,26571128,-3163139204,11870535336,-55032693,-2820423865,4651789' + '746;-3541960809,3402204872,1999937160,-2860185796,598346444,-5100674624,26207613' + '40,1191448802,2591545854,-1297231573,-1302311714,110178163,-55032693,11870535336' + ',5683626972,-2169747194;-934179491,-6089917,1862466413,1915679243,-803583682,108' + '2079081,1350174537,400673054,433617674,-350469672,1214830887,-49759695,-28204238' + '65,5683626972,11870535336,-5697137302;1051267712,-2536340118,-2684624269,-258218' + '9975,764543726,-4600113518,-1070307221,-137185759,63706423,-40728837,1283425367,' + '-1512817003,4651789746,-2169747194,-5697137302,11870535336];') + self.assertEquals(pari.qfperfection(d), '136') + +"""**** Original expected results **** + +1 +1 +78 +77 +136 + +""" diff --git a/tests/unittests/minmax.py b/tests/unittests/minmax.py new file mode 100644 index 0000000..fb1aae4 --- /dev/null +++ b/tests/unittests/minmax.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file minmax : +v = [-3,7,-2,11]; +obj = [1, v, Vecsmall(v), [-3,7;-2,11]]; + +{ +for (i = 1, #obj, + my (o = obj[i], u,v); + vecmin(o, &u); + vecmax(o, &v); + print(i, ": ", [vecmax(o), vecmin(o), u, v]); +) +} + +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestMinmax(unittest.TestCase): + def test_minmax(self): + v = [-3,7,-2,11]; + obj = [1, v, pari.Vecsmall(v), '[-3,7;-2,11]']; + + res = (('1', '1'), ('11', '-3'), ('11', '-3'), ('11', '-3')) + for i in range(0, len(obj)): + o = pari(obj[i]) + self.assertEquals((str(o.vecmax()), str(o.vecmin())), res[i]) + + +"""**** Original expected results **** + +1: [1, 1, 0, 0] +2: [11, -3, 1, 4] +3: [11, -3, 1, 4] +4: [11, -3, [1, 1], [2, 2]] + +""" diff --git a/tests/unittests/modfun.py b/tests/unittests/modfun.py new file mode 100644 index 0000000..b49ffcc --- /dev/null +++ b/tests/unittests/modfun.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file modfun : +default(realprecision,38) +eta(2+O(2^20)) +eta(x+x^2+x^3+x^4+O(x^5)) +eta(I) +ellj(2+O(2^20)) +ellj(x+x^2+x^3+x^4+O(x^5)) +theta(1/2,I) +weber(1.0*I,1) +weber(1+I) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestModfun(unittest.TestCase): + def setUp(self): + pari.set_real_precision(38) + + def tearDown(self): + pari.set_real_precision(15) + + def test_eta(self): + self.assertEqual(pari.eta('2+O(2^20)'), + '1 + 2 + 2^3 + 2^4 + 2^7 + 2^12 + 2^13 + 2^14 + 2^16 + 2^17 + 2^18 + 2^19 + O(2^20)') + self.assertEqual(pari.eta('x+x^2+x^3+x^4+O(x^5)'), '1 - x - 2*x^2 - 3*x^3 - 4*x^4 + O(x^5)') + self.assertEqual(str(pari.eta('I', precision=128)), '0.99812906992595851327996232224527387813') + + def test_ellj(self): + self.assertEqual(pari.ellj('2+O(2^20)'), '2^-1 + 2^5 + 2^7 + 2^8 + 2^10 + 2^12 + 2^16 + O(2^18)') + self.assertEqual(pari.ellj('x+x^2+x^3+x^4+O(x^5)'), 'x^-1 + 743 + 196884*x + 21690644*x^2 + O(x^3)') + + def test_theta(self): + self.assertEqual(str(pari.theta('1/2', 'I', precision=128)), + '0.E-38 - 0.50432357748832834893222560519660217759*I') + + def test_weber(self): + self.assertEqual(str(pari.weber('1.0*I', 1, precision=128)), '1.0905077326652576592070106557607079790') + self.assertEqual(str(pari.weber('1+I', precision=128)), + '1.0811782878393746833655992417658285836 - 0.14233982193131805512395869109512286588*I') + +"""**** Original expected results **** + +1 + 2 + 2^3 + 2^4 + 2^7 + 2^12 + 2^13 + 2^14 + 2^16 + 2^17 + 2^18 + 2^19 + O +(2^20) +1 - x - 2*x^2 - 3*x^3 - 4*x^4 + O(x^5) +0.99812906992595851327996232224527387813 +2^-1 + 2^5 + 2^7 + 2^8 + 2^10 + 2^12 + 2^16 + O(2^18) +x^-1 + 743 + 196884*x + 21690644*x^2 + O(x^3) +0.E-38 - 0.50432357748832834893222560519660217759*I +1.0905077326652576592070106557607079790 +1.0811782878393746833655992417658285836 - 0.14233982193131805512395869109512 +286588*I + +""" diff --git a/tests/unittests/modular.py b/tests/unittests/modular.py new file mode 100644 index 0000000..d8495f4 --- /dev/null +++ b/tests/unittests/modular.py @@ -0,0 +1,292 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file modular : +v = [2,3,2^32-1,2^64-1,10^20]; +f(a,b,p)=(a*Mod(1,p)) * (b*Mod(1,p)); +g(a,p)=sqr(a*Mod(1,p)); +test(a,b)= +{ + for (i=1,#v,print(i, ": ", f(a,b,v[i]))); + for (i=1,#v,print(i, ": ", g(a,v[i]))); +} +test(polcyclo(10),polcyclo(5)); +test([1,2;3,4], [-1,2;-4,2]); +Mod(Mod(1,y),x) +Mod(Mod(1,x),y) +iferr(Mod(1,"a"),E,E) +iferr(Mod(0,0),E,E) +iferr(Mod(0,Pol(0)),E,E) +iferr(Mod(x+O(x^2), x^3), E,E) +Mod(x+O(x^2), x^2) +Mod(x+O(x^3), x^2) +Mod(Mod(x,x^3), x^2) +Mod(Mod(1,12), 9) +Mod(1/x,x^2+1) +Mod([5,6],2) +Mod(3*x,2) +Mod(x,y) +Mod(Pol(0),2) +Pol(0)*Mod(1,2) +k=100000000000000000000; +Mod(3,7)^-k +Mod(3,7)^k + +\g1 +a=Mod(1,2);b=Mod(1,3); +a+b +a-b +a*b +a/b +a+a +a-a +a*a +a/a +a=Mod(1,x);b=Mod(1,x+1); +a+b +a-b +a*b +a/b +a+a +a-a +a*a +a/a + +\\#1652 +p=436^56-35;lift(Mod(271,p)^((p-1)/2)) +\\#1717 +Mod(0,1)==0 +Mod(0,1)==1 +Mod(0,1)==-1 +Mod(0,x^0)==0 +Mod(0,x^0)==1 +Mod(0,x^0)==-1 +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestModular(unittest.TestCase): + def test_modular(self): + v = [2, 3, '2^32-1', '2^64-1', '10^20']; + + def f(a, b, p): + return (a * pari.Mod(1, p)) * (b * pari.Mod(1, p)) + + def g(a, p): + return pari.sqr(a * pari.Mod(1, p)); + + def test(a, b, l): + for i in range(0, len(v)): + self.assertEquals(str(f(a, b, v[i])), l[i]) + + for i in range(0, len(v)): + self.assertEquals(str(g(a, v[i])), l[i+len(v)]) + + l = ['Mod(1, 2)*x^8 + Mod(1, 2)*x^6 + Mod(1, 2)*x^4 + Mod(1, 2)*x^2 + Mod(1, 2)', + 'Mod(1, 3)*x^8 + Mod(1, 3)*x^6 + Mod(1, 3)*x^4 + Mod(1, 3)*x^2 + Mod(1, 3)', + 'Mod(1, 4294967295)*x^8 + Mod(1, 4294967295)*x^6 + Mod(1, 4294967295)*x^4 + Mod(1, 429496' + + '7295)*x^2 + Mod(1, 4294967295)', + 'Mod(1, 18446744073709551615)*x^8 + Mod(1, 18446744073709551615)*x^6 + Mod(1, 18446744073' + + '709551615)*x^4 + Mod(1, 18446744073709551615)*x^2 + Mod(1, 18446744073709551615)', + 'Mod(1, 100000000000000000000)*x^8 + Mod(1, 100000000000000000000)*x^6 + Mod(1, 100000000' + + '000000000000)*x^4 + Mod(1, 100000000000000000000)*x^2 + Mod(1, 100000000000000000000)', + 'Mod(1, 2)*x^8 + Mod(1, 2)*x^6 + Mod(1, 2)*x^4 + Mod(1, 2)*x^2 + Mod(1, 2)', + 'Mod(1, 3)*x^8 + Mod(1, 3)*x^7 + Mod(2, 3)*x^5 + Mod(2, 3)*x^4 + Mod(2, 3)*x^3 + Mod(1, 3)*x + Mod(1, 3)', + 'Mod(1, 4294967295)*x^8 + Mod(4294967293, 4294967295)*x^7 + Mod(3, 4294967295)*x^6 + Mod(' + + '4294967291, 4294967295)*x^5 + Mod(5, 4294967295)*x^4 + Mod(4294967291, 4294967295)*x^3 +' + + ' Mod(3, 4294967295)*x^2 + Mod(4294967293, 4294967295)*x + Mod(1, 4294967295)', + 'Mod(1, 18446744073709551615)*x^8 + Mod(18446744073709551613, 18446744073709551615)*x^7 +' + + ' Mod(3, 18446744073709551615)*x^6 + Mod(18446744073709551611, 18446744073709551615)*x^5 ' + + '+ Mod(5, 18446744073709551615)*x^4 + Mod(18446744073709551611, 18446744073709551615)*x^3' + + ' + Mod(3, 18446744073709551615)*x^2 + Mod(18446744073709551613, 18446744073709551615)*x ' + + '+ Mod(1, 18446744073709551615)', + 'Mod(1, 100000000000000000000)*x^8 + Mod(99999999999999999998, 100000000000000000000)*x^7' + + ' + Mod(3, 100000000000000000000)*x^6 + Mod(99999999999999999996, 100000000000000000000)*' + + 'x^5 + Mod(5, 100000000000000000000)*x^4 + Mod(99999999999999999996, 10000000000000000000' + + '0)*x^3 + Mod(3, 100000000000000000000)*x^2 + Mod(99999999999999999998, 10000000000000000' + + '0000)*x + Mod(1, 100000000000000000000)'] + + test(pari.polcyclo(10), pari.polcyclo(5), l); + + l = ['[Mod(1, 2), Mod(0, 2); Mod(1, 2), Mod(0, 2)]', + '[Mod(0, 3), Mod(0, 3); Mod(2, 3), Mod(2, 3)]', + '[Mod(4294967286, 4294967295), Mod(6, 4294967295); Mod(4294967276, 4294967295), Mod(14, 4294967295)]', + '[Mod(18446744073709551606, 18446744073709551615), Mod(6, 18446744073709551615); Mod(1844674407370955' + + '1596, 18446744073709551615), Mod(14, 18446744073709551615)]', + '[Mod(99999999999999999991, 100000000000000000000), Mod(6, 100000000000000000000); Mod(99999999999999' + + '999981, 100000000000000000000), Mod(14, 100000000000000000000)]', + '[Mod(1, 2), Mod(0, 2); Mod(1, 2), Mod(0, 2)]', + '[Mod(1, 3), Mod(1, 3); Mod(0, 3), Mod(1, 3)]', + '[Mod(7, 4294967295), Mod(10, 4294967295); Mod(15, 4294967295), Mod(22, 4294967295)]', + '[Mod(7, 18446744073709551615), Mod(10, 18446744073709551615); Mod(15, 18446744073709551615), Mod(22,' + + ' 18446744073709551615)]', + '[Mod(7, 100000000000000000000), Mod(10, 100000000000000000000); Mod(15, 100000000000000000000), Mod(' + + '22, 100000000000000000000)]'] + + test('[1,2;3,4]', '[-1,2;-4,2]', l); + self.assertEquals(pari.Mod(pari.Mod(1, 'y'), 'x'), 'Mod(Mod(1, y), x)') + self.assertEquals(pari.Mod(pari.Mod(1, 'x'), 'y'), 'Mod(Mod(1, y), x)') + with self.assertRaises(PariError) as context: + pari.Mod(1, '"a"') + self.assertTrue('forbidden division t_INT % t_STR' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.Mod(0, 0) + self.assertTrue('impossible inverse in %: 0' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.Mod(0, pari.Pol(0)) + self.assertTrue('impossible inverse in %: 0' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.Mod('x+O(x^2)', 'x^3') + self.assertTrue('inconsistent division t_SER % t_POL' in str(context.exception)) + self.assertEqual(pari.Mod('x+O(x^2)', 'x^2'), 'Mod(x, x^2)') + self.assertEqual(pari.Mod('x+O(x^3)', 'x^2'), 'Mod(x, x^2)') + self.assertEqual(pari.Mod(pari.Mod('x', 'x^3'), 'x^2'), 'Mod(x, x^2)') + self.assertEqual(pari.Mod(pari.Mod(1, 12), 9), 'Mod(1, 3)') + self.assertEqual(pari.Mod('1/x', 'x^2+1'), 'Mod(-x, x^2 + 1)') + self.assertEqual(pari.Mod([5, 6], 2), '[Mod(1, 2), Mod(0, 2)]') + self.assertEqual(pari.Mod('3*x', 2), 'Mod(1, 2)*x') + self.assertEqual(pari.Mod('x', 'y'), 'Mod(1, y)*x') + self.assertEqual(pari.Mod(pari.Pol(0), 2), 'Mod(0, 2)') + self.assertEqual(pari.Pol(0) * pari.Mod(1, 2), 'Mod(0, 2)') + # k = 100000000000000000000; + # self.assertEqual(int(pow(pari.Mod(3, 7), -k)), 'Mod(2, 7)') + # self.assertEqual(int(pow(pari.Mod(3,7)^k)) + # + # \g1 + # a = pari.Mod(1, 2); + # b = pari.Mod(1, 3); + # a+b + # a-b + # a*b + # a/b + # a+a + # a-a + # a*a + # a/a + a = pari.Mod(1, 'x'); + b = pari.Mod(1, 'x+1'); + # a+b + # a-b + # a*b + # a/b + self.assertEquals(a+a, 'Mod(2, x)') + self.assertEquals(a-a, 'Mod(0, x)') + self.assertEquals(a*a, 'Mod(1, x)') + self.assertEquals(a/a, 'Mod(1, x)') + # + #1652 + # self.assertEquals(pari.lift('Mod(271,436^56-35)^((436^56-35-1)/2)'), 'Mod(1, x)') + #1717 + # self.assertEqual(pari.Mod(0,1), '0') + # self.assertEqual(pari.Mod(0,1), '1') + # self.assertEqual(pari.Mod(0,1), '-1') + # self.assertEqual(pari.Mod(0,'x^0'), '0') + # self.assertEqual(pari.Mod(0,'x^0'), '1') + # self.assertEqual(pari.Mod(0,'x^0'), '-1') + +"""**** Original expected results **** + +1: Mod(1, 2)*x^8 + Mod(1, 2)*x^6 + Mod(1, 2)*x^4 + Mod(1, 2)*x^2 + Mod(1, 2) +2: Mod(1, 3)*x^8 + Mod(1, 3)*x^6 + Mod(1, 3)*x^4 + Mod(1, 3)*x^2 + Mod(1, 3) +3: Mod(1, 4294967295)*x^8 + Mod(1, 4294967295)*x^6 + Mod(1, 4294967295)*x^4 ++ Mod(1, 4294967295)*x^2 + Mod(1, 4294967295) +4: Mod(1, 18446744073709551615)*x^8 + Mod(1, 18446744073709551615)*x^6 + Mod +(1, 18446744073709551615)*x^4 + Mod(1, 18446744073709551615)*x^2 + Mod(1, 18 +446744073709551615) +5: Mod(1, 100000000000000000000)*x^8 + Mod(1, 100000000000000000000)*x^6 + M +od(1, 100000000000000000000)*x^4 + Mod(1, 100000000000000000000)*x^2 + Mod(1 +, 100000000000000000000) +1: Mod(1, 2)*x^8 + Mod(1, 2)*x^6 + Mod(1, 2)*x^4 + Mod(1, 2)*x^2 + Mod(1, 2) +2: Mod(1, 3)*x^8 + Mod(1, 3)*x^7 + Mod(2, 3)*x^5 + Mod(2, 3)*x^4 + Mod(2, 3) +*x^3 + Mod(1, 3)*x + Mod(1, 3) +3: Mod(1, 4294967295)*x^8 + Mod(4294967293, 4294967295)*x^7 + Mod(3, 4294967 +295)*x^6 + Mod(4294967291, 4294967295)*x^5 + Mod(5, 4294967295)*x^4 + Mod(42 +94967291, 4294967295)*x^3 + Mod(3, 4294967295)*x^2 + Mod(4294967293, 4294967 +295)*x + Mod(1, 4294967295) +4: Mod(1, 18446744073709551615)*x^8 + Mod(18446744073709551613, 184467440737 +09551615)*x^7 + Mod(3, 18446744073709551615)*x^6 + Mod(18446744073709551611, + 18446744073709551615)*x^5 + Mod(5, 18446744073709551615)*x^4 + Mod(18446744 +073709551611, 18446744073709551615)*x^3 + Mod(3, 18446744073709551615)*x^2 + + Mod(18446744073709551613, 18446744073709551615)*x + Mod(1, 1844674407370955 +1615) +5: Mod(1, 100000000000000000000)*x^8 + Mod(99999999999999999998, 10000000000 +0000000000)*x^7 + Mod(3, 100000000000000000000)*x^6 + Mod(999999999999999999 +96, 100000000000000000000)*x^5 + Mod(5, 100000000000000000000)*x^4 + Mod(999 +99999999999999996, 100000000000000000000)*x^3 + Mod(3, 100000000000000000000 +)*x^2 + Mod(99999999999999999998, 100000000000000000000)*x + Mod(1, 10000000 +0000000000000) +1: [Mod(1, 2), Mod(0, 2); Mod(1, 2), Mod(0, 2)] +2: [Mod(0, 3), Mod(0, 3); Mod(2, 3), Mod(2, 3)] +3: [Mod(4294967286, 4294967295), Mod(6, 4294967295); Mod(4294967276, 4294967 +295), Mod(14, 4294967295)] +4: [Mod(18446744073709551606, 18446744073709551615), Mod(6, 1844674407370955 +1615); Mod(18446744073709551596, 18446744073709551615), Mod(14, 184467440737 +09551615)] +5: [Mod(99999999999999999991, 100000000000000000000), Mod(6, 100000000000000 +000000); Mod(99999999999999999981, 100000000000000000000), Mod(14, 100000000 +000000000000)] +1: [Mod(1, 2), Mod(0, 2); Mod(1, 2), Mod(0, 2)] +2: [Mod(1, 3), Mod(1, 3); Mod(0, 3), Mod(1, 3)] +3: [Mod(7, 4294967295), Mod(10, 4294967295); Mod(15, 4294967295), Mod(22, 42 +94967295)] +4: [Mod(7, 18446744073709551615), Mod(10, 18446744073709551615); Mod(15, 184 +46744073709551615), Mod(22, 18446744073709551615)] +5: [Mod(7, 100000000000000000000), Mod(10, 100000000000000000000); Mod(15, 1 +00000000000000000000), Mod(22, 100000000000000000000)] +Mod(Mod(1, y), x) +Mod(Mod(1, y), x) +error("forbidden division t_INT % t_STR.") +error("impossible inverse in %: 0.") +error("impossible inverse in %: 0.") +error("inconsistent division t_SER % t_POL.") +Mod(x, x^2) +Mod(x, x^2) +Mod(x, x^2) +Mod(1, 3) +Mod(-x, x^2 + 1) +[Mod(1, 2), Mod(0, 2)] +Mod(1, 2)*x +Mod(1, y)*x +Mod(0, 2) +Mod(0, 2) + *** _^_: Warning: Mod(a,b)^n with n >> b : wasteful. +Mod(2, 7) + *** _^_: Warning: Mod(a,b)^n with n >> b : wasteful. +Mod(4, 7) + debug = 1 + *** _+_: Warning: coercing quotient rings; moduli 2 and 3 -> 1. +Mod(0, 1) + *** _-_: Warning: coercing quotient rings; moduli 2 and 3 -> 1. +Mod(0, 1) + *** _*_: Warning: coercing quotient rings; moduli 2 and 3 -> 1. +Mod(0, 1) + *** _/_: Warning: coercing quotient rings; moduli 2 and 3 -> 1. +Mod(0, 1) +Mod(0, 2) +Mod(0, 2) +Mod(1, 2) +Mod(1, 2) + *** _+_: Warning: coercing quotient rings; moduli x and x + 1 -> 1. +Mod(0, 1) + *** _-_: Warning: coercing quotient rings; moduli x and x + 1 -> 1. +Mod(0, 1) + *** _*_: Warning: coercing quotient rings; moduli x and x + 1 -> 1. +Mod(0, 1) + *** _/_: Warning: coercing quotient rings; moduli x and x + 1 -> 1. +Mod(0, 1) +Mod(2, x) +Mod(0, x) +Mod(1, x) +Mod(1, x) +1 +1 +1 +1 +1 +1 +1 + +""" diff --git a/tests/unittests/nfrootsof1.py b/tests/unittests/nfrootsof1.py new file mode 100644 index 0000000..b943ec4 --- /dev/null +++ b/tests/unittests/nfrootsof1.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file nfrootsof1 : +allocatemem(20*10^6); +do(P)=nfrootsof1(nfinit(P))[1]; + +do(polcyclo(23)) +do(polresultant(y^3*x^3-y^2*x^2+1, polcyclo(23))) +do(x^54+9*x^51+18*x^48-81*x^45+387*x^42-729*x^39+1953*x^36-7560*x^33+14229*x^30-12393*x^27-270*x^24+6156*x^21+26136*x^18-77679*x^15+88452*x^12-49572*x^9+10287*x^6+972*x^3+27) +do(x^2+396735) +do(x^2+4372152) +do(x^2+x+99184) +do(x^16+2*x^15-x^14-4*x^13+x^12+4*x^11-2*x^9-3*x^8+7*x^6-9*x^4+4*x^3+4*x^2-4*x+1) +do(polcyclo(68)) +do(polcyclo(85)) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestNfrootsof1(unittest.TestCase): + def test_nfrootsof1(self): + pari.allocatemem(20*1e6); + def do(P): + return pari.nfrootsof1(pari.nfinit(P))[0]; + + self.assertEqual(do(pari.polcyclo(23)), '46') + self.assertEqual(do(pari.polresultant('y^3*x^3-y^2*x^2+1', pari.polcyclo(23))), '46') + self.assertEqual(do('x^54+9*x^51+18*x^48-81*x^45+387*x^42-729*x^39+1953*x^36-7560*x^33+14229*x^30-12393*x^27-270*x^24+6156*' + + 'x^21+26136*x^18-77679*x^15+88452*x^12-49572*x^9+10287*x^6+972*x^3+27'), '18') + self.assertEqual(do('x^2+396735'), '2') + self.assertEqual(do('x^2+4372152'), '2') + self.assertEqual(do('x^2+x+99184'), '2') + self.assertEqual(do('x^16+2*x^15-x^14-4*x^13+x^12+4*x^11-2*x^9-3*x^8+7*x^6-9*x^4+4*x^3+4*x^2-4*x+1'), '4') + self.assertEqual(do(pari.polcyclo(68)), '68') + self.assertEqual(do(pari.polcyclo(85)), '170') + +"""**** Original expected results **** + + *** Warning: new stack size = 20000000 (19.073 Mbytes). +46 +46 +18 +2 +2 +2 +4 +68 +170 + +""" diff --git a/tests/unittests/nfsplitting.py b/tests/unittests/nfsplitting.py new file mode 100644 index 0000000..51fd635 --- /dev/null +++ b/tests/unittests/nfsplitting.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file nfsplitting : +nfsplitting(1) +nfsplitting(Pol(0)) +nfsplitting(Pol(1)) +nfsplitting(x) +nfsplitting(y) +nfsplitting(x^5-x-1) +nfsplitting(x^8+3) +nfsplitting(x^8+3,32) +nfsplitting(nfinit(x^8+3)) +nfsplitting(x^5+5/4*x+1) +nfsplitting(polcyclo(23)) +nfsplitting(x^7-2) +nfsplitting(x^7-2,42) +nfsplitting(x^7-2,43) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestNfsplitting(unittest.TestCase): + def test_nfsplitting(self): + with self.assertRaises(PariError) as context: + pari.nfsplitting(1) + self.assertTrue('incorrect type in checknf [please apply nfinit()] (t_INT)' in str(context.exception)) + self.assertEqual(pari.nfsplitting(pari.Pol(0)), 'x') + self.assertEqual(pari.nfsplitting(pari.Pol(1)), 'x') + self.assertEqual(pari.nfsplitting('x'), 'x') + self.assertEqual(pari.nfsplitting('y'), 'y') + self.assertEqual(pari.nfsplitting('x^5-x-1'), + 'x^120 + 900*x^116 + 508450*x^112 + 3093750*x^110 + 233445700*x^108 + 6244625000*x^106 + ' + + '86356219375*x^104 + 6147962343750*x^102 - 9942720082555*x^100 + 3349338126562500*x^98 - ' + + '1654757011326100*x^96 + 1309871930885937500*x^94 + 12436255994792015950*x^92 + 627622053' + + '389650906250*x^90 + 10990443401191124447575*x^88 + 376988045414723757750000*x^86 + 57533' + + '30797521192519076250*x^84 + 177095246957480012540937500*x^82 + 2532236050928665494862464' + + '460*x^80 + 66602887475268525125564843750*x^78 + 900151039266122540911840715400*x^76 + 17' + + '601162771342375630639534375000*x^74 + 297430062665456220256577151477075*x^72 + 293030921' + + '7240262538594060043562500*x^70 + 72799466070683508609604970583641825*x^68 + 544024340743' + + '931708706461811877750000*x^66 + 8151927872797030504655109860308253125*x^64 + 10981574462' + + '8769444357250042241632031250*x^62 + 145871391991398970515017378630342573815*x^60 + 86498' + + '58988205592244458199943754150781250*x^58 - 28260531870665143418958164521279483618600*x^5' + + '6 - 402839653919367580525292500109637748437500*x^54 + 1069538514354660399137689789326703' + + '298795450*x^52 - 117799258418763740543911272144086881778781250*x^50 + 212256674680781774' + + '826232152789145244306484575*x^48 - 1157371878847856250227888707333507692960375000*x^46 -' + + ' 60605754850991956455326492294916133973935406250*x^44 - 29318354970878696157506850322206' + + '226355212812500*x^42 + 2969007992022620344286139006599749400952695117330*x^40 + 18940874' + + '61828917373658554525792922017788446875000*x^38 - 462258652890221831497176176774279926624' + + '850728121600*x^36 - 738786176377220399331352006274159764367952001562500*x^34 - 271554668' + + '9354064625536181765731364171583296080250050*x^32 + 9040698598507624900324513465462196895' + + '3701672354656250*x^30 + 667100278192945707891486584866308021389261753860839700*x^28 + 86' + + '74210771396452568056517384098059387025568935299000000*x^26 + 398107278298882940527387841' + + '21978440350534098819581529375*x^24 + 165091395418543016833097401882144226762030772580167' + + '343750*x^22 + 274553838350348659604342993914027364500470431599325551949*x^20 + 572738904' + + '807194096228688123388737103710592833161132812500*x^18 + 68036394459331662676411724212937' + + '09690269331493886975000*x^16 + 120736725475481968058717470226213838090682189655374375000' + + '0*x^14 + 1324631954910684324357431850891744535485699735726160156250*x^12 - 2445813956434' + + '295007552447734476548803933624572506738281250*x^10 + 30971974220732698120495121990252189' + + '92726116649855468750000*x^8 + 3438517208778831606624842861577883803163997230102539062500' + + '*x^6 - 3386560639084519090735630415918618954238015795898437500000*x^4 + 1053956302799738' + + '203903123844035395633732807800292968750000*x^2 + 186560038440801791453221568534690943522' + + '3786258697509765625') + self.assertEqual(pari.nfsplitting('x^8+3'), + 'x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721') + self.assertEqual(pari.nfsplitting('x^8+3', 32), + 'x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721') + self.assertEqual(pari.nfsplitting(pari.nfinit('x^8+3')), + 'x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721') + self.assertEqual(pari.nfsplitting('x^5+5/4*x+1'), 'x^10 - 30*x^8 + 325*x^6 - 1500*x^4 + 2500*x^2 + 2000') + self.assertEqual(pari.nfsplitting(pari.polcyclo(23)), 'x^22 + x^21 + x^20 + x^19 + x^18 + x^17 + x^16 + ' + + 'x^15 + x^14 + x^13 + x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^' + + '2 + x + 1') + self.assertEqual(pari.nfsplitting('x^7-2'), 'x^42 + 48020*x^28 + 96001584*x^14 + 52706752') + self.assertEqual(pari.nfsplitting('x^7-2', 42), 'x^42 + 48020*x^28 + 96001584*x^14 + 52706752') + self.assertEqual(pari.nfsplitting('x^7-2', 43), 'x^42 + 48020*x^28 + 96001584*x^14 + 52706752') + +"""**** Original expected results **** + + *** at top-level: nfsplitting(1) + *** ^-------------- + *** nfsplitting: incorrect type in checknf [please apply nfinit()] (t_INT). +x +x +x +y +x^120 + 900*x^116 + 508450*x^112 + 3093750*x^110 + 233445700*x^108 + 6244625 +000*x^106 + 86356219375*x^104 + 6147962343750*x^102 - 9942720082555*x^100 + +3349338126562500*x^98 - 1654757011326100*x^96 + 1309871930885937500*x^94 + 1 +2436255994792015950*x^92 + 627622053389650906250*x^90 + 10990443401191124447 +575*x^88 + 376988045414723757750000*x^86 + 5753330797521192519076250*x^84 + +177095246957480012540937500*x^82 + 2532236050928665494862464460*x^80 + 66602 +887475268525125564843750*x^78 + 900151039266122540911840715400*x^76 + 176011 +62771342375630639534375000*x^74 + 297430062665456220256577151477075*x^72 + 2 +930309217240262538594060043562500*x^70 + 72799466070683508609604970583641825 +*x^68 + 544024340743931708706461811877750000*x^66 + 815192787279703050465510 +9860308253125*x^64 + 109815744628769444357250042241632031250*x^62 + 14587139 +1991398970515017378630342573815*x^60 + 8649858988205592244458199943754150781 +250*x^58 - 28260531870665143418958164521279483618600*x^56 - 4028396539193675 +80525292500109637748437500*x^54 + 106953851435466039913768978932670329879545 +0*x^52 - 117799258418763740543911272144086881778781250*x^50 + 21225667468078 +1774826232152789145244306484575*x^48 - 1157371878847856250227888707333507692 +960375000*x^46 - 60605754850991956455326492294916133973935406250*x^44 - 2931 +8354970878696157506850322206226355212812500*x^42 + 2969007992022620344286139 +006599749400952695117330*x^40 + 18940874618289173736585545257929220177884468 +75000*x^38 - 462258652890221831497176176774279926624850728121600*x^36 - 7387 +86176377220399331352006274159764367952001562500*x^34 - 271554668935406462553 +6181765731364171583296080250050*x^32 + 9040698598507624900324513465462196895 +3701672354656250*x^30 + 6671002781929457078914865848663080213892617538608397 +00*x^28 + 8674210771396452568056517384098059387025568935299000000*x^26 + 398 +10727829888294052738784121978440350534098819581529375*x^24 + 165091395418543 +016833097401882144226762030772580167343750*x^22 + 27455383835034865960434299 +3914027364500470431599325551949*x^20 + 5727389048071940962286881233887371037 +10592833161132812500*x^18 + 680363944593316626764117242129370969026933149388 +6975000*x^16 + 1207367254754819680587174702262138380906821896553743750000*x^ +14 + 1324631954910684324357431850891744535485699735726160156250*x^12 - 24458 +13956434295007552447734476548803933624572506738281250*x^10 + 309719742207326 +9812049512199025218992726116649855468750000*x^8 + 34385172087788316066248428 +61577883803163997230102539062500*x^6 - 3386560639084519090735630415918618954 +238015795898437500000*x^4 + 105395630279973820390312384403539563373280780029 +2968750000*x^2 + 1865600384408017914532215685346909435223786258697509765625 +x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721 +x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721 +x^32 - 10356*x^24 + 127847862*x^16 - 11069073684*x^8 + 565036352721 +x^10 - 30*x^8 + 325*x^6 - 1500*x^4 + 2500*x^2 + 2000 +x^22 + x^21 + x^20 + x^19 + x^18 + x^17 + x^16 + x^15 + x^14 + x^13 + x^12 + + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 +x^42 + 48020*x^28 + 96001584*x^14 + 52706752 +x^42 + 48020*x^28 + 96001584*x^14 + 52706752 + *** nfsplitting: Warning: ignoring incorrect degree bound 43. +x^42 + 48020*x^28 + 96001584*x^14 + 52706752 + +""" diff --git a/tests/unittests/norm.py b/tests/unittests/norm.py new file mode 100644 index 0000000..fc382b0 --- /dev/null +++ b/tests/unittests/norm.py @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file norm : +norml2(-1/2) +norml2(quadgen(5)) +norml2(quadgen(-3)) +normlp(-1, 1) +normlp(-1/2, 1) +normlp(I, 1) + +default(realprecision,38); +F = [x->normlp(x,1), x->normlp(x,2), x->normlp(x,2.5), normlp]; +{ + for(i=1, #F, + my(f = F[i]); + print(f); + print(f([1,-2,3])); + print(f([1,-2;-3,4])); + print(f([[1,2],[3,4],5,6])); + print(f((1+I) + I*x^2)); + print(f(-quadgen(5))); + print(f(3+4*I)); + ) +} +normlp([95800,217519,414560], 4) +normlp(-1,oo) +normlp(-1,-oo) + +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestNorm(unittest.TestCase): + def test_norm(self): + self.assertEqual(pari.norml2('-1/2'), '1/4') + with self.assertRaises(PariError) as context: + pari.norml2(pari.quadgen(5)) + self.assertTrue('incorrect type in gnorml2 (t_QUAD)' in str(context.exception)) + self.assertEqual(pari.norml2(pari.quadgen(-3)), '1') + self.assertEqual(pari.normlp(-1, 1), '1') + self.assertEqual(pari.normlp('-1/2', 1), '1/2') + self.assertEqual(pari.normlp('I', 1), '1') + + pari.set_real_precision(38) + F = [lambda x: pari.normlp(x, 1, precision=128), lambda x: pari.normlp(x, 2, precision=128), + lambda x: pari.normlp(x, '2.5', precision=128), lambda x: pari.normlp(x, precision=128)]; + + res = [['6', + '10', + '21', + '2.4142135623730950488016887242096980786', + '1.6180339887498948482045868343656381177', + '5'], + ['3.7416573867739413855837487323165493018', + '5.4772255750516611345696978280080213395', + '9.5393920141694564915262158602322654026', + '1.7320508075688772935274463415058723670', + '1.6180339887498948482045868343656381177', + '5'], + ['3.4585606563304871862271371438840799750', + '4.9402040006184485884345102892270748966', + '8.2976320964215261445777796306034959974', + '1.6273657035458510939647914767411763647', + '1.6180339887498948482045868343656381177', + '5'], + ['3', + '4', + '6', + '1.4142135623730950488016887242096980786', + '1.6180339887498948482045868343656381177', + '5.0000000000000000000000000000000000000']] + + for i in range(0, len(F)): + f = F[i] + self.assertEqual(str(f([1, -2, 3])), res[i][0]) + self.assertEqual(str(f('[1,-2;-3,4]')), res[i][1]) + self.assertEqual(str(f([[1, 2], [3, 4], 5, 6])), res[i][2]) + self.assertEqual(str(f('(1+I) + I*x^2')), res[i][3]) + self.assertEqual(str(f(-pari.quadgen(5))), res[i][4]) + self.assertEqual(str(f('3+4*I')), res[i][5]) + + self.assertEqual(str(pari.normlp([95800, 217519, 414560], 4)), '422481') + self.assertEqual(str(pari.normlp(-1, 'oo')), '1') + with self.assertRaises(PariError) as context: + pari.normlp(-1, '-oo') + self.assertTrue('domain error in normlp: p <= 0' in str(context.exception)) + + pari.set_real_precision(15) + + +"""**** Original expected results **** + +1/4 + *** at top-level: norml2(quadgen(5)) + *** ^------------------ + *** norml2: incorrect type in gnorml2 (t_QUAD). +1 +1 +1/2 +1 +(x)->normlp(x,1) +6 +10 +21 +2.4142135623730950488016887242096980786 +1.6180339887498948482045868343656381177 +5 +(x)->normlp(x,2) +3.7416573867739413855837487323165493018 +5.4772255750516611345696978280080213395 +9.5393920141694564915262158602322654026 +1.7320508075688772935274463415058723670 +1.6180339887498948482045868343656381177 +5 +(x)->normlp(x,2.5) +3.4585606563304871862271371438840799750 +4.9402040006184485884345102892270748966 +8.2976320964215261445777796306034959974 +1.6273657035458510939647914767411763647 +1.6180339887498948482045868343656381177 +5 +normlp +3 +4 +6 +1.4142135623730950488016887242096980786 +1.6180339887498948482045868343656381177 +5.0000000000000000000000000000000000000 +422481 +1 + *** at top-level: normlp(-1,-oo) + *** ^-------------- + *** normlp: domain error in normlp: p <= 0 + +""" diff --git a/tests/unittests/number.py b/tests/unittests/number.py new file mode 100644 index 0000000..2d5d7c8 --- /dev/null +++ b/tests/unittests/number.py @@ -0,0 +1,541 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file number : +HEAP=[92, if(precision(1.)==38,2736,2776)]; +default(realprecision,154); Pi; default(realprecision,38); +\e +addprimes([nextprime(10^9),nextprime(10^10)]) +bestappr(Pi,10000) +gcdext(123456789,987654321) +bigomega(12345678987654321) +binomial(1.1,5) +chinese(Mod(7,15),Mod(13,21)) +content([123,456,789,234]) +contfrac(Pi) +contfrac(Pi,5) +contfrac((exp(1)-1)/(exp(1)+1),[1,3,5,7,9]) +contfracpnqn([2,6,10,14,18,22,26]) +contfracpnqn([1,1,1,1,1,1,1,1;1,1,1,1,1,1,1,1]) +core(54713282649239) +core(54713282649239,1) +coredisc(54713282649239) +coredisc(54713282649239,1) +divisors(8!) +eulerphi(257^2) +factor(17!+1) +factor(100!+1,0) +factor(40!+1,100000) +factorback(factor(12354545545)) +factor(230873846780665851254064061325864374115500032^6) +factorcantor(x^11+1,7) +centerlift(lift(factorff(x^3+x^2+x-1,3,t^3+t^2+t-1))) +10! +factorial(10) +factormod(x^11+1,7) +factormod(x^11+1,7,1) +setrand(1);ffinit(2,11) +setrand(1);ffinit(7,4) +fibonacci(100) +gcd(12345678,87654321) +gcd(x^10-1,x^15-1) +hilbert(2/3,3/4,5) +hilbert(Mod(5,7),Mod(6,7)) +isfundamental(12345) +isprime(12345678901234567) +ispseudoprime(73!+1) +issquare(12345678987654321) +issquarefree(123456789876543219) +kronecker(5,7) +kronecker(3,18) +lcm(15,-21) +lift(chinese(Mod(7,15),Mod(4,21))) +modreverse(Mod(x^2+1,x^3-x-1)) +moebius(3*5*7*11*13) +nextprime(100000000000000000000000) +numdiv(2^99*3^49) +omega(100!) +precprime(100000000000000000000000) +prime(100) +primes(100) +qfbclassno(-12391) +qfbclassno(1345) +qfbclassno(-12391,1) +qfbclassno(1345,1) +Qfb(2,1,3)*Qfb(2,1,3) +qfbcompraw(Qfb(5,3,-1,0.),Qfb(7,1,-1,0.)) +qfbhclassno(2000003) +qfbnucomp(Qfb(2,1,9),Qfb(4,3,5),3) +form=Qfb(2,1,9);qfbnucomp(form,form,3) +qfbnupow(form,111) +qfbpowraw(Qfb(5,3,-1,0.),3) +qfbprimeform(-44,3) +qfbred(Qfb(3,10,12),,-1) +qfbred(Qfb(3,10,-20,1.5)) +qfbred(Qfb(3,10,-20,1.5),2,,18) +qfbred(Qfb(3,10,-20,1.5),1) +qfbred(Qfb(3,10,-20,1.5),3,,18) +quaddisc(-252) +quadgen(-11) +quadpoly(-11) +quadregulator(17) +quadunit(17) +sigma(100) +sigma(100,2) +sigma(100,-3) +sqrtint(10!^2+1) +znorder(Mod(33,2^16+1)) +forprime(p=2,100,print(p," ",lift(znprimroot(p)))) +znstar(3120) +if (getheap()!=HEAP, getheap()) +""" +import unittest +from cypari2 import Pari, PariError +from math import pow, factorial +from testutils import primes + +pari = Pari() + + +class TestNumber(unittest.TestCase): + def setUp(self): + pari.set_real_precision(38) + + def tearDown(self): + pari.set_real_precision(15) + + def test_number(self): + self.assertEqual(str(pari.addprimes([pari.nextprime(1e9), pari.nextprime(1e10)])), '[1000000007, 10000000019]') + self.assertEqual(str(pari.bestappr('Pi', 10000)), '355/113') + self.assertEqual(str(pari.gcdext(123456789, 987654321)), '[-8, 1, 9]') + self.assertEqual(str(pari.bigomega(12345678987654321)), '8') + self.assertEqual(str(pari.binomial('1.1', 5)), '-0.0045457500000000000000000000000000000001') + self.assertEqual(str(pari.chinese(pari.Mod(7, 15), pari.Mod(13, 21))), 'Mod(97, 105)') + self.assertEqual(str(pari.content([123, 456, 789, 234])), '3') + self.assertEqual(str(pari.divisors(factorial(8))), + '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 28, 30, 32, 35, 36, 40, ' + + '42, 45, 48, 56, 60, 63, 64, 70, 72, 80, 84, 90, 96, 105, 112, 120, 126, 128, 140, 144, 1' + + '60, 168, 180, 192, 210, 224, 240, 252, 280, 288, 315, 320, 336, 360, 384, 420, 448, 480,' + + ' 504, 560, 576, 630, 640, 672, 720, 840, 896, 960, 1008, 1120, 1152, 1260, 1344, 1440, 1' + + '680, 1920, 2016, 2240, 2520, 2688, 2880, 3360, 4032, 4480, 5040, 5760, 6720, 8064, 10080' + + ', 13440, 20160, 40320]') + self.assertEqual(str(pari.eulerphi(int(pow(257, 2)))), '65792') + self.assertEqual(str(pari.fibonacci(100)), '354224848179261915075') + self.assertEqual(str(pari.lcm(15, -21)), '105') + self.assertEqual(str(pari.lift(pari.chinese(pari.Mod(7, 15), pari.Mod(4, 21)))), '67') + self.assertEqual(str(pari.modreverse(pari.Mod('x^2+1', 'x^3-x-1'))), + 'Mod(x^2 - 3*x + 2, x^3 - 5*x^2 + 8*x - 5)') + self.assertEqual(str(pari.moebius(3 * 5 * 7 * 11 * 13)), '-1') + self.assertEqual(str(pari.numdiv('2^99*3^49')), '5000') + self.assertEqual(str(pari.omega(factorial(100))), '25') + self.assertEqual(str(pari.sqrtint('10!^2+1')), '3628800') + self.assertEqual(str(pari.znorder(pari.Mod(33, '2^16+1'))), '2048') + res = ['1', '2', '2', '3', '2', '2', '3', '2', '5', '2', '3', '2', '6', '3', '5', '2', + '2', '2', '2', '7', '5', '3', '2', '3', '5'] + i = 0 + for p in primes(100): + self.assertEquals(pari.lift(pari.znprimroot(p)), res[i]) + i += 1 + self.assertEqual(str(pari.znstar(3120)), '[768, [12, 4, 4, 2, 2], [Mod(2641, 3120), Mod(2497,' + + ' 3120), Mod(2341, 3120), Mod(1951, 3120), Mod(2081, 3120)]]') + + def test_primes(self): + self.assertEqual(str(pari.nextprime(100000000000000000000000)), '100000000000000000000117') + self.assertEqual(str(pari.precprime(100000000000000000000000)), '99999999999999999999977') + self.assertEqual(str(pari.prime(100)), '541') + self.assertEqual(str(pari.primes(100)), + '[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,' + + ' 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179,' + + ' 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 27' + + '7, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, ' + + '389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491' + + ', 499, 503, 509, 521, 523, 541]') + + def test_contfrac(self): + self.assertEqual(str(pari.contfrac('Pi')), '[3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2' + + ', 2, 2, 1, 84, 2, 1, 1, 15, 3, 13, 1, 4, 2, 6, 6]') + self.assertEqual(str(pari.contfrac('Pi', 5)), '[3, 7, 15, 1, 292]') + self.assertEqual(str(pari.contfrac((pari.exp(1) - 1) / (pari.exp(1) + 1), [1, 3, 5, 7, 9])), + '[0, 6, 10, 42, 30]') + + def test_contfracpnqn(self): + self.assertEqual(str(pari.contfracpnqn([2, 6, 10, 14, 18, 22, 26])), '[19318376, 741721; 8927353, 342762]') + self.assertEqual(str(pari.contfracpnqn('[1,1,1,1,1,1,1,1;1,1,1,1,1,1,1,1]')), '[34, 21; 21, 13]') + + def test_core(self): + self.assertEqual(str(pari.core(54713282649239)), '5471') + self.assertEqual(str(pari.core(54713282649239, 1)), '[5471, 100003]') + + def test_coredisc(self): + self.assertEqual(str(pari.coredisc(54713282649239)), '21884') + self.assertEqual(str(pari.coredisc(54713282649239, 1)), '[21884, 100003/2]') + + def test_factor(self): + self.assertEqual(str(pari.factor(factorial(17) + 1)), '[661, 1; 537913, 1; 1000357, 1]') + self.assertEqual(str(pari.factor(factorial(100) + 1, 0)), + '[101, 1; 14303, 1; 149239, 1; 4328852738498929626130718009186589490596793086850244817957' + + '4076552756849301072702375746139749880098152144087781328865783919562249722562149942762845' + + '3, 1]') + self.assertEqual(str(pari.factor(factorial(40) + 1, 100000)), + '[41, 1; 59, 1; 277, 1; 1217669507565553887239873369513188900554127, 1]') + self.assertEqual(str(pari.factorback(pari.factor(12354545545))), '12354545545') + self.assertEqual(str(pari.factor('230873846780665851254064061325864374115500032^6')), + '[2, 120; 3, 6; 7, 6; 23, 6; 29, 6; 500501, 36]') + self.assertEqual(str(pari.factorcantor('x^11+1', 7)), '[Mod(1, 7)*x + Mod(1, 7), 1; Mod(1, 7)*x^10 + ' + + 'Mod(6, 7)*x^9 + Mod(1, 7)*x^8 + Mod(6, 7)*x^7 + Mod(1, 7)*x^6 + Mod(6, 7)*x^5 + Mo' + + 'd(1, 7)*x^4 + Mod(6, 7)*x^3 + Mod(1, 7)*x^2 + Mod(6, 7)*x + Mod(1, 7), 1]') + self.assertEqual(str(pari.centerlift(pari.lift(pari.factorff('x^3+x^2+x-1', 3, 't^3+t^2+t-1')))), + '[x - t, 1; x + (t^2 + t - 1), 1; x + (-t^2 - 1), 1]') + self.assertEqual(str(pari('10!')), '3628800') + self.assertEqual(str(pari.factorial(10, 127)), '3628800.0000000000000000000000000000000') + + def test_factormod(self): + self.assertEqual(str(pari.factormod('x^11+1', 7)), + '[Mod(1, 7)*x + Mod(1, 7), 1; Mod(1, 7)*x^10 + Mod(6, 7)*x^9 + Mod(1, 7)*x^8 + Mod(6, 7)*' + + 'x^7 + Mod(1, 7)*x^6 + Mod(6, 7)*x^5 + Mod(1, 7)*x^4 + Mod(6, 7)*x^3 + Mod(1, 7)*x^2 + Mo' + + 'd(6, 7)*x + Mod(1, 7), 1]') + self.assertEqual(str(pari.factormod('x^11+1', 7, 1)), '[1, 1; 10, 1]') + + def test_ffinit(self): + pari.setrand(1); + self.assertEqual(str(pari.ffinit(2, 11)), + 'Mod(1, 2)*x^11 + Mod(1, 2)*x^10 + Mod(1, 2)*x^8 + Mod(1, 2)*x^4 + Mod(1, 2)*x^3' + + ' + Mod(1, 2)*x^2 + Mod(1, 2)') + pari.setrand(1); + self.assertEqual(str(pari.ffinit(7, 4)), + 'Mod(1, 7)*x^4 + Mod(1, 7)*x^3 + Mod(1, 7)*x^2 + Mod(1, 7)*x + Mod(1, 7)') + + def test_gcd(self): + self.assertEqual(str(pari.gcd(12345678, 87654321)), '9') + self.assertEqual(str(pari.gcd('x^10-1', 'x^15-1')), 'x^5 - 1') + + def test_hilbert(self): + self.assertEqual(str(pari.hilbert('2/3', '3/4', 5)), '1') + self.assertEqual(str(pari.hilbert(pari.Mod(5, 7), pari.Mod(6, 7))), '1') + + def test_booleanfct(self): + self.assertTrue(pari.isfundamental(12345)) + self.assertFalse(pari.isprime(12345678901234567)) + self.assertTrue(pari.ispseudoprime(factorial(73) + 1)) + self.assertTrue(pari(12345678987654321).issquare()) + self.assertFalse(pari.issquarefree(123456789876543219)) + + def test_kronecker(self): + self.assertEqual(str(pari.kronecker(5, 7)), '-1') + self.assertEqual(str(pari.kronecker(3, 18)), '0') + + def test_qfbclassno(self): + self.assertEqual(str(pari.qfbclassno(-12391)), '63') + self.assertEqual(str(pari.qfbclassno(1345)), '6') + self.assertEqual(str(pari.qfbclassno(-12391, 1)), '63') + self.assertEqual(str(pari.qfbclassno(1345, 1)), '6') + + def test_qfb(self): + self.assertEqual(str(pari.Qfb(2, 1, 3) * pari.Qfb(2, 1, 3)), 'Qfb(2, -1, 3)') + self.assertEqual(str(pari.qfbcompraw(pari.Qfb(5, 3, -1, '0.'), pari.Qfb(7, 1, -1, '0.'))), + 'Qfb(35, 43, 13, 0.E-38)') + self.assertEqual(str(pari.qfbhclassno(2000003)), '357') + self.assertEqual(str(pari.qfbnucomp(pari.Qfb(2, 1, 9), pari.Qfb(4, 3, 5), 3)), 'Qfb(2, -1, 9)') + form = pari.Qfb(2, 1, 9); + self.assertEqual(str(pari.qfbnucomp(form, form, 3)), 'Qfb(4, -3, 5)') + self.assertEqual(str(pari.qfbnupow(form, 111)), 'Qfb(2, -1, 9)') + self.assertEqual(str(pari.qfbpowraw(pari.Qfb(5, 3, -1, '0.'), 3)), 'Qfb(125, 23, 1, 0.E-38)') + self.assertEqual(str(pari.qfbprimeform(-44, 3)), 'Qfb(3, 2, 4)') + + def test_qfbred(self): + self.assertEqual(str(pari.qfbred(pari.Qfb(3, 10, 12), 0, -1)), 'Qfb(3, -2, 4)') + self.assertEqual(str(pari.qfbred(pari.Qfb(3, 10, -20, 1.5, precision=128))), + 'Qfb(3, 16, -7, 1.5000000000000000000000000000000000000)') + self.assertEqual(str(pari.qfbred(pari.Qfb(3, 10, -20, 1.5, precision=128), 2, None, 18)), + 'Qfb(3, 16, -7, 1.5000000000000000000000000000000000000)') + self.assertEqual(str(pari.qfbred(pari.Qfb(3, 10, -20, 1.5, precision=128), 1)), + 'Qfb(-20, -10, 3, 2.1074451073987839947135880252731470616)') + self.assertEqual(str(pari.qfbred(pari.Qfb(3, 10, -20, 1.5, precision=128), 3, None, 18)), + 'Qfb(-20, -10, 3, 1.5000000000000000000000000000000000000)') + + def test_quadfct(self): + self.assertEqual(str(pari.quaddisc(-252)), '-7') + self.assertEqual(str(pari.quadgen(-11)), 'w') + self.assertEqual(str(pari.quadpoly(-11)), 'x^2 - x + 3') + self.assertEqual(str(pari.quadregulator(17, precision=128)), '2.0947125472611012942448228460655286535') + self.assertEqual(str(pari.quadunit(17)), '3 + 2*w') + + def test_sigma(self): + self.assertEqual(str(pari.sigma(100)), '217') + self.assertEqual(str(pari.sigma(100, 2)), '13671') + self.assertEqual(str(pari.sigma(100, -3)), '1149823/1000000') + +"""**** Original expected results **** + + echo = 1 (on) +? addprimes([nextprime(10^9),nextprime(10^10)]) +[1000000007, 10000000019] +? bestappr(Pi,10000) +355/113 +? gcdext(123456789,987654321) +[-8, 1, 9] +? bigomega(12345678987654321) +8 +? binomial(1.1,5) +-0.0045457500000000000000000000000000000001 +? chinese(Mod(7,15),Mod(13,21)) +Mod(97, 105) +? content([123,456,789,234]) +3 +? contfrac(Pi) +[3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1 +, 1, 15, 3, 13, 1, 4, 2, 6, 6] +? contfrac(Pi,5) +[3, 7, 15, 1, 292] +? contfrac((exp(1)-1)/(exp(1)+1),[1,3,5,7,9]) +[0, 6, 10, 42, 30] +? contfracpnqn([2,6,10,14,18,22,26]) + +[19318376 741721] + +[ 8927353 342762] + +? contfracpnqn([1,1,1,1,1,1,1,1;1,1,1,1,1,1,1,1]) + +[34 21] + +[21 13] + +? core(54713282649239) +5471 +? core(54713282649239,1) +[5471, 100003] +? coredisc(54713282649239) +21884 +? coredisc(54713282649239,1) +[21884, 100003/2] +? divisors(8!) +[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 28, 30, 32, +35, 36, 40, 42, 45, 48, 56, 60, 63, 64, 70, 72, 80, 84, 90, 96, 105, 112, 12 +0, 126, 128, 140, 144, 160, 168, 180, 192, 210, 224, 240, 252, 280, 288, 315 +, 320, 336, 360, 384, 420, 448, 480, 504, 560, 576, 630, 640, 672, 720, 840, + 896, 960, 1008, 1120, 1152, 1260, 1344, 1440, 1680, 1920, 2016, 2240, 2520, + 2688, 2880, 3360, 4032, 4480, 5040, 5760, 6720, 8064, 10080, 13440, 20160, +40320] +? eulerphi(257^2) +65792 +? factor(17!+1) + +[ 661 1] + +[ 537913 1] + +[1000357 1] + +? factor(100!+1,0) + +[101 1] + +[14303 1] + +[149239 1] + +[432885273849892962613071800918658949059679308685024481795740765527568493010 +727023757461397498800981521440877813288657839195622497225621499427628453 1] + +? factor(40!+1,100000) + +[ 41 1] + +[ 59 1] + +[ 277 1] + +[1217669507565553887239873369513188900554127 1] + +? factorback(factor(12354545545)) +12354545545 +? factor(230873846780665851254064061325864374115500032^6) + +[ 2 120] + +[ 3 6] + +[ 7 6] + +[ 23 6] + +[ 29 6] + +[500501 36] + +? factorcantor(x^11+1,7) + +[Mod(1, 7)*x + Mod(1, 7) 1] + +[Mod(1, 7)*x^10 + Mod(6, 7)*x^9 + Mod(1, 7)*x^8 + Mod(6, 7)*x^7 + Mod(1, 7)* +x^6 + Mod(6, 7)*x^5 + Mod(1, 7)*x^4 + Mod(6, 7)*x^3 + Mod(1, 7)*x^2 + Mod(6, + 7)*x + Mod(1, 7) 1] + +? centerlift(lift(factorff(x^3+x^2+x-1,3,t^3+t^2+t-1))) + +[ x - t 1] + +[x + (t^2 + t - 1) 1] + +[ x + (-t^2 - 1) 1] + +? 10! +3628800 +? factorial(10) +3628800.0000000000000000000000000000000 +? factormod(x^11+1,7) + +[Mod(1, 7)*x + Mod(1, 7) 1] + +[Mod(1, 7)*x^10 + Mod(6, 7)*x^9 + Mod(1, 7)*x^8 + Mod(6, 7)*x^7 + Mod(1, 7)* +x^6 + Mod(6, 7)*x^5 + Mod(1, 7)*x^4 + Mod(6, 7)*x^3 + Mod(1, 7)*x^2 + Mod(6, + 7)*x + Mod(1, 7) 1] + +? factormod(x^11+1,7,1) + +[ 1 1] + +[10 1] + +? setrand(1);ffinit(2,11) +Mod(1, 2)*x^11 + Mod(1, 2)*x^10 + Mod(1, 2)*x^8 + Mod(1, 2)*x^4 + Mod(1, 2)* +x^3 + Mod(1, 2)*x^2 + Mod(1, 2) +? setrand(1);ffinit(7,4) +Mod(1, 7)*x^4 + Mod(1, 7)*x^3 + Mod(1, 7)*x^2 + Mod(1, 7)*x + Mod(1, 7) +? fibonacci(100) +354224848179261915075 +? gcd(12345678,87654321) +9 +? gcd(x^10-1,x^15-1) +x^5 - 1 +? hilbert(2/3,3/4,5) +1 +? hilbert(Mod(5,7),Mod(6,7)) +1 +? isfundamental(12345) +1 +? isprime(12345678901234567) +0 +? ispseudoprime(73!+1) +1 +? issquare(12345678987654321) +1 +? issquarefree(123456789876543219) +0 +? kronecker(5,7) +-1 +? kronecker(3,18) +0 +? lcm(15,-21) +105 +? lift(chinese(Mod(7,15),Mod(4,21))) +67 +? modreverse(Mod(x^2+1,x^3-x-1)) +Mod(x^2 - 3*x + 2, x^3 - 5*x^2 + 8*x - 5) +? moebius(3*5*7*11*13) +-1 +? nextprime(100000000000000000000000) +100000000000000000000117 +? numdiv(2^99*3^49) +5000 +? omega(100!) +25 +? precprime(100000000000000000000000) +99999999999999999999977 +? prime(100) +541 +? primes(100) +[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, +157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 2 +39, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 33 +1, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421 +, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, + 521, 523, 541] +? qfbclassno(-12391) +63 +? qfbclassno(1345) +6 +? qfbclassno(-12391,1) +63 +? qfbclassno(1345,1) +6 +? Qfb(2,1,3)*Qfb(2,1,3) +Qfb(2, -1, 3) +? qfbcompraw(Qfb(5,3,-1,0.),Qfb(7,1,-1,0.)) +Qfb(35, 43, 13, 0.E-38) +? qfbhclassno(2000003) +357 +? qfbnucomp(Qfb(2,1,9),Qfb(4,3,5),3) +Qfb(2, -1, 9) +? form=Qfb(2,1,9);qfbnucomp(form,form,3) +Qfb(4, -3, 5) +? qfbnupow(form,111) +Qfb(2, -1, 9) +? qfbpowraw(Qfb(5,3,-1,0.),3) +Qfb(125, 23, 1, 0.E-38) +? qfbprimeform(-44,3) +Qfb(3, 2, 4) +? qfbred(Qfb(3,10,12),,-1) +Qfb(3, -2, 4) +? qfbred(Qfb(3,10,-20,1.5)) +Qfb(3, 16, -7, 1.5000000000000000000000000000000000000) +? qfbred(Qfb(3,10,-20,1.5),2,,18) +Qfb(3, 16, -7, 1.5000000000000000000000000000000000000) +? qfbred(Qfb(3,10,-20,1.5),1) +Qfb(-20, -10, 3, 2.1074451073987839947135880252731470616) +? qfbred(Qfb(3,10,-20,1.5),3,,18) +Qfb(-20, -10, 3, 1.5000000000000000000000000000000000000) +? quaddisc(-252) +-7 +? quadgen(-11) +w +? quadpoly(-11) +x^2 - x + 3 +? quadregulator(17) +2.0947125472611012942448228460655286535 +? quadunit(17) +3 + 2*w +? sigma(100) +217 +? sigma(100,2) +13671 +? sigma(100,-3) +1149823/1000000 +? sqrtint(10!^2+1) +3628800 +? znorder(Mod(33,2^16+1)) +2048 +? forprime(p=2,100,print(p," ",lift(znprimroot(p)))) +2 1 +3 2 +5 2 +7 3 +11 2 +13 2 +17 3 +19 2 +23 5 +29 2 +31 3 +37 2 +41 6 +43 3 +47 5 +53 2 +59 2 +61 2 +67 2 +71 7 +73 5 +79 3 +83 2 +89 3 +97 5 +? znstar(3120) +[768, [12, 4, 4, 2, 2], [Mod(2641, 3120), Mod(2497, 3120), Mod(2341, 3120), +Mod(1951, 3120), Mod(2081, 3120)]] +? if(getheap()!=HEAP,getheap()) + +""" diff --git a/tests/unittests/pol.py b/tests/unittests/pol.py new file mode 100644 index 0000000..5fa9d49 --- /dev/null +++ b/tests/unittests/pol.py @@ -0,0 +1,155 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file pol : +o = [Mod(0,3),y,1/y, (y^2+1)/y, [1,2,3], Vecsmall([1,2,0]), Qfb(1,2,4), Qfb(1,2,-4), y+2*y^2+O(y^4)]; +{ + for (i=1,#o, + my (v = o[i]); + printsep(" ", Pol(v,y), Pol(v,x), Polrev(v)); + printsep(" ", Ser(v,y), Ser(v,x), Ser(v,,5)); + ) +} +o = [2*x+3*y, 2+x+y+O(x^2), 2+x+y+O(y^2)]; +{ + for (i=1,#o, + my (v = o[i]); + printsep(" ",pollead(v), pollead(v,x), pollead(v,y)) + ) +} +pollead(z,y) +pollead(y,z) +polgraeffe(x^2+x+1) +polgraeffe(x^3+x+1) +polsym(2*x^4+1,4) +norm(I*x+1) +trace(I*x+1) +matcompanion(2*x^2+1) +Pol("") +serlaplace(1+x+x^2) +serlaplace(x^2+x^3) + +\\#1651 +f1=(x-1)/(x*x-x); +type(subst(1/f1,x,1)) + +\\#1690 +default(realprecision,38); +P(x,y)=(x+1)*y^2+(x^2-x+1)*y+(x^2+x); +polroots(P(exp(I*Pi),y)) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestPol(unittest.TestCase): + def test_pol(self): + o = [pari.Mod(0,3), 'y', '1/y', '(y^2+1)/y', [1,2,3], pari.Vecsmall([1,2,0]), + pari.Qfb(1,2,4), pari.Qfb(1,2,-4), 'y+2*y^2+O(y^4)']; + res_pol =['Mod(0, 3) Mod(0, 3) Mod(0, 3)', + 'y x x', + '0 0 0', + 'y x x', + 'y^2 + 2*y + 3 x^2 + 2*x + 3 3*x^2 + 2*x + 1', + 'y^2 + 2*y x^2 + 2*x 2*x + 1', + 'y^2 + 2*y + 4 x^2 + 2*x + 4 4*x^2 + 2*x + 1', + 'y^2 + 2*y - 4 x^2 + 2*x - 4 -4*x^2 + 2*x + 1', + '2*y^2 + y 2*x^2 + x 2*x^2 + x'] + + res_ser = ['Mod(0, 3)*y^15 + O(y^16) Mod(0, 3)*x^15 + O(x^16) Mod(0, 3)*x^4 + O(x^5)', + 'y + O(y^17) y + O(x^16) y + O(x^5)', + 'y^-1 + O(y^15) 1/y + O(x^16) 1/y + O(x^5)', + 'y^-1 + y + O(y^15) ((y^2 + 1)/y) + O(x^16) ((y^2 + 1)/y) + O(x^5)', + '1 + 2*y + 3*y^2 + O(y^3) 1 + 2*x + 3*x^2 + O(x^3) 1 + 2*x + 3*x^2 + O(x^3)', + '1 + 2*y + O(y^3) 1 + 2*x + O(x^3) 1 + 2*x + O(x^3)', + '1 + 2*y + 4*y^2 + O(y^3) 1 + 2*x + 4*x^2 + O(x^3) 1 + 2*x + 4*x^2 + O(x^3)', + '1 + 2*y - 4*y^2 + O(y^3) 1 + 2*x - 4*x^2 + O(x^3) 1 + 2*x - 4*x^2 + O(x^3)', + 'y + 2*y^2 + O(y^4) (y + 2*y^2 + O(y^4)) + O(x^16) (y + 2*y^2 + O(y^4)) + O(x^5)'] + + for i in range(0, len(o)): + v = o[i] + self.assertEquals('%s %s %s' % (pari.Pol(v, 'y'), pari.Pol(v, 'x'), pari.Polrev(v)), res_pol[i]) + self.assertEquals('%s %s %s' % (pari.Ser(v, 'y'), pari.Ser(v, 'x'), pari.Ser(v, None, 5)), res_ser[i]) + + self.assertEquals(pari.polsym('2*x^4+1', 4), '[4, 0, 0, 0, -2]~') + self.assertEquals(pari.norm('I*x+1'), 'x^2 + 1') + self.assertEquals(pari.trace('I*x+1'), '2') + self.assertEquals(pari.matcompanion('2*x^2+1'), '[0, -1/2; 1, 0]') + with self.assertRaises(PariError) as context: + pari.Pol('""') + self.assertTrue('incorrect type in gtopoly (t_STR)' in str(context.exception)) + # #1651 + self.assertEquals(pari.type(pari.subst('1/((x-1)/(x*x-x))', 'x', 1)), '"t_INT"') + + # #1690 + # pari.set_real_precision(38) + # P(x,y)=(x+1)*y^2+(x^2-x+1)*y+(x^2+x); + # pari.polroots(P(pari.exp(I*Pi),y)) + # pari.set_real_precision(15) + + def test_pollead(self): + o = ['2*x+3*y', '2+x+y+O(x^2)', '2+x+y+O(y^2)']; + res_pollead = ['2 2 3', 'y + 2 y + 2 x + 2', '1 1 x + 2'] + for i in range(0, len(o)): + v = o[i] + self.assertEquals('%s %s %s' % (pari.pollead(v), pari.pollead(v,'x'), pari.pollead(v,'y')), res_pollead[i]) + + self.assertEquals(pari.pollead('z', 'y'), 'z') + self.assertEquals(pari.pollead('y', 'z'), 'y') + + def test_polgraeffe(self): + self.assertEquals(pari.polgraeffe('x^2+x+1'), 'x^2 + x + 1') + self.assertEquals(pari.polgraeffe('x^3+x+1'), '-x^3 - 2*x^2 - x + 1') + + def test_serplace(self): + self.assertEquals(pari.serlaplace('1+x+x^2'), '2*x^2 + x + 1') + self.assertEquals(pari.serlaplace('x^2+x^3'), '6*x^3 + 2*x^2') + +"""**** Original expected results **** + +Mod(0, 3) Mod(0, 3) Mod(0, 3) +Mod(0, 3)*y^15 + O(y^16) Mod(0, 3)*x^15 + O(x^16) Mod(0, 3)*x^4 + O(x^5) +y x x +y + O(y^17) y + O(x^16) y + O(x^5) +0 0 0 +y^-1 + O(y^15) 1/y + O(x^16) 1/y + O(x^5) +y x x +y^-1 + y + O(y^15) ((y^2 + 1)/y) + O(x^16) ((y^2 + 1)/y) + O(x^5) +y^2 + 2*y + 3 x^2 + 2*x + 3 3*x^2 + 2*x + 1 +1 + 2*y + 3*y^2 + O(y^3) 1 + 2*x + 3*x^2 + O(x^3) 1 + 2*x + 3*x^2 + O(x^3) +y^2 + 2*y x^2 + 2*x 2*x + 1 +1 + 2*y + O(y^3) 1 + 2*x + O(x^3) 1 + 2*x + O(x^3) +y^2 + 2*y + 4 x^2 + 2*x + 4 4*x^2 + 2*x + 1 +1 + 2*y + 4*y^2 + O(y^3) 1 + 2*x + 4*x^2 + O(x^3) 1 + 2*x + 4*x^2 + O(x^3) +y^2 + 2*y - 4 x^2 + 2*x - 4 -4*x^2 + 2*x + 1 +1 + 2*y - 4*y^2 + O(y^3) 1 + 2*x - 4*x^2 + O(x^3) 1 + 2*x - 4*x^2 + O(x^3) +2*y^2 + y 2*x^2 + x 2*x^2 + x +y + 2*y^2 + O(y^4) (y + 2*y^2 + O(y^4)) + O(x^16) (y + 2*y^2 + O(y^4)) + O(x +^5) +2 2 3 +y + 2 y + 2 x + 2 +1 1 x + 2 +z +y +x^2 + x + 1 +-x^3 - 2*x^2 - x + 1 +[4, 0, 0, 0, -2]~ +x^2 + 1 +2 + +[0 -1/2] + +[1 0] + + *** at top-level: Pol("") + *** ^------- + *** Pol: incorrect type in gtopoly (t_STR). +2*x^2 + x + 1 +6*x^3 + 2*x^2 +"t_INT" + *** polroots: Warning: normalizing a polynomial with 0 leading term. +[0.E-38 + 0.E-38*I]~ + +""" diff --git a/tests/unittests/prec.py b/tests/unittests/prec.py new file mode 100644 index 0000000..a3c541d --- /dev/null +++ b/tests/unittests/prec.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file prec : +precision(0) +bitprecision(0) +precision(I,3) +default(realprecision,38); +t=(precision(1.,77)*x+1); +precision(t) +localprec(57);precision(1.) +localbitprec(128);bitprecision(1.) +bitprecision(1 + O(x), 10) +bitprecision(1 + O(3^5), 10) +bitprecision(1, 10) +precision(1./t) +precision(Qfb(1,0,-2)); + +serprec(1,x) +serprec(x+O(x^3),x) +serprec(x+O(x^3),y) +serprec((1+O(y^2))*x+y + O(y^3), y) + +padicprec(0,2) +padicprec(0,"") +padicprec(1,2) == padicprec(0,2) +padicprec(1/2,2)== padicprec(0,2) +padicprec(Mod(1,9),3) +padicprec(O(2^2),3) +padicprec(O(2^2),2) +t=1+O(2^3); +padicprec(t,2) +padicprec((x+2)*t, 2) +padicprec((1+2*x+O(x^2))*t, 2) +padicprec([2,4]*t, 2) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestPrec(unittest.TestCase): + def test_prec(self): + self.assertEquals(pari.precision(0), '+oo') + self.assertEquals(pari.bitprecision(0), '+oo') + self.assertEquals(pari.precision('I', 3), 'I') + pari.set_real_precision(38) + t = pari('precision(1.,77)*x+1'); + self.assertEquals(pari.precision(t), '77') + pari.localprec(57); + self.assertEquals(pari.precision('1.'), '57') + pari.localbitprec(128); + self.assertEquals(pari.bitprecision('1.'), '128') + self.assertEquals(pari.bitprecision('1 + O(x)', 10), '1 + O(x)') + self.assertEquals(pari.bitprecision('1 + O(3^5)', 10), '1 + O(3^5)') + self.assertEquals(pari.bitprecision(1, 10), '1') + self.assertEquals(pari.precision('1./t'), '38') + pari.precision(pari.Qfb(1, 0, -2)); + + def test_serprec(self): + self.assertEquals(pari.serprec(1, 'x'), '+oo') + self.assertEquals(pari.serprec('x+O(x^3)', 'x'), '3') + self.assertEquals(pari.serprec('x+O(x^3)', 'y'), '+oo') + self.assertEquals(pari.serprec('(1+O(y^2))*x+y + O(y^3)', 'y'), '2') + + def test_padicprec(self): + self.assertEquals(pari.padicprec(0, 2), '+oo') + with self.assertRaises(PariError) as context: + pari.padicprec(0, '""') + self.assertTrue('incorrect type in padicprec (t_STR)' in str(context.exception)) + self.assertEquals(pari.padicprec(1, 2), pari.padicprec(0, 2)) + self.assertEquals(pari.padicprec('1/2', 2), pari.padicprec(0, 2)) + self.assertEquals(pari.padicprec(pari.Mod(1, 9), 3), '2') + with self.assertRaises(PariError) as context: + pari.padicprec('O(2^2)', 3) + self.assertTrue('inconsistent moduli in padicprec: 2 != 3' in str(context.exception)) + self.assertEquals(pari.padicprec('O(2^2)', 2), '2') + t = '1+O(2^3)'; + self.assertEquals(pari.padicprec(t, 2), '3') + self.assertEquals(pari.padicprec('(x+2)*(1+O(2^3))', 2), '3') + self.assertEquals(pari.padicprec('(1+2*x+O(x^2))*(1+O(2^3))', 2), '3') + self.assertEquals(pari.padicprec('[2,4]*(1+O(2^3))', 2), '4') + pari.set_real_precision(15) +"""**** Original expected results **** + ++oo ++oo +I +77 +57 +128 +1 + O(x) +1 + O(3^5) +1 +38 ++oo +3 ++oo +2 ++oo + *** at top-level: padicprec(0,"") + *** ^--------------- + *** padicprec: incorrect type in padicprec (t_STR). +1 +1 +2 + *** at top-level: padicprec(O(2^2),3) + *** ^------------------- + *** padicprec: inconsistent moduli in padicprec: 2 != 3 +2 +3 +3 +3 +4 + +""" diff --git a/tests/unittests/prime.py b/tests/unittests/prime.py new file mode 100644 index 0000000..b04d7f1 --- /dev/null +++ b/tests/unittests/prime.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file prime : +test(N)= +{ + default(primelimit, N); + for (b=10, 20, print1(prime(2^b), " ")); + for (b=10, 26, print1(primepi(2^b), " ")); +} + +test(10^6); +test(10^8); +primepi(2^32) +precprime(1) +primepi(2750160) \\ #1855 +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestPrime(unittest.TestCase): + def test_prime(self): + def test(N, res_prime, res_primepi): + pari.default('primelimit', N); + for b in range(10, 21): + self.assertEquals(pari.prime(pow(2, b)), res_prime[b - 10]) + for b in range(10, 27): + self.assertEquals(pari.primepi(pow(2, b)), res_primepi[b - 10]) + + res = ['8161', '17863', '38873', '84017', '180503', '386093', + '821641', '1742537', '3681131', '7754077', '16290047'] + res_pi=['172', '309', '564', '1028', '1900', '3512', '6542', + '12251', '23000', '43390', '82025', '155611', '295947', + '564163', '1077871', '2063689', '3957809'] + + test(int(pow(10, 6)), res, res_pi); + test(int(pow(10, 8)), res, res_pi); + self.assertEquals(pari.primepi(pow(2, 32)), '203280221') + self.assertEquals(pari.precprime(1), '0') + self.assertEquals(pari.primepi(2750160), '200000') # #1855 + +"""**** Original expected results **** + +8161 17863 38873 84017 180503 386093 821641 1742537 3681131 7754077 16290047 + 172 309 564 1028 1900 3512 6542 12251 23000 43390 82025 155611 295947 56416 +3 1077871 2063689 3957809 +8161 17863 38873 84017 180503 386093 821641 1742537 3681131 7754077 16290047 + 172 309 564 1028 1900 3512 6542 12251 23000 43390 82025 155611 295947 56416 +3 1077871 2063689 3957809 +203280221 +0 +200000 + +""" diff --git a/tests/unittests/primes.py b/tests/unittests/primes.py new file mode 100644 index 0000000..e72a840 --- /dev/null +++ b/tests/unittests/primes.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file primes : +primes(50) +primes([-5,5]) +primes([10,20]) +primes([2^32-100,2^32+100]) +primes([2^64-100,2^64+100]) +#primes([2^50,2^50+200000]) +#primes([10^7, 10^7+10^6]) +#primes([2^1023+5000, 2^1023+7000]) +\\#1668 +primes([1,Pol(2)]); +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestPrimes(unittest.TestCase): + def test_primes(self): + self.assertEquals(pari.primes(50), + '[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,' + + ' 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179,' + + ' 181, 191, 193, 197, 199, 211, 223, 227, 229]') + self.assertEquals(pari.primes([-5, 5]), '[2, 3, 5]') + self.assertEquals(pari.primes([10, 20]), '[11, 13, 17, 19]') + self.assertEquals(pari.primes([pow(2, 32) - 100, pow(2, 32) + 100]), + '[4294967197, 4294967231, 4294967279, 4294967291, 4294967311, 4294967357, 4294967371, 429' + + '4967377, 4294967387, 4294967389]') + self.assertEquals(pari.primes(['2^64-100', '2^64+100']), + '[18446744073709551521, 18446744073709551533, 18446744073709551557, 18446744073709551629,' + + ' 18446744073709551653, 18446744073709551667, 18446744073709551697, 18446744073709551709]') + self.assertEquals(len(pari.primes([pow(2, 50), pow(2, 50) + 200000])), 5758) + self.assertEquals(len(pari.primes([pow(10, 7), pow(10, 7) + pow(10, 6)])), 61938) + self.assertEquals(len(pari.primes(['2^1023+5000', '2^1023+7000'])), 2) + with self.assertRaises(PariError) as context: + pari.primes([1, pari.Pol(2)]) + self.assertTrue('incorrect type in primes_interval (t_POL)' in str(context.exception)) + + +"""**** Original expected results **** + +[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, + 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, +157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229] +[2, 3, 5] +[11, 13, 17, 19] +[4294967197, 4294967231, 4294967279, 4294967291, 4294967311, 4294967357, 429 +4967371, 4294967377, 4294967387, 4294967389] +[18446744073709551521, 18446744073709551533, 18446744073709551557, 184467440 +73709551629, 18446744073709551653, 18446744073709551667, 1844674407370955169 +7, 18446744073709551709] +5758 +61938 +2 + *** at top-level: primes([1,Pol(2)]) + *** ^------------------ + *** primes: incorrect type in primes_interval (t_POL). + +""" diff --git a/tests/unittests/qfb.py b/tests/unittests/qfb.py new file mode 100644 index 0000000..7e21ea3 --- /dev/null +++ b/tests/unittests/qfb.py @@ -0,0 +1,134 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file qfb : +vec(x) = [component(x,1), component(x,2), component(x,3)]; +vec( qfbred(Qfb(6,6,-1),1) ) +default(realprecision,38) +q=Qfb(7, 30, -14)^2; +qfbpowraw(q,-1) +q*q^2 +q^0 +q^1 +q^-1 +q^-(2^64+1) +q=Qfb(2, 1, 3); q2=q*q; +q3=qfbcompraw(q,q2) +qfbpowraw(q,3) +qfbred(q3,1) +q=Qfb(1009, 60, 99108027750247771) +qfbnupow(q, 8839368315) +L = sqrtnint(abs(poldisc(q)), 4); +qfbnupow(q, 8839368315,L) +q=Qfb(22000957029,25035917443,7122385192); +qfbred(q) +qfbredsl2(q) +q=Qfb(1099511627776,1879224363605,802966544317); +[qr,U]=qfbredsl2(q) +qfeval(q,U) +qfeval(q,U[,1]) +qfeval(q,U[,2]) +qfeval(q,U[,1],U[,2]) +D=poldisc(q); +qfbredsl2(q,[D,sqrtint(D)]) +qfbredsl2(q,[D]); +qfbredsl2(q,[D,1.]); +p=2^64+13; +qfbprimeform(-4,p) +qfbprimeform(5,p) + +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestQfb(unittest.TestCase): + def test_qfb(self): + def vec(x): + return [pari.component(x, 1), pari.component(x, 2), pari.component(x, 3)]; + + self.assertEquals(str(vec(pari.qfbred(pari.Qfb(6, 6, -1), 1))), '[-1, 6, 6]') + pari.set_real_precision(38) + q=pari('Qfb(7, 30, -14)^2'); + self.assertEquals(pari.qfbpowraw(q,-1), 'Qfb(-2, -34, 17, -1.2031810657666797073140254201751247272)') + # q*q^2 + # q^0 + # q^1 + # q^-1 + # q^-(2^64+1) + q = pari.Qfb(2, 1, 3); + q2 = pari('Qfb(2, 1, 3)*Qfb(2, 1, 3)'); + q3 = pari.qfbcompraw(q, q2) + self.assertEquals(q3, 'Qfb(1, -1, 6)') + self.assertEquals(pari.qfbpowraw(q, 3), 'Qfb(8, 13, 6)') + self.assertEquals(pari.qfbred(q3, 1), 'Qfb(1, 1, 6)') + q = pari.Qfb(1009, 60, 99108027750247771) + self.assertEquals(q, 'Qfb(1009, 60, 99108027750247771)') + self.assertEquals(pari.qfbnupow(q, 8839368315), 'Qfb(1, 0, 100000000000000000039)') + L = pari.sqrtnint(pari.abs(pari.poldisc(q)), 4); + self.assertEquals(pari.qfbnupow(q, 8839368315, L), 'Qfb(1, 0, 100000000000000000039)') + q = pari.Qfb(22000957029, 25035917443, 7122385192); + self.assertEquals(pari.qfbred(q), 'Qfb(1, 1, 6)') + self.assertEquals(pari.qfbredsl2(q), '[Qfb(1, 1, 6), [22479, 76177; -39508, -133885]]') + + q = pari.Qfb('1099511627776', '1879224363605', '802966544317', precision=128); + U = pari.qfbredsl2(q)[1] + self.assertEquals(U, '[127327, -416128; -148995, 486943]') + self.assertEquals(pari.qfeval(q, U), 'Qfb(4, 3, -3, 0.E-38)') + self.assertEquals(pari.qfeval(q, 'qfbredsl2(Qfb(1099511627776,1879224363605,802966544317))[2][,1]'), '4') + self.assertEquals(pari.qfeval(q, 'qfbredsl2(Qfb(1099511627776,1879224363605,802966544317))[2][,2]'), '-3') + self.assertEquals(pari.qfeval(q, 'qfbredsl2(Qfb(1099511627776,1879224363605,802966544317))[2][,1]', + 'qfbredsl2(Qfb(1099511627776,1879224363605,802966544317))[2][,2]'), '3/2') + D = pari.poldisc(q); + self.assertEquals(pari.qfbredsl2(q, [D, pari.sqrtint(D)]), + '[Qfb(4, 3, -3, 0.E-38), [127327, -416128; -148995, 486943]]') + with self.assertRaises(PariError) as context: + pari.qfbredsl2(q, [D]); + self.assertTrue('incorrect type in qfbredsl2 (t_VEC)' in str(context.exception)) + with self.assertRaises(PariError) as context: + pari.qfbredsl2(q, [D, 1.]); + self.assertTrue('incorrect type in qfbredsl2 (t_VEC)' in str(context.exception)) + + p = pow(2, 64) + 13; + self.assertEquals(pari.qfbprimeform(-4, p), + 'Qfb(18446744073709551629, 4741036151112220792, 304625896260305173)') + self.assertEquals(pari.qfbprimeform(5, p), + 'Qfb(18446744073709551629, 7562574061564804959, 775103267656920011, 0.E-38)') + pari.set_real_precision(15) + + +"""**** Original expected results **** + +[-1, 6, 6] +Qfb(-2, -34, 17, -1.2031810657666797073140254201751247272) +Qfb(-2, 34, 17, 3.6095431973000391219420762605253741816) +Qfb(1, 34, -34, 0.E-38) +Qfb(-2, 34, 17, 1.2031810657666797073140254201751247272) +Qfb(17, 34, -2, -2.9945542852277529726974917240067615601) +Qfb(17, 34, -2, -22194773194531041164.334277319893643413) +Qfb(1, -1, 6) +Qfb(8, 13, 6) +Qfb(1, 1, 6) +Qfb(1009, 60, 99108027750247771) +Qfb(1, 0, 100000000000000000039) +Qfb(1, 0, 100000000000000000039) +Qfb(1, 1, 6) +[Qfb(1, 1, 6), [22479, 76177; -39508, -133885]] +[Qfb(4, 3, -3, 0.E-38), [127327, -416128; -148995, 486943]] +Qfb(4, 3, -3, 0.E-38) +4 +-3 +3/2 +[Qfb(4, 3, -3, 0.E-38), [127327, -416128; -148995, 486943]] + *** at top-level: qfbredsl2(q,[D]) + *** ^---------------- + *** qfbredsl2: incorrect type in qfbredsl2 (t_VEC). + *** at top-level: qfbredsl2(q,[D,1.]) + *** ^------------------- + *** qfbredsl2: incorrect type in qfbredsl2 (t_VEC). +Qfb(18446744073709551629, 4741036151112220792, 304625896260305173) +Qfb(18446744073709551629, 7562574061564804959, 775103267656920011, 0.E-38) + +""" diff --git a/tests/unittests/qfbclassno.py b/tests/unittests/qfbclassno.py new file mode 100644 index 0000000..8981fdf --- /dev/null +++ b/tests/unittests/qfbclassno.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file qfbclassno : +qfbclassno(-44507759) +qfbclassno(-57403799) +qfbclassno(-94361767) +qfbclassno(-111385627) +qfbclassno(-136801204) +qfbclassno(-185415288) +qfbclassno(-198154147) +qfbclassno(-223045972) +qfbclassno(-1253840791) +qfbclassno(-1382998299) +qfbclassno(-1567139127) +qfbclassno(-1788799151) +qfbclassno(-1850979435) +qfbclassno(-4386842803) +qfbclassno(-5082406399) +qfbclassno(1-2^100) +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestQfbclassno(unittest.TestCase): + def test_qfbclassno(self): + self.assertEquals(pari.qfbclassno(-44507759), '10125') + self.assertEquals(pari.qfbclassno(-57403799), '11045') + self.assertEquals(pari.qfbclassno(-94361767), '4802') + self.assertEquals(pari.qfbclassno(-111385627), '1660') + self.assertEquals(pari.qfbclassno(-136801204), '2136') + self.assertEquals(pari.qfbclassno(-185415288), '2144') + self.assertEquals(pari.qfbclassno(-198154147), '1508') + self.assertEquals(pari.qfbclassno(-223045972), '2728') + self.assertEquals(pari.qfbclassno(-1253840791), '15376') + self.assertEquals(pari.qfbclassno(-1382998299), '7688') + self.assertEquals(pari.qfbclassno(-1567139127), '15376') + self.assertEquals(pari.qfbclassno(-1788799151), '76800') + self.assertEquals(pari.qfbclassno(-1850979435), '7688') + self.assertEquals(pari.qfbclassno(-4386842803), '8112') + self.assertEquals(pari.qfbclassno(-5082406399), '32448') + self.assertEquals(pari.qfbclassno(1-int(pow(2, 100))), '641278838681600') + +"""**** Original expected results **** + +10125 +11045 +4802 +1660 +2136 +2144 +1508 +2728 +15376 +7688 +15376 +76800 +7688 +8112 +32448 +641278838681600 + +""" diff --git a/tests/unittests/qfsolve.py b/tests/unittests/qfsolve.py new file mode 100644 index 0000000..611d959 --- /dev/null +++ b/tests/unittests/qfsolve.py @@ -0,0 +1,1394 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file qfsolve : +{M=[[-634,-706,-200;-706,527,-110;-200,-110,-997],[-670,164,205;164,-391,-509;205,-509,-117],[586,-448,120;-448,-342,-233;120,-233,-851],[-387,-147,450;-147,-808,-22;450,-22,-119],[739,-44,-48;-44,-739,-134;-48,-134,459],[-519,-45,-514;-45,324,178;-514,178,-83],[-482,-683,18;-683,705,852;18,852,315],[808,-16,555;-16,-723,-538;555,-538,-66],[243,205,-14;205,-119,853;-14,853,891],[-220,10,-564;10,-440,-9;-564,-9,413],[383,66,53;66,-962,-104;53,-104,300],[-845,257,264;257,-7,-866;264,-866,259],[-76,676,371;676,-541,-332;371,-332,-417],[111,-203,-57;-203,-634,-30;-57,-30,275],[-926,-548,-178;-548,483,141;-178,141,-953],[-810,-164,648;-164,-802,-612;648,-612,-274],[818,88,630;88,369,524;630,524,-565],[-165,99,-70;99,83,-716;-70,-716,-493],[-183,56,320;56,509,-931;320,-931,-543],[19,799,-94;799,-866,-658;-94,-658,-604],[-859,-569,525;-569,476,217;525,217,-852],[-527,708,47;708,22,-79;47,-79,902],[360,-425,126;-425,-578,-411;126,-411,581],[2,821,59;821,-893,524;59,524,-788],[470,155,-752;155,-679,-683;-752,-683,-584],[398,107,-644;107,-840,374;-644,374,-274],[-839,8,-410;8,-451,-774;-410,-774,801],[-556,-134,-368;-134,183,566;-368,566,686],[-62,354,-396;354,313,350;-396,350,-891],[518,163,17;163,821,332;17,332,-593],[574,-155,19;-155,424,305;19,305,-978],[-720,873,341;873,-131,-116;341,-116,-414],[417,-39,201;-39,910,-9;201,-9,-538],[-34,-193,-22;-193,-632,362;-22,362,-778],[36,-748,-131;-748,-21,147;-131,147,-143],[-236,-560,-211;-560,803,-632;-211,-632,620],[708,-76,-360;-76,814,248;-360,248,263],[790,-271,-338;-271,-114,-400;-338,-400,-12],[-744,-737,-70;-737,-270,-754;-70,-754,816],[-845,520,141;520,-559,73;141,73,132],[-276,406,-305;406,153,-349;-305,-349,41],[632,62,653;62,-125,439;653,439,-256],[-598,-39,-488;-39,-36,461;-488,461,-506],[406,99,-178;99,747,-99;-178,-99,781],[686,-38,-491;-38,-330,-564;-491,-564,253],[427,69,-615;69,933,215;-615,215,-558],[290,-326,-365;-326,928,208;-365,208,754],[-149,-113,197;-113,877,292;197,292,233],[-701,-265,776;-265,911,-259;776,-259,-531],[81,-169,-170;-169,445,-107;-170,-107,632],[-433,153,215;153,15,-362;215,-362,-77],[-108,10,-734;10,-133,-88;-734,-88,-154],[-48,-365,-68;-365,413,-217;-68,-217,-436],[162,-63,184;-63,-728,-240;184,-240,-845],[-96,-233,-747;-233,951,833;-747,833,-30],[-314,-311,-656;-311,322,-663;-656,-663,-639],[-106,-465,-662;-465,-111,53;-662,53,-97],[-410,166,-445;166,-565,104;-445,104,823],[180,-312,19;-312,984,-10;19,-10,701],[-165,936,-247;936,103,743;-247,743,-414],[-571,451,-527;451,419,-499;-527,-499,-473],[-680,182,651;182,-194,-89;651,-89,-889],[670,75,246;75,72,609;246,609,-58],[-929,-764,508;-764,-984,-405;508,-405,-915],[102,736,116;736,634,722;116,722,-656],[33,214,-533;214,-205,-453;-533,-453,844],[235,270,-692;270,68,-323;-692,-323,729],[945,236,5;236,-506,329;5,329,866],[885,-737,539;-737,908,146;539,146,314],[-179,-252,-29;-252,-966,442;-29,442,-116],[-496,-25,-581;-25,-90,-136;-581,-136,492],[513,432,-290;432,-708,47;-290,47,-933],[364,-386,-310;-386,-460,224;-310,224,-363],[-124,214,795;214,-930,-213;795,-213,818],[69,-552,-189;-552,807,-300;-189,-300,249],[-977,-141,-158;-141,169,199;-158,199,-355],[929,268,383;268,945,618;383,618,943],[177,-329,-78;-329,-953,216;-78,216,644],[-335,-314,-76;-314,-572,-229;-76,-229,-214],[609,-226,65;-226,578,271;65,271,-938],[962,-213,483;-213,-159,383;483,383,473],[-821,-501,368;-501,-602,489;368,489,461],[-636,-385,597;-385,-913,903;597,903,849],[967,350,-825;350,352,475;-825,475,974],[-982,7,98;7,-563,-840;98,-840,-726],[-504,81,-124;81,-470,191;-124,191,-846],[756,273,253;273,932,348;253,348,331],[52,-645,783;-645,-606,-565;783,-565,918],[22,-781,-238;-781,-382,-637;-238,-637,-618],[-405,497,-397;497,-489,-593;-397,-593,-916],[-856,5,85;5,-866,-24;85,-24,-540],[764,-153,9;-153,362,-127;9,-127,-1000],[-551,-637,624;-637,-864,361;624,361,12],[-522,203,-199;203,-239,-581;-199,-581,-228],[724,644,245;644,71,456;245,456,983],[-369,-142,164;-142,-644,302;164,302,580],[-485,-786,-362;-786,-207,-326;-362,-326,-257],[373,-271,514;-271,734,390;514,390,-410],[-223,-301,32;-301,-480,-549;32,-549,358],[-501,82,-557;82,609,-296;-557,-296,962];[394,-209,-606,-399;-209,-552,157,-626;-606,157,144,-188;-399,-626,-188,293],[-870,-559,-338,-156;-559,931,293,-7;-338,293,-920,46;-156,-7,46,-563],[703,435,-32,-310;435,-313,103,-144;-32,103,-262,64;-310,-144,64,-769],[523,481,141,-252;481,-291,-403,7;141,-403,-625,-556;-252,7,-556,847],[473,331,-38,-36;331,-346,-409,58;-38,-409,-864,-20;-36,58,-20,-299],[847,138,609,-195;138,-215,232,-257;609,232,953,220;-195,-257,220,63],[544,-494,56,-441;-494,-73,154,-847;56,154,-427,565;-441,-847,565,-503],[-548,200,253,353;200,-582,142,278;253,142,-514,-577;353,278,-577,-555],[-954,-835,-720,-541;-835,-642,116,74;-720,116,-939,168;-541,74,168,32],[-921,16,-253,-807;16,559,-16,-401;-253,-16,604,591;-807,-401,591,848],[-184,326,-437,151;326,-560,373,-103;-437,373,-913,-731;151,-103,-731,735],[637,57,-209,785;57,708,463,-909;-209,463,197,-275;785,-909,-275,751],[901,175,-364,245;175,14,141,811;-364,141,-104,-499;245,811,-499,-705],[-184,942,-258,171;942,-149,-629,366;-258,-629,-935,216;171,366,216,986],[661,647,-235,-432;647,-176,177,192;-235,177,-123,379;-432,192,379,-760],[-957,440,-161,-888;440,2,-148,-48;-161,-148,-598,-743;-888,-48,-743,550],[959,720,-158,225;720,-588,-46,258;-158,-46,530,-753;225,258,-753,367],[291,-64,-481,-53;-64,829,386,305;-481,386,638,213;-53,305,213,22],[949,-74,304,129;-74,-143,-673,-167;304,-673,545,-43;129,-167,-43,-485],[217,861,-669,-333;861,884,-12,675;-669,-12,110,-540;-333,675,-540,67],[957,-415,416,493;-415,862,148,-308;416,148,453,-253;493,-308,-253,-822],[-838,-392,-57,-288;-392,-83,130,323;-57,130,87,199;-288,323,199,-464],[-43,256,-625,-195;256,-320,362,1;-625,362,-611,-142;-195,1,-142,-538],[-524,-608,-260,-17;-608,-211,-123,-438;-260,-123,633,-264;-17,-438,-264,659],[139,-93,776,-239;-93,384,67,-639;776,67,-561,-645;-239,-639,-645,895],[704,-399,-485,-425;-399,-519,748,163;-485,748,-182,-274;-425,163,-274,834],[67,-693,-88,664;-693,987,39,-62;-88,39,-915,-327;664,-62,-327,-434],[-901,102,-239,-270;102,-311,-212,591;-239,-212,771,-105;-270,591,-105,502],[-58,-876,422,-195;-876,-105,-761,-819;422,-761,-760,379;-195,-819,379,117],[995,22,48,-495;22,519,368,-411;48,368,-925,720;-495,-411,720,632],[445,-738,-222,299;-738,-786,-232,-352;-222,-232,-619,-341;299,-352,-341,81],[-490,495,1,-342;495,-222,192,608;1,192,6,-412;-342,608,-412,-723],[684,-101,124,-102;-101,395,-184,413;124,-184,-731,14;-102,413,14,-945],[102,-118,-635,-737;-118,-652,37,575;-635,37,-879,-84;-737,575,-84,748],[732,-244,-50,270;-244,-277,53,574;-50,53,-224,683;270,574,683,223],[466,-48,-330,-472;-48,-834,699,-489;-330,699,-318,745;-472,-489,745,859],[252,72,115,248;72,-846,11,-645;115,11,289,281;248,-645,281,-276],[270,537,-17,345;537,289,-338,489;-17,-338,429,-701;345,489,-701,-214],[731,812,-291,-457;812,-9,-77,294;-291,-77,217,156;-457,294,156,-646],[246,160,-739,53;160,560,-7,437;-739,-7,-803,13;53,437,13,4],[789,-415,-730,436;-415,905,-467,34;-730,-467,97,-35;436,34,-35,128],[111,120,-205,-83;120,358,-58,284;-205,-58,-131,-463;-83,284,-463,825],[96,-218,-174,-75;-218,-200,378,201;-174,378,-221,-29;-75,201,-29,169],[841,-443,244,834;-443,-46,774,-48;244,774,188,194;834,-48,194,-966],[-622,430,-699,-145;430,-977,30,-116;-699,30,-781,-447;-145,-116,-447,452],[787,-20,-232,-250;-20,-50,310,-314;-232,310,-106,422;-250,-314,422,-894],[17,275,-251,-497;275,-581,-179,196;-251,-179,-643,-558;-497,196,-558,-114],[-867,-236,-249,300;-236,318,-308,237;-249,-308,721,-321;300,237,-321,531],[738,575,-59,145;575,721,-480,442;-59,-480,592,170;145,442,170,-757],[201,121,-379,162;121,-469,-132,378;-379,-132,-272,309;162,378,309,-280],[908,109,-209,-921;109,-203,495,371;-209,495,350,240;-921,371,240,-571],[93,29,-738,-360;29,-715,287,-725;-738,287,-523,-109;-360,-725,-109,16],[-97,-86,131,-369;-86,231,-168,30;131,-168,-751,-484;-369,30,-484,-399],[-815,-360,-481,-48;-360,320,326,191;-481,326,555,548;-48,191,548,-707],[96,235,-680,612;235,748,-74,-298;-680,-74,-648,-670;612,-298,-670,622],[-39,-344,297,-252;-344,834,-77,41;297,-77,-60,-279;-252,41,-279,645],[914,196,209,-238;196,-7,44,447;209,44,16,-194;-238,447,-194,-632],[-314,163,756,341;163,982,-61,288;756,-61,706,-76;341,288,-76,-321],[-492,-316,-59,-350;-316,-861,-647,-270;-59,-647,837,-90;-350,-270,-90,-629],[-565,450,97,156;450,984,-271,-315;97,-271,583,-40;156,-315,-40,-110],[-496,-37,98,-453;-37,-152,-81,-349;98,-81,-811,-292;-453,-349,-292,-688],[953,281,-556,904;281,311,-557,-644;-556,-557,845,100;904,-644,100,-359],[-643,497,-310,-229;497,-925,172,255;-310,172,-151,350;-229,255,350,854],[863,150,318,-30;150,-522,-464,-274;318,-464,-942,-256;-30,-274,-256,228],[-211,493,-509,-6;493,215,344,-548;-509,344,227,-727;-6,-548,-727,-682],[-276,-9,204,515;-9,-80,-2,-211;204,-2,-842,43;515,-211,43,543],[-169,669,215,22;669,92,370,18;215,370,684,123;22,18,123,707],[-577,-130,-286,-189;-130,-529,-189,-770;-286,-189,381,-12;-189,-770,-12,-169],[952,-268,40,545;-268,-710,-236,196;40,-236,-559,-115;545,196,-115,571],[418,132,-154,278;132,928,116,-122;-154,116,538,-528;278,-122,-528,37],[782,83,-31,351;83,-662,-39,-609;-31,-39,-414,-249;351,-609,-249,215],[318,532,-172,-248;532,-783,-399,10;-172,-399,-877,823;-248,10,823,-748],[-68,233,-456,-484;233,225,-375,455;-456,-375,-324,188;-484,455,188,-250],[-684,-179,65,466;-179,647,-392,-1;65,-392,-222,292;466,-1,292,-251],[-592,447,-605,51;447,-233,430,67;-605,430,-573,-263;51,67,-263,-506],[-43,308,-326,-746;308,-241,-537,-197;-326,-537,-407,34;-746,-197,34,112],[112,95,137,533;95,317,807,711;137,807,4,26;533,711,26,-792],[755,-108,121,-537;-108,-730,-485,-202;121,-485,753,29;-537,-202,29,965],[-54,235,113,192;235,320,-837,-258;113,-837,398,-498;192,-258,-498,683],[-852,55,-567,102;55,612,-594,460;-567,-594,29,-501;102,460,-501,-213],[4,-100,473,-28;-100,202,64,48;473,64,-593,-616;-28,48,-616,-834],[-692,-666,531,-306;-666,559,49,-619;531,49,-390,-730;-306,-619,-730,324],[-641,-381,108,62;-381,118,-110,-194;108,-110,697,329;62,-194,329,-869],[281,752,-869,350;752,-545,-169,138;-869,-169,782,-376;350,138,-376,97],[-58,647,-85,391;647,-968,459,-166;-85,459,469,323;391,-166,323,-104],[-20,728,757,569;728,531,530,-500;757,530,-47,101;569,-500,101,-500],[-980,413,-81,602;413,647,118,30;-81,118,-787,-709;602,30,-709,582],[518,-59,335,247;-59,-184,460,-518;335,460,510,-216;247,-518,-216,-7],[762,-305,724,-25;-305,-328,805,414;724,805,-942,-83;-25,414,-83,-88],[388,-318,-111,416;-318,146,-678,742;-111,-678,35,543;416,742,543,891],[402,5,-176,845;5,-56,-427,-745;-176,-427,217,196;845,-745,196,363],[981,159,-168,186;159,760,-718,816;-168,-718,356,-245;186,816,-245,244],[495,-302,243,-33;-302,-118,97,-204;243,97,20,192;-33,-204,192,153],[954,-725,339,422;-725,-4,-230,712;339,-230,-57,-11;422,712,-11,-690],[765,-702,29,-644;-702,789,-366,75;29,-366,49,-479;-644,75,-479,575],[-62,381,327,631;381,577,-512,-672;327,-512,146,158;631,-672,158,126],[-947,541,87,-893;541,-495,-41,-665;87,-41,861,60;-893,-665,60,175],[-910,488,-479,-431;488,991,143,229;-479,143,783,-356;-431,229,-356,-333],[846,-356,-144,-336;-356,888,-228,-471;-144,-228,-194,-647;-336,-471,-647,-724],[-10,454,119,65;454,468,-597,260;119,-597,567,-110;65,260,-110,106];[-564,568,485,513,7;568,-526,612,-346,460;485,612,183,-757,-36;513,-346,-757,-536,505;7,460,-36,505,693],[-379,-94,-635,347,-257;-94,-489,84,-418,229;-635,84,361,-107,-17;347,-418,-107,-48,-715;-257,229,-17,-715,-966],[533,-388,15,340,-489;-388,-366,-37,-836,-93;15,-37,627,328,-271;340,-836,328,-576,-812;-489,-93,-271,-812,-769],[-518,-276,-221,336,787;-276,307,463,342,374;-221,463,-417,499,428;336,342,499,-572,-117;787,374,428,-117,-648],[-63,-268,835,-443,-432;-268,-811,713,-136,-363;835,713,58,151,791;-443,-136,151,-517,-412;-432,-363,791,-412,104],[-95,-786,24,-81,-432;-786,744,139,312,251;24,139,423,298,479;-81,312,298,-672,-239;-432,251,479,-239,9],[888,-546,-211,69,-50;-546,220,59,432,76;-211,59,454,552,432;69,432,552,283,-368;-50,76,432,-368,614],[-164,-64,-626,247,-567;-64,116,-387,584,-334;-626,-387,555,-430,553;247,584,-430,213,-966;-567,-334,553,-966,929],[626,493,-33,391,-355;493,868,-572,193,394;-33,-572,252,-258,-172;391,193,-258,-822,349;-355,394,-172,349,359],[-554,412,-131,31,507;412,794,-428,-31,44;-131,-428,683,-157,330;31,-31,-157,-780,464;507,44,330,464,-750],[45,210,831,-678,-52;210,-539,157,219,-94;831,157,452,698,-380;-678,219,698,-203,-513;-52,-94,-380,-513,-221],[148,-171,-445,202,659;-171,-531,551,-48,-440;-445,551,502,18,-69;202,-48,18,240,-437;659,-440,-69,-437,-778],[-544,-88,-52,-34,-341;-88,238,517,527,306;-52,517,-192,403,79;-34,527,403,210,471;-341,306,79,471,781],[463,-680,-929,668,294;-680,-264,682,-498,864;-929,682,-503,-903,-562;668,-498,-903,438,-217;294,864,-562,-217,-58],[-66,-495,-201,-401,-128;-495,171,570,-139,-745;-201,570,614,-566,356;-401,-139,-566,-818,-797;-128,-745,356,-797,967],[-768,345,73,-335,-489;345,-478,52,211,-100;73,52,94,0,264;-335,211,0,619,-695;-489,-100,264,-695,447],[-239,-24,198,-123,-152;-24,374,-611,-425,-191;198,-611,589,-615,336;-123,-425,-615,26,-782;-152,-191,336,-782,950],[-336,670,8,196,86;670,857,144,-710,-682;8,144,648,-21,854;196,-710,-21,936,923;86,-682,854,923,-368],[-536,235,-207,-112,-499;235,-391,-900,106,189;-207,-900,346,-359,581;-112,106,-359,-461,-341;-499,189,581,-341,269],[-264,431,731,73,-190;431,-513,-131,-101,-23;731,-131,-223,119,245;73,-101,119,-553,511;-190,-23,245,511,530],[943,-212,171,-448,-45;-212,-613,286,-453,-603;171,286,-36,-8,-134;-448,-453,-8,-452,-372;-45,-603,-134,-372,-610],[434,-204,457,47,-340;-204,-163,705,327,49;457,705,-463,-555,-40;47,327,-555,-996,-402;-340,49,-40,-402,421],[202,-242,-953,-143,-284;-242,161,225,-197,-828;-953,225,151,-407,808;-143,-197,-407,535,348;-284,-828,808,348,-688],[-668,725,-427,528,330;725,813,-586,-488,209;-427,-586,951,107,-254;528,-488,107,2,-472;330,209,-254,-472,294],[-839,-247,50,445,-82;-247,114,-527,-150,-201;50,-527,-504,-233,96;445,-150,-233,863,697;-82,-201,96,697,254],[-975,-683,-223,410,591;-683,-56,-133,-592,424;-223,-133,-633,174,-339;410,-592,174,453,-286;591,424,-339,-286,-850],[69,75,609,39,182;75,36,292,587,251;609,292,-678,151,-196;39,587,151,-906,-435;182,251,-196,-435,948],[-102,251,-928,478,-2;251,-622,449,-307,-166;-928,449,-832,512,0;478,-307,512,925,491;-2,-166,0,491,646],[14,768,-575,216,555;768,-196,422,772,-823;-575,422,-373,684,305;216,772,684,904,569;555,-823,305,569,15],[741,-172,99,-82,-553;-172,-787,573,320,225;99,573,-672,-740,569;-82,320,-740,-198,-943;-553,225,569,-943,-413],[-981,21,38,19,43;21,-55,-303,568,243;38,-303,-376,-55,-721;19,568,-55,83,-402;43,243,-721,-402,943],[710,97,-685,411,71;97,-324,773,-582,597;-685,773,-692,393,-204;411,-582,393,410,11;71,597,-204,11,-238],[-765,404,-10,-80,251;404,-195,2,167,304;-10,2,369,328,308;-80,167,328,-859,-281;251,304,308,-281,151],[126,584,513,334,-25;584,-358,-99,27,329;513,-99,793,-106,195;334,27,-106,-532,-18;-25,329,195,-18,617],[732,-546,81,-379,-399;-546,-205,79,19,-73;81,79,987,-435,575;-379,19,-435,999,-90;-399,-73,575,-90,-341],[-373,-891,190,539,327;-891,-997,-89,185,433;190,-89,778,-1,-337;539,185,-1,394,-141;327,433,-337,-141,281],[-624,102,-778,200,-350;102,-748,-333,146,-243;-778,-333,-10,90,145;200,146,90,-728,146;-350,-243,145,146,-166],[-848,-806,255,240,283;-806,373,744,858,404;255,744,-504,55,-867;240,858,55,950,101;283,404,-867,101,427],[302,-557,-629,100,8;-557,-627,502,60,226;-629,502,-812,748,352;100,60,748,658,330;8,226,352,330,-252],[280,575,579,-515,257;575,-355,-201,203,163;579,-201,689,-540,58;-515,203,-540,737,-342;257,163,58,-342,485],[491,353,76,-533,337;353,756,-358,-237,105;76,-358,-301,350,-232;-533,-237,350,905,558;337,105,-232,558,616],[-594,299,-104,-275,37;299,883,503,695,592;-104,503,-275,199,248;-275,695,199,21,-32;37,592,248,-32,692],[-79,448,106,323,-45;448,-967,649,351,400;106,649,-458,-435,275;323,351,-435,-117,-759;-45,400,275,-759,-165],[-740,-85,540,-27,244;-85,-934,472,575,171;540,472,-947,476,550;-27,575,476,-582,566;244,171,550,566,-509],[831,-113,-331,92,-472;-113,89,110,-295,93;-331,110,338,665,-273;92,-295,665,-754,558;-472,93,-273,558,-883],[277,-733,-472,67,638;-733,170,-229,160,-805;-472,-229,510,-61,-135;67,160,-61,-89,-231;638,-805,-135,-231,769],[567,517,-261,-38,357;517,386,2,777,226;-261,2,590,-394,-296;-38,777,-394,188,-236;357,226,-296,-236,209],[-697,-632,494,513,-241;-632,95,-245,487,100;494,-245,-37,0,15;513,487,0,717,-33;-241,100,15,-33,440],[-474,-135,-35,-406,-241;-135,-128,402,-26,-170;-35,402,-933,-41,-138;-406,-26,-41,791,-167;-241,-170,-138,-167,-286],[-854,-121,-48,-570,419;-121,-59,22,-196,368;-48,22,-194,-258,-46;-570,-196,-258,497,6;419,368,-46,6,-124],[-306,470,671,-322,41;470,988,-964,131,193;671,-964,-218,175,378;-322,131,175,470,-50;41,193,378,-50,506],[478,-324,-581,89,540;-324,-885,-57,-600,-464;-581,-57,785,-69,-182;89,-600,-69,-595,157;540,-464,-182,157,-322],[-724,62,466,-176,570;62,-735,181,-420,-19;466,181,53,-293,-14;-176,-420,-293,-990,344;570,-19,-14,344,-771],[-429,13,-134,543,-175;13,-200,-702,291,-202;-134,-702,684,-389,321;543,291,-389,-510,189;-175,-202,321,189,-713],[919,83,-70,309,-566;83,-977,402,-190,-312;-70,402,-829,-533,106;309,-190,-533,-306,-35;-566,-312,106,-35,-599],[-620,-223,29,-150,-213;-223,248,497,-768,-305;29,497,-657,798,0;-150,-768,798,930,30;-213,-305,0,30,-51],[-965,53,-98,155,195;53,-349,634,225,948;-98,634,-847,125,573;155,225,125,33,507;195,948,573,507,-390],[-526,338,50,394,607;338,435,-100,590,403;50,-100,-480,-228,792;394,590,-228,-377,-478;607,403,792,-478,514],[-293,280,-137,60,247;280,-6,116,-506,177;-137,116,-906,764,452;60,-506,764,-420,275;247,177,452,275,294],[307,490,-31,-208,347;490,-456,726,-453,113;-31,726,-892,450,-532;-208,-453,450,-393,-230;347,113,-532,-230,-417],[700,408,-90,-330,249;408,325,-344,-6,64;-90,-344,608,358,-550;-330,-6,358,342,388;249,64,-550,388,628],[-668,-7,558,-90,3;-7,805,67,158,8;558,67,178,-635,401;-90,158,-635,-163,-413;3,8,401,-413,-501],[-940,319,-177,-311,170;319,-588,749,843,403;-177,749,-134,-381,-577;-311,843,-381,-709,-161;170,403,-577,-161,995],[458,-800,-2,-551,-101;-800,-832,477,-256,329;-2,477,384,-263,183;-551,-256,-263,800,-468;-101,329,183,-468,-321],[-198,-129,-271,347,-584;-129,182,36,-962,-226;-271,36,-274,-336,-522;347,-962,-336,456,-115;-584,-226,-522,-115,557],[360,283,902,651,-69;283,-673,-326,-867,39;902,-326,199,130,582;651,-867,130,471,37;-69,39,582,37,796],[-795,-20,-143,-308,554;-20,-521,609,174,563;-143,609,-539,44,159;-308,174,44,122,-707;554,563,159,-707,-584],[-885,550,178,-421,145;550,-413,-180,-757,578;178,-180,-501,208,345;-421,-757,208,-882,136;145,578,345,136,-705],[188,552,-114,248,-867;552,-594,-348,266,-172;-114,-348,-428,604,242;248,266,604,617,-81;-867,-172,242,-81,867],[702,361,239,-502,172;361,-932,-89,-486,-789;239,-89,991,91,349;-502,-486,91,447,280;172,-789,349,280,-236],[-717,-249,-608,-505,97;-249,-222,-65,157,505;-608,-65,-796,697,614;-505,157,697,187,139;97,505,614,139,-747],[829,126,59,-147,-5;126,-239,-261,-327,475;59,-261,-13,-210,-417;-147,-327,-210,594,-249;-5,475,-417,-249,637],[710,116,-118,709,285;116,-847,-351,28,-535;-118,-351,-348,232,-256;709,28,232,479,-382;285,-535,-256,-382,906],[-383,-85,563,-666,563;-85,924,974,356,211;563,974,14,250,-510;-666,356,250,458,166;563,211,-510,166,753],[-968,18,-75,638,-462;18,-37,79,-504,-92;-75,79,-543,72,253;638,-504,72,-896,929;-462,-92,253,929,-319],[614,-856,-127,541,-245;-856,-676,816,-940,-298;-127,816,-220,-522,140;541,-940,-522,878,581;-245,-298,140,581,245],[-85,-34,-122,-478,-115;-34,-759,-367,-193,603;-122,-367,605,276,79;-478,-193,276,798,508;-115,603,79,508,592],[-333,-138,-112,-263,179;-138,817,756,-48,391;-112,756,969,-731,752;-263,-48,-731,156,-321;179,391,752,-321,-712],[477,249,-294,-37,336;249,440,-302,622,-527;-294,-302,-692,-319,-269;-37,622,-319,685,-541;336,-527,-269,-541,-967],[-873,138,-286,-799,317;138,779,-78,13,-300;-286,-78,394,24,61;-799,13,24,-578,-441;317,-300,61,-441,178],[731,432,388,128,763;432,-160,-144,-97,24;388,-144,888,330,135;128,-97,330,-884,-301;763,24,135,-301,-902],[903,29,435,-334,522;29,876,526,26,449;435,526,-16,162,27;-334,26,162,-659,-382;522,449,27,-382,262],[-379,-816,431,-196,-632;-816,-939,-65,-621,111;431,-65,254,247,-416;-196,-621,247,-377,-50;-632,111,-416,-50,493],[-140,-350,-271,364,-657;-350,-321,-101,-87,-648;-271,-101,117,-376,-616;364,-87,-376,-331,26;-657,-648,-616,26,-793],[-846,962,-39,798,-742;962,-844,404,123,562;-39,404,-536,44,-729;798,123,44,-552,71;-742,562,-729,71,-458],[-943,-160,-175,148,-289;-160,625,624,-87,123;-175,624,-198,-23,-459;148,-87,-23,-854,291;-289,123,-459,291,119],[125,24,-75,172,605;24,-192,-385,707,129;-75,-385,-106,-110,-81;172,707,-110,179,239;605,129,-81,239,-216],[329,-86,307,-776,-546;-86,818,256,100,-332;307,256,-805,-398,321;-776,100,-398,-761,-576;-546,-332,321,-576,-2],[934,-696,-129,-171,-99;-696,-882,385,-535,-707;-129,385,488,305,8;-171,-535,305,-27,465;-99,-707,8,465,-329],[-279,11,260,-35,-333;11,175,-854,-246,-126;260,-854,-31,487,43;-35,-246,487,-775,195;-333,-126,43,195,-956],[-999,613,-166,-58,808;613,-518,-574,-664,416;-166,-574,-387,313,95;-58,-664,313,872,-34;808,416,95,-34,851],[-746,-456,-738,326,418;-456,418,848,62,483;-738,848,-980,104,-547;326,62,104,118,-18;418,483,-547,-18,301],[268,-302,-195,725,103;-302,-931,-885,812,-278;-195,-885,-3,-572,-280;725,812,-572,719,867;103,-278,-280,867,551],[544,230,-284,344,-698;230,-593,-370,-322,576;-284,-370,-979,-118,-9;344,-322,-118,942,714;-698,576,-9,714,-851],[301,-368,-694,45,212;-368,388,110,-530,-364;-694,110,271,-9,418;45,-530,-9,-838,-239;212,-364,418,-239,-448],[-243,224,27,249,337;224,317,-432,-383,133;27,-432,-681,779,-89;249,-383,779,844,405;337,133,-89,405,138],[481,61,-452,385,-156;61,-549,-691,-389,-36;-452,-691,597,345,-685;385,-389,345,-748,598;-156,-36,-685,598,-745],[-586,846,126,-357,704;846,-840,746,-6,203;126,746,673,-556,-262;-357,-6,-556,556,-206;704,203,-262,-206,663],[796,-218,-314,-352,214;-218,-973,649,-525,410;-314,649,-108,-642,-177;-352,-525,-642,139,-568;214,410,-177,-568,-655],[540,393,834,299,-166;393,153,35,109,150;834,35,-660,-529,569;299,109,-529,695,558;-166,150,569,558,989];[250,623,394,139,394,-485;623,950,605,-643,19,-311;394,605,-188,799,386,-600;139,-643,799,248,659,-616;394,19,386,659,236,-145;-485,-311,-600,-616,-145,-743],[899,543,-487,324,-284,-752;543,-305,-138,-108,-66,-360;-487,-138,-936,121,573,506;324,-108,121,164,-5,-438;-284,-66,573,-5,-878,151;-752,-360,506,-438,151,-891],[-349,136,-393,659,-232,488;136,42,806,279,327,313;-393,806,687,588,-121,223;659,279,588,109,-205,714;-232,327,-121,-205,684,-747;488,313,223,714,-747,192],[932,463,-748,68,-150,-264;463,-444,384,866,726,125;-748,384,-31,-160,804,179;68,866,-160,-498,159,-183;-150,726,804,159,794,463;-264,125,179,-183,463,-507],[519,132,272,-150,56,-96;132,451,38,560,-365,190;272,38,-686,135,-238,-510;-150,560,135,353,-129,240;56,-365,-238,-129,571,-256;-96,190,-510,240,-256,-627],[-694,137,-268,131,-429,-201;137,-130,-69,-39,-130,336;-268,-69,622,-515,174,453;131,-39,-515,-333,165,-316;-429,-130,174,165,853,836;-201,336,453,-316,836,-31],[920,-703,166,174,-451,124;-703,-651,56,297,-34,-24;166,56,530,148,14,516;174,297,148,503,317,82;-451,-34,14,317,934,350;124,-24,516,82,350,-921],[284,333,-642,510,563,441;333,909,442,561,-372,-319;-642,442,72,684,46,-802;510,561,684,-936,-48,285;563,-372,46,-48,546,221;441,-319,-802,285,221,-149],[556,-200,75,-156,529,264;-200,-689,-314,98,-144,-60;75,-314,110,-517,-399,81;-156,98,-517,768,471,706;529,-144,-399,471,-607,134;264,-60,81,706,134,-336],[-31,76,-13,412,-442,-71;76,-179,-306,469,-82,-107;-13,-306,-505,162,71,253;412,469,162,-376,190,231;-442,-82,71,190,-374,-517;-71,-107,253,231,-517,467],[-52,334,-360,-86,-466,80;334,478,43,-203,500,-33;-360,43,294,417,-590,-507;-86,-203,417,305,772,480;-466,500,-590,772,-476,180;80,-33,-507,480,180,-603],[-534,-134,-366,388,-656,-393;-134,-847,565,-148,372,137;-366,565,-550,-68,-262,-716;388,-148,-68,-832,254,162;-656,372,-262,254,-795,47;-393,137,-716,162,47,870],[-49,385,306,-659,479,-423;385,811,-288,5,608,-839;306,-288,-851,-383,-206,117;-659,5,-383,-936,408,569;479,608,-206,408,-438,-203;-423,-839,117,569,-203,-584],[138,-137,32,189,-635,168;-137,-782,19,-224,-133,-523;32,19,726,-57,271,-138;189,-224,-57,-884,-565,-630;-635,-133,271,-565,-305,529;168,-523,-138,-630,529,390],[-875,-791,-144,511,108,-164;-791,-59,-596,6,-520,534;-144,-596,-721,355,201,-129;511,6,355,738,-58,-318;108,-520,201,-58,-41,436;-164,534,-129,-318,436,-743],[457,540,-477,847,412,-89;540,-196,305,841,20,176;-477,305,293,-290,-627,-747;847,841,-290,-962,-147,33;412,20,-627,-147,-651,824;-89,176,-747,33,824,-472],[440,36,42,-257,307,556;36,112,-417,496,-199,298;42,-417,-624,417,395,195;-257,496,417,291,407,142;307,-199,395,407,-724,-167;556,298,195,142,-167,486],[-56,311,800,-536,-91,451;311,724,-120,403,159,339;800,-120,-169,-600,304,-562;-536,403,-600,-444,-404,-475;-91,159,304,-404,886,163;451,339,-562,-475,163,701],[831,-9,-193,250,-259,-177;-9,-279,-447,671,-344,243;-193,-447,119,250,-220,-13;250,671,250,-404,359,-171;-259,-344,-220,359,-77,-141;-177,243,-13,-171,-141,-71],[-290,-385,-7,232,300,-595;-385,715,544,-108,-746,-590;-7,544,365,-105,-187,-159;232,-108,-105,-923,582,334;300,-746,-187,582,-281,651;-595,-590,-159,334,651,322],[-907,229,-390,78,347,-413;229,945,-480,151,-738,711;-390,-480,-89,-188,-693,6;78,151,-188,656,-586,443;347,-738,-693,-586,-751,-396;-413,711,6,443,-396,-17],[-915,-17,591,161,16,-448;-17,177,300,723,326,0;591,300,489,-680,-591,279;161,723,-680,-119,-371,-937;16,326,-591,-371,-724,-244;-448,0,279,-937,-244,-270],[-376,-205,333,-491,171,364;-205,968,120,251,-80,-334;333,120,-33,-346,-517,-757;-491,251,-346,-74,-261,618;171,-80,-517,-261,-537,169;364,-334,-757,618,169,-464],[-158,-435,-280,29,549,-51;-435,-742,427,308,817,-432;-280,427,-317,544,472,-361;29,308,544,-951,256,35;549,817,472,256,907,284;-51,-432,-361,35,284,460],[-497,-300,-715,433,44,-341;-300,296,-76,-900,-319,-644;-715,-76,239,710,-30,-232;433,-900,710,-780,25,-612;44,-319,-30,25,-91,677;-341,-644,-232,-612,677,963],[-483,-373,254,58,112,-472;-373,781,-720,645,432,442;254,-720,227,145,719,-242;58,645,145,-265,-308,-19;112,432,719,-308,-110,305;-472,442,-242,-19,305,-641],[426,717,-190,194,600,-397;717,-324,392,98,238,68;-190,392,-313,316,-723,535;194,98,316,721,419,483;600,238,-723,419,-820,9;-397,68,535,483,9,737],[-682,519,-724,-204,-606,-348;519,-484,299,23,-49,-319;-724,299,-794,342,-498,36;-204,23,342,276,611,332;-606,-49,-498,611,-962,-432;-348,-319,36,332,-432,-955],[971,-610,-29,-607,146,-692;-610,-906,-177,217,536,-522;-29,-177,398,-61,49,-333;-607,217,-61,-421,-69,-21;146,536,49,-69,578,754;-692,-522,-333,-21,754,-889],[137,612,379,731,-89,149;612,-706,-257,-698,507,290;379,-257,110,407,455,260;731,-698,407,659,82,-404;-89,507,455,82,-618,-136;149,290,260,-404,-136,-790],[714,-226,-159,177,-129,450;-226,381,-254,-349,-409,95;-159,-254,-961,129,446,-302;177,-349,129,-396,-198,-214;-129,-409,446,-198,415,-123;450,95,-302,-214,-123,415],[141,699,-683,-890,449,-692;699,-533,-356,293,-166,268;-683,-356,-473,32,-16,151;-890,293,32,-183,240,335;449,-166,-16,240,-534,-122;-692,268,151,335,-122,266],[-307,377,889,-520,-105,-446;377,900,305,302,43,297;889,305,-834,187,-880,294;-520,302,187,-446,-649,-515;-105,43,-880,-649,662,-387;-446,297,294,-515,-387,-570],[-526,-630,488,-512,101,-657;-630,212,-529,-261,-16,7;488,-529,429,172,105,-875;-512,-261,172,-720,172,230;101,-16,105,172,724,-11;-657,7,-875,230,-11,833],[704,840,-58,-261,667,-482;840,-160,90,-382,-89,462;-58,90,-133,59,281,-62;-261,-382,59,-485,784,4;667,-89,281,784,-563,67;-482,462,-62,4,67,-634],[-462,-146,772,494,397,834;-146,174,23,377,15,528;772,23,-445,-144,116,-225;494,377,-144,660,-471,-251;397,15,116,-471,455,-443;834,528,-225,-251,-443,580],[-48,-185,267,-414,206,-165;-185,592,-46,269,84,-306;267,-46,251,-64,-640,82;-414,269,-64,878,-529,-361;206,84,-640,-529,840,48;-165,-306,82,-361,48,929],[376,830,212,-693,32,-372;830,-39,37,-397,140,74;212,37,384,-533,621,577;-693,-397,-533,492,348,-103;32,140,621,348,-107,169;-372,74,577,-103,169,-106],[-460,583,225,-2,687,55;583,724,294,-832,17,-361;225,294,-714,86,-234,272;-2,-832,86,-598,199,-81;687,17,-234,199,-370,-394;55,-361,272,-81,-394,-16],[-352,-297,28,362,-321,-290;-297,972,10,227,-145,526;28,10,-794,-10,397,305;362,227,-10,-94,-400,-430;-321,-145,397,-400,869,352;-290,526,305,-430,352,-93],[-699,-128,29,418,-137,946;-128,-946,293,336,152,-100;29,293,473,-603,233,-260;418,336,-603,883,882,-183;-137,152,233,882,248,-197;946,-100,-260,-183,-197,-688],[696,-143,489,-228,405,549;-143,-919,749,-176,-471,-816;489,749,-221,-272,598,671;-228,-176,-272,652,-51,-6;405,-471,598,-51,563,-734;549,-816,671,-6,-734,360],[-521,405,92,352,-158,-111;405,-696,-361,115,-444,-459;92,-361,871,142,267,-36;352,115,142,905,253,-199;-158,-444,267,253,-320,189;-111,-459,-36,-199,189,-46],[-790,367,117,-43,175,409;367,654,131,-823,-37,377;117,131,89,-14,-185,-317;-43,-823,-14,963,241,767;175,-37,-185,241,-141,-149;409,377,-317,767,-149,811],[-250,666,475,-73,701,-21;666,-136,214,213,-718,185;475,214,-42,456,177,-302;-73,213,456,191,15,231;701,-718,177,15,-331,-490;-21,185,-302,231,-490,-339],[-20,-312,-255,12,-45,123;-312,415,-415,311,-577,424;-255,-415,700,229,-535,222;12,311,229,763,-800,986;-45,-577,-535,-800,784,-45;123,424,222,986,-45,689],[85,-623,-81,-82,440,358;-623,-864,244,108,-61,210;-81,244,-158,46,215,-33;-82,108,46,-955,-36,-402;440,-61,215,-36,-236,-879;358,210,-33,-402,-879,-70],[-750,-192,-92,279,-99,-155;-192,658,-202,628,-366,-563;-92,-202,194,203,38,335;279,628,203,-276,-149,-27;-99,-366,38,-149,550,-79;-155,-563,335,-27,-79,-310],[959,206,-23,-249,793,256;206,-19,-578,284,-8,539;-23,-578,318,-396,292,538;-249,284,-396,394,581,112;793,-8,292,581,721,-371;256,539,538,112,-371,-869],[157,372,-914,641,146,-734;372,-704,130,631,250,466;-914,130,-789,526,675,-252;641,631,526,-341,155,93;146,250,675,155,-321,-845;-734,466,-252,93,-845,18],[408,179,-258,-35,370,-745;179,753,-494,-183,-725,512;-258,-494,255,447,-200,-648;-35,-183,447,912,596,125;370,-725,-200,596,-262,250;-745,512,-648,125,250,-767],[770,-730,289,36,-314,-199;-730,259,-746,740,286,-508;289,-746,580,251,-401,103;36,740,251,764,372,167;-314,286,-401,372,-269,-853;-199,-508,103,167,-853,-34],[-579,325,661,-348,645,-729;325,433,871,801,221,-631;661,871,846,-124,27,433;-348,801,-124,-251,-990,-97;645,221,27,-990,-957,-618;-729,-631,433,-97,-618,-373],[221,204,482,-309,-150,-760;204,-265,-487,-295,26,-244;482,-487,-961,-108,-113,405;-309,-295,-108,-800,-369,-21;-150,26,-113,-369,122,475;-760,-244,405,-21,475,347],[-820,32,-50,356,-705,-243;32,-651,543,121,-684,-186;-50,543,186,-247,656,-244;356,121,-247,350,100,247;-705,-684,656,100,-680,906;-243,-186,-244,247,906,-469],[431,-287,357,-430,-130,373;-287,-248,500,113,895,-59;357,500,60,-576,82,192;-430,113,-576,-478,-772,369;-130,895,82,-772,-462,268;373,-59,192,369,268,-734],[-352,-378,98,-49,374,623;-378,-999,197,68,266,180;98,197,701,-208,-129,-412;-49,68,-208,863,-117,442;374,266,-129,-117,-518,694;623,180,-412,442,694,501],[924,168,-46,550,41,84;168,608,-653,-514,-201,693;-46,-653,-744,751,158,-75;550,-514,751,-549,143,-563;41,-201,158,143,-564,-356;84,693,-75,-563,-356,731],[993,644,-32,-19,-163,372;644,467,-377,297,387,-321;-32,-377,920,76,-455,808;-19,297,76,649,-450,71;-163,387,-455,-450,284,-158;372,-321,808,71,-158,529],[246,248,608,-198,-18,405;248,-359,243,479,-563,-14;608,243,-109,140,314,98;-198,479,140,488,264,321;-18,-563,314,264,-853,-387;405,-14,98,321,-387,616],[-637,-606,-12,-32,902,-41;-606,912,162,-371,-284,-739;-12,162,-909,-711,34,-326;-32,-371,-711,379,-626,151;902,-284,34,-626,-716,125;-41,-739,-326,151,125,-764],[-538,-632,-235,904,480,53;-632,-156,-336,-342,82,-172;-235,-336,-24,123,129,-444;904,-342,123,-125,-151,83;480,82,129,-151,70,-48;53,-172,-444,83,-48,-537],[497,-860,-57,197,-237,-131;-860,-312,-391,202,329,550;-57,-391,139,165,49,578;197,202,165,-771,580,131;-237,329,49,580,643,164;-131,550,578,131,164,-341],[-735,583,120,164,-565,-76;583,-174,-174,389,-674,-180;120,-174,464,375,-454,-451;164,389,375,-605,-317,-821;-565,-674,-454,-317,456,-456;-76,-180,-451,-821,-456,-373],[687,580,851,459,139,-93;580,-476,-912,455,-605,381;851,-912,-532,663,140,-736;459,455,663,665,-312,223;139,-605,140,-312,-724,-185;-93,381,-736,223,-185,132],[160,-532,608,-331,-600,60;-532,613,853,310,296,44;608,853,35,54,212,-7;-331,310,54,519,480,33;-600,296,212,480,293,689;60,44,-7,33,689,266],[579,4,-562,-731,175,-782;4,318,392,468,-568,-563;-562,392,-891,348,256,7;-731,468,348,327,-178,-422;175,-568,256,-178,837,-723;-782,-563,7,-422,-723,-238],[-739,453,742,543,-791,-417;453,793,169,-102,-156,-188;742,169,-17,108,-351,-553;543,-102,108,-599,-18,195;-791,-156,-351,-18,-223,-114;-417,-188,-553,195,-114,-322],[-678,-308,-290,52,175,14;-308,-988,-705,135,-705,-532;-290,-705,-291,-494,-87,-725;52,135,-494,-500,-506,-189;175,-705,-87,-506,-943,-583;14,-532,-725,-189,-583,995],[-837,134,-213,-67,200,104;134,-490,-400,635,199,-255;-213,-400,682,59,-221,322;-67,635,59,-797,284,-399;200,199,-221,284,881,577;104,-255,322,-399,577,477],[555,14,-887,-202,695,528;14,-927,330,-314,375,-391;-887,330,-134,464,446,346;-202,-314,464,-313,345,363;695,375,446,345,-79,-184;528,-391,346,363,-184,780],[422,58,282,210,-461,94;58,796,706,258,588,-301;282,706,-838,-252,291,-204;210,258,-252,-718,-112,414;-461,588,291,-112,-480,-630;94,-301,-204,414,-630,-889],[-256,759,-214,685,465,-315;759,-944,538,57,-482,299;-214,538,307,640,-137,403;685,57,640,-235,367,213;465,-482,-137,367,188,33;-315,299,403,213,33,-175],[-880,-536,-590,-111,127,-279;-536,749,-180,-387,331,44;-590,-180,-735,-445,347,-44;-111,-387,-445,704,-43,-22;127,331,347,-43,-197,215;-279,44,-44,-22,215,-766],[356,180,416,168,658,-14;180,-229,-316,-408,-834,-724;416,-316,408,-197,-218,-406;168,-408,-197,-754,88,429;658,-834,-218,88,-244,587;-14,-724,-406,429,587,-556],[-968,504,-302,-234,-393,667;504,-948,-680,598,-100,770;-302,-680,-94,-419,135,-350;-234,598,-419,-386,303,350;-393,-100,135,303,-116,69;667,770,-350,350,69,411],[385,259,177,46,13,120;259,-467,445,-398,210,189;177,445,560,58,-26,560;46,-398,58,-874,224,63;13,210,-26,224,-628,156;120,189,560,63,156,-497],[-124,429,577,-223,-36,405;429,343,-398,-302,448,-48;577,-398,920,304,768,570;-223,-302,304,-55,-415,-71;-36,448,768,-415,906,-490;405,-48,570,-71,-490,-330],[714,684,-730,-19,290,-210;684,-984,59,256,72,280;-730,59,-122,46,-7,936;-19,256,46,-177,-697,-104;290,72,-7,-697,-812,502;-210,280,936,-104,502,956],[-835,240,277,73,220,448;240,921,286,617,309,52;277,286,3,202,21,42;73,617,202,966,233,-318;220,309,21,233,540,-165;448,52,42,-318,-165,-601],[826,58,-448,7,570,254;58,-803,-45,327,496,-321;-448,-45,753,861,396,313;7,327,861,-277,-240,-484;570,496,396,-240,-350,605;254,-321,313,-484,605,477],[-847,-687,565,-182,719,62;-687,299,138,-496,-38,-438;565,138,256,-156,416,41;-182,-496,-156,-816,580,-533;719,-38,416,580,610,118;62,-438,41,-533,118,-910],[-646,-187,760,489,-95,91;-187,-112,-162,-729,-435,-220;760,-162,-249,197,65,180;489,-729,197,-196,-9,250;-95,-435,65,-9,245,520;91,-220,180,250,520,682],[368,-508,-170,198,508,-43;-508,-900,203,-730,-33,-499;-170,203,-192,-47,151,-75;198,-730,-47,82,-271,-61;508,-33,151,-271,324,737;-43,-499,-75,-61,737,417],[982,350,-168,63,808,-314;350,372,-245,-844,427,-780;-168,-245,350,195,122,322;63,-844,195,-138,-112,434;808,427,122,-112,-418,460;-314,-780,322,434,460,-548],[-754,146,14,154,313,436;146,798,668,499,-626,241;14,668,-954,-68,372,386;154,499,-68,-798,619,-444;313,-626,372,619,588,-121;436,241,386,-444,-121,-831],[-822,-100,-182,39,-913,-73;-100,-374,-379,-64,254,-58;-182,-379,-974,-473,-71,-805;39,-64,-473,-169,335,-471;-913,254,-71,335,320,-419;-73,-58,-805,-471,-419,-161],[-649,-296,877,-659,-394,522;-296,804,-65,456,87,-811;877,-65,931,365,284,113;-659,456,365,73,-174,184;-394,87,284,-174,920,498;522,-811,113,184,498,-483],[288,-408,-114,771,519,-372;-408,-362,-282,565,-94,-137;-114,-282,180,-813,-311,-227;771,565,-813,-306,175,-422;519,-94,-311,175,438,5;-372,-137,-227,-422,5,76],[-298,145,-880,-215,268,-450;145,390,415,-316,-284,-189;-880,415,-89,-21,615,-306;-215,-316,-21,486,576,-214;268,-284,615,576,456,258;-450,-189,-306,-214,258,132],[453,260,-81,-494,-121,164;260,-679,662,-549,-175,625;-81,662,-590,-494,144,349;-494,-549,-494,-510,144,-489;-121,-175,144,144,355,546;164,625,349,-489,546,-822],[-326,-26,-165,-218,342,-278;-26,961,-454,-298,-621,-509;-165,-454,927,-413,-84,-789;-218,-298,-413,603,478,709;342,-621,-84,478,549,-67;-278,-509,-789,709,-67,-356],[888,443,211,186,-204,-166;443,518,339,768,635,-52;211,339,626,-115,854,-179;186,768,-115,910,278,-208;-204,635,854,278,-616,663;-166,-52,-179,-208,663,-371],[13,149,-183,503,388,145;149,174,-481,287,-14,744;-183,-481,11,487,209,73;503,287,487,421,469,-933;388,-14,209,469,463,-219;145,744,73,-933,-219,945],[996,129,-245,-267,-30,-569;129,-399,-692,96,-24,70;-245,-692,508,-256,-412,-59;-267,96,-256,-3,286,-96;-30,-24,-412,286,-964,131;-569,70,-59,-96,131,677],[-568,492,-797,-185,-77,-181;492,-608,237,-143,488,270;-797,237,-19,834,473,-442;-185,-143,834,74,-505,714;-77,488,473,-505,-343,-615;-181,270,-442,714,-615,-168],[825,-302,-377,296,221,542;-302,166,174,-89,44,-213;-377,174,-190,195,-711,26;296,-89,195,425,388,190;221,44,-711,388,669,-69;542,-213,26,190,-69,-292],[302,-942,-32,-165,458,115;-942,-9,-21,447,-412,346;-32,-21,728,-513,-514,-422;-165,447,-513,477,390,315;458,-412,-514,390,173,-532;115,346,-422,315,-532,-499],[370,599,-62,-34,-115,57;599,319,433,423,358,-417;-62,433,-994,-74,147,-352;-34,423,-74,886,128,-472;-115,358,147,128,976,-150;57,-417,-352,-472,-150,-775],[946,-23,-247,-316,628,-800;-23,4,290,-227,-567,-930;-247,290,-403,-185,-505,162;-316,-227,-185,-181,485,2;628,-567,-505,485,603,-833;-800,-930,162,2,-833,382];[-657,218,-1,-499,774,297,-562;218,670,298,71,678,450,417;-1,298,-906,345,-505,-13,146;-499,71,345,-163,-45,-350,-9;774,678,-505,-45,464,68,-744;297,450,-13,-350,68,883,-33;-562,417,146,-9,-744,-33,-653],[-651,277,-344,-557,-100,-5,30;277,173,742,649,426,637,138;-344,742,349,-680,182,-76,-124;-557,649,-680,727,235,513,882;-100,426,182,235,252,-194,-8;-5,637,-76,513,-194,-40,-555;30,138,-124,882,-8,-555,984],[-278,169,-928,416,-189,-786,198;169,-688,123,604,-852,-286,421;-928,123,495,-55,-54,172,149;416,604,-55,156,-103,-362,215;-189,-852,-54,-103,-976,80,67;-786,-286,172,-362,80,-328,445;198,421,149,215,67,445,517],[753,310,-161,167,18,192,-314;310,-549,163,639,67,-150,664;-161,163,871,155,248,-423,194;167,639,155,589,-765,-850,-131;18,67,248,-765,-223,-49,-580;192,-150,-423,-850,-49,-803,440;-314,664,194,-131,-580,440,-791],[-898,-426,-688,-411,-129,-434,-26;-426,287,-618,-166,355,-45,-437;-688,-618,-43,-143,394,-406,-272;-411,-166,-143,-714,548,-679,-178;-129,355,394,548,792,348,291;-434,-45,-406,-679,348,338,-506;-26,-437,-272,-178,291,-506,-872],[-669,-536,-125,567,-808,511,-118;-536,197,84,-11,-443,627,-430;-125,84,286,499,-314,9,-34;567,-11,499,-476,11,-699,-53;-808,-443,-314,11,935,18,261;511,627,9,-699,18,634,11;-118,-430,-34,-53,261,11,-169],[-379,96,11,-80,-343,-385,-744;96,681,62,-343,-10,-240,-9;11,62,-642,-767,183,-421,-800;-80,-343,-767,-259,73,-665,-382;-343,-10,183,73,761,-111,-300;-385,-240,-421,-665,-111,195,-170;-744,-9,-800,-382,-300,-170,662],[876,196,80,-115,-372,220,206;196,343,477,60,-128,751,-298;80,477,256,433,496,-477,143;-115,60,433,522,345,-800,338;-372,-128,496,345,-362,86,575;220,751,-477,-800,86,697,123;206,-298,143,338,575,123,-616],[-205,-318,175,-27,-488,270,-295;-318,-753,-278,-529,199,-352,787;175,-278,-968,-412,450,198,602;-27,-529,-412,778,285,-105,941;-488,199,450,285,455,-842,-66;270,-352,198,-105,-842,380,-103;-295,787,602,941,-66,-103,-790],[-462,-521,403,76,-219,-161,-546;-521,-472,179,-303,552,606,-494;403,179,-991,-245,514,337,133;76,-303,-245,-514,87,-233,31;-219,552,514,87,561,151,462;-161,606,337,-233,151,-74,16;-546,-494,133,31,462,16,-631],[505,53,-114,-406,664,319,-243;53,-983,-393,166,-180,-68,-172;-114,-393,-995,-463,-266,127,-821;-406,166,-463,262,13,36,150;664,-180,-266,13,423,42,-635;319,-68,127,36,42,968,480;-243,-172,-821,150,-635,480,-782],[302,-223,276,-96,85,-138,-263;-223,-793,-501,-293,422,529,382;276,-501,-943,207,514,-70,771;-96,-293,207,586,11,338,756;85,422,514,11,120,-390,411;-138,529,-70,338,-390,-419,302;-263,382,771,756,411,302,481],[335,-465,13,-133,-195,16,593;-465,-737,108,-543,-28,-65,-2;13,108,-416,881,-60,863,225;-133,-543,881,-122,-191,-803,463;-195,-28,-60,-191,69,190,312;16,-65,863,-803,190,-573,-331;593,-2,225,463,312,-331,561],[557,-886,-442,139,-237,575,-334;-886,-165,-99,-578,-587,250,123;-442,-99,20,-206,398,-509,-613;139,-578,-206,696,-250,476,52;-237,-587,398,-250,543,-176,742;575,250,-509,476,-176,-668,162;-334,123,-613,52,742,162,-72],[-256,738,-236,-81,521,512,-67;738,300,67,62,-520,34,235;-236,67,780,-469,140,-228,-247;-81,62,-469,-822,502,649,-368;521,-520,140,502,333,-809,84;512,34,-228,649,-809,-75,657;-67,235,-247,-368,84,657,483],[254,-269,69,341,-754,473,147;-269,660,-699,-134,-24,-67,-45;69,-699,35,-307,-16,-47,-528;341,-134,-307,438,342,-610,-74;-754,-24,-16,342,526,-721,646;473,-67,-47,-610,-721,-454,127;147,-45,-528,-74,646,127,-659],[-407,581,-416,67,66,-379,187;581,633,417,225,-352,62,-64;-416,417,85,-214,722,488,518;67,225,-214,-15,95,265,-36;66,-352,722,95,709,98,-614;-379,62,488,265,98,977,-111;187,-64,518,-36,-614,-111,-144],[168,-149,226,-257,-324,-242,256;-149,-395,-559,7,-415,305,667;226,-559,-737,263,-112,-876,431;-257,7,263,-693,-145,436,617;-324,-415,-112,-145,-8,848,-685;-242,305,-876,436,848,-331,-33;256,667,431,617,-685,-33,781],[-493,150,-108,-195,-30,-562,-557;150,-58,-320,79,-129,-456,191;-108,-320,82,441,-625,151,-112;-195,79,441,625,505,134,188;-30,-129,-625,505,113,788,-446;-562,-456,151,134,788,931,52;-557,191,-112,188,-446,52,-693],[-257,20,262,-274,5,446,-284;20,734,-134,-390,-164,378,335;262,-134,990,643,-3,411,-69;-274,-390,643,398,612,218,-65;5,-164,-3,612,443,634,-337;446,378,411,218,634,200,-841;-284,335,-69,-65,-337,-841,340],[-414,-84,167,142,7,298,-197;-84,-576,795,356,596,289,368;167,795,-594,250,428,-7,44;142,356,250,-481,-357,527,-336;7,596,428,-357,-906,-321,140;298,289,-7,527,-321,804,408;-197,368,44,-336,140,408,668],[35,557,-451,383,189,-443,-533;557,832,995,177,-357,273,139;-451,995,-184,442,40,-357,348;383,177,442,226,-487,-215,-284;189,-357,40,-487,398,-83,151;-443,273,-357,-215,-83,-241,-542;-533,139,348,-284,151,-542,831],[956,-222,-121,-224,-8,-422,-439;-222,965,799,-60,127,808,-458;-121,799,548,-769,25,-235,42;-224,-60,-769,-396,350,-309,433;-8,127,25,350,879,276,339;-422,808,-235,-309,276,-39,-29;-439,-458,42,433,339,-29,-717],[-747,583,508,-311,-22,-100,-176;583,558,777,487,25,626,-218;508,777,446,33,-254,-526,-197;-311,487,33,-865,942,-591,-153;-22,25,-254,942,-566,-310,192;-100,626,-526,-591,-310,750,59;-176,-218,-197,-153,192,59,-920],[667,-531,-248,620,-72,-156,-279;-531,665,-153,-237,-231,91,265;-248,-153,-1,306,-352,-492,202;620,-237,306,-891,-340,1,618;-72,-231,-352,-340,779,68,764;-156,91,-492,1,68,137,33;-279,265,202,618,764,33,653],[386,163,-387,-254,-208,-40,737;163,-296,-546,225,-17,99,-15;-387,-546,571,-72,-895,-100,291;-254,225,-72,-195,-222,478,-592;-208,-17,-895,-222,318,-708,-336;-40,99,-100,478,-708,-883,-148;737,-15,291,-592,-336,-148,-698],[431,-211,-112,160,-3,841,366;-211,198,79,-453,-183,223,183;-112,79,243,-204,480,168,-648;160,-453,-204,169,-80,-52,-341;-3,-183,480,-80,-577,274,55;841,223,168,-52,274,-702,-478;366,183,-648,-341,55,-478,928],[431,21,-4,646,197,366,-363;21,48,904,207,-20,476,597;-4,904,-660,754,211,347,407;646,207,754,-647,-10,-39,387;197,-20,211,-10,726,-372,2;366,476,347,-39,-372,-308,274;-363,597,407,387,2,274,77],[709,192,222,174,-105,-173,364;192,-471,-174,-116,-107,338,-4;222,-174,-911,256,118,-443,412;174,-116,256,781,249,-525,-98;-105,-107,118,249,-658,-81,-154;-173,338,-443,-525,-81,854,719;364,-4,412,-98,-154,719,739],[708,-639,135,400,-524,462,384;-639,-711,90,-302,-496,858,-220;135,90,929,324,212,876,-833;400,-302,324,525,335,-20,-493;-524,-496,212,335,67,491,399;462,858,876,-20,491,640,249;384,-220,-833,-493,399,249,421],[-365,216,-176,275,9,-248,-76;216,459,-334,167,121,427,255;-176,-334,-151,146,-879,-846,-181;275,167,146,-387,-162,149,24;9,121,-879,-162,402,768,560;-248,427,-846,149,768,-290,-195;-76,255,-181,24,560,-195,-123],[-225,283,143,-512,790,-529,-203;283,-405,91,328,236,451,-197;143,91,707,294,-156,-39,413;-512,328,294,-517,641,-27,630;790,236,-156,641,892,474,-414;-529,451,-39,-27,474,494,728;-203,-197,413,630,-414,728,445],[293,247,547,-187,-63,-225,-510;247,525,-182,861,-350,482,515;547,-182,-140,-139,-91,-749,303;-187,861,-139,-856,-402,-307,-198;-63,-350,-91,-402,-432,-406,-440;-225,482,-749,-307,-406,665,-243;-510,515,303,-198,-440,-243,313],[431,282,150,482,-570,-252,294;282,224,240,90,-700,-554,-81;150,240,-516,-74,62,373,328;482,90,-74,-313,189,-54,-730;-570,-700,62,189,402,-26,-282;-252,-554,373,-54,-26,-709,-683;294,-81,328,-730,-282,-683,110],[-174,143,517,614,-145,-362,-519;143,741,383,-381,22,-514,-678;517,383,849,-409,-496,-56,497;614,-381,-409,659,-347,340,736;-145,22,-496,-347,526,296,137;-362,-514,-56,340,296,648,95;-519,-678,497,736,137,95,-934],[318,-645,275,-730,-326,633,107;-645,-247,-156,-53,116,-511,-162;275,-156,-630,-570,262,-343,526;-730,-53,-570,-631,690,329,-312;-326,116,262,690,-455,-207,-152;633,-511,-343,329,-207,-711,-496;107,-162,526,-312,-152,-496,-417],[-101,-812,-33,66,-774,363,378;-812,681,-71,-263,-128,747,547;-33,-71,641,531,613,-531,-99;66,-263,531,579,167,-450,0;-774,-128,613,167,638,-645,-153;363,747,-531,-450,-645,304,-43;378,547,-99,0,-153,-43,408],[-386,189,698,382,-278,-611,609;189,-601,2,-478,344,261,301;698,2,710,-587,-393,-304,255;382,-478,-587,98,-652,-87,87;-278,344,-393,-652,-788,-168,-508;-611,261,-304,-87,-168,792,-22;609,301,255,87,-508,-22,672],[1,-104,-86,40,-647,816,-352;-104,406,-81,-537,493,80,-435;-86,-81,-284,-66,554,-623,680;40,-537,-66,-356,29,-443,248;-647,493,554,29,746,138,685;816,80,-623,-443,138,424,34;-352,-435,680,248,685,34,922],[-682,-50,318,-106,241,743,-780;-50,926,20,385,-582,626,237;318,20,-374,-88,-69,-122,-824;-106,385,-88,-49,-469,390,398;241,-582,-69,-469,-978,-624,-206;743,626,-122,390,-624,557,538;-780,237,-824,398,-206,538,868],[-910,-842,182,171,273,-403,17;-842,737,478,-363,723,319,-225;182,478,99,507,-469,54,-186;171,-363,507,427,-128,271,-239;273,723,-469,-128,-682,-455,-389;-403,319,54,271,-455,712,-162;17,-225,-186,-239,-389,-162,892],[-364,164,-488,-562,-12,-482,416;164,652,-86,436,180,-102,20;-488,-86,-351,-471,-252,346,250;-562,436,-471,758,516,-14,163;-12,180,-252,516,204,-524,-219;-482,-102,346,-14,-524,306,101;416,20,250,163,-219,101,-523],[-916,-771,265,-35,-501,783,587;-771,-632,15,187,687,-308,-32;265,15,103,-346,-254,91,89;-35,187,-346,707,-63,14,436;-501,687,-254,-63,440,-502,-91;783,-308,91,14,-502,405,-182;587,-32,89,436,-91,-182,-450],[-53,-809,-515,-200,44,-145,326;-809,-948,512,-124,-898,-316,322;-515,512,936,153,-148,-146,206;-200,-124,153,959,-152,-321,7;44,-898,-148,-152,71,-76,-786;-145,-316,-146,-321,-76,817,-700;326,322,206,7,-786,-700,-662],[-302,67,-462,263,105,8,292;67,327,-823,-42,-113,527,30;-462,-823,417,55,860,-10,425;263,-42,55,173,281,-394,122;105,-113,860,281,-854,-221,-99;8,527,-10,-394,-221,227,-182;292,30,425,122,-99,-182,-346],[-119,795,-290,-384,121,-469,430;795,-552,645,-722,-394,-170,51;-290,645,600,-222,12,-297,117;-384,-722,-222,-454,-223,-475,-789;121,-394,12,-223,-411,321,529;-469,-170,-297,-475,321,-873,182;430,51,117,-789,529,182,-349],[117,509,-692,-458,-347,-602,203;509,279,-346,393,-879,798,-496;-692,-346,-973,97,-705,-283,62;-458,393,97,-21,-167,-709,-206;-347,-879,-705,-167,-400,-300,-501;-602,798,-283,-709,-300,-803,-620;203,-496,62,-206,-501,-620,920],[975,303,-34,653,-515,-128,-160;303,-703,-62,-749,-24,-40,-108;-34,-62,-391,-85,254,-713,-443;653,-749,-85,597,298,-433,-134;-515,-24,254,298,-460,738,375;-128,-40,-713,-433,738,312,487;-160,-108,-443,-134,375,487,-620],[-981,789,214,562,462,-166,172;789,-829,323,554,-240,35,-524;214,323,491,-355,881,-401,74;562,554,-355,639,-211,10,80;462,-240,881,-211,-383,-868,100;-166,35,-401,10,-868,-229,-605;172,-524,74,80,100,-605,-209],[429,863,-528,200,-44,-239,687;863,-427,684,-810,364,101,-64;-528,684,-196,102,247,-284,-142;200,-810,102,-89,-719,-163,137;-44,364,247,-719,775,-524,247;-239,101,-284,-163,-524,-630,37;687,-64,-142,137,247,37,766],[442,-92,461,-146,-273,75,326;-92,721,243,-13,-137,49,325;461,243,-944,-341,-654,63,-261;-146,-13,-341,-232,-147,518,-381;-273,-137,-654,-147,-976,366,-674;75,49,63,518,366,835,584;326,325,-261,-381,-674,584,-946],[458,294,-391,31,-493,233,-911;294,-262,327,-369,388,-85,-94;-391,327,491,-2,275,45,-40;31,-369,-2,-769,-802,-38,108;-493,388,275,-802,65,-592,706;233,-85,45,-38,-592,696,-294;-911,-94,-40,108,706,-294,419],[991,340,-589,-442,-22,210,897;340,258,-15,-71,-366,29,-201;-589,-15,-888,148,149,-278,246;-442,-71,148,-834,-182,-161,-222;-22,-366,149,-182,-625,-676,111;210,29,-278,-161,-676,38,342;897,-201,246,-222,111,342,798],[736,29,739,-519,-41,174,-774;29,-184,24,-309,826,9,-527;739,24,135,-420,306,589,353;-519,-309,-420,-441,-63,-146,-272;-41,826,306,-63,-953,-569,-297;174,9,589,-146,-569,652,-511;-774,-527,353,-272,-297,-511,-479],[-109,587,6,96,377,-33,-97;587,-609,-191,364,-276,-540,-52;6,-191,500,-21,158,-698,249;96,364,-21,746,-2,-430,-804;377,-276,158,-2,498,-389,626;-33,-540,-698,-430,-389,968,-594;-97,-52,249,-804,626,-594,216],[-571,-349,-384,108,271,604,-1;-349,-949,-190,-891,-93,-143,173;-384,-190,652,-74,-346,-159,618;108,-891,-74,-925,-782,-1,345;271,-93,-346,-782,-244,496,485;604,-143,-159,-1,496,724,166;-1,173,618,345,485,166,604],[-613,73,540,200,372,355,166;73,-962,190,-582,-117,-596,393;540,190,155,18,-327,-89,762;200,-582,18,805,-3,529,-308;372,-117,-327,-3,-604,-88,-450;355,-596,-89,529,-88,679,-111;166,393,762,-308,-450,-111,-247],[330,524,-107,-556,-84,57,783;524,663,-148,373,685,-204,405;-107,-148,-216,104,-264,471,51;-556,373,104,-862,97,-167,-661;-84,685,-264,97,261,745,-393;57,-204,471,-167,745,785,54;783,405,51,-661,-393,54,436],[977,-115,278,768,-817,-844,183;-115,287,178,-402,-558,-397,-558;278,178,-402,123,-708,158,-99;768,-402,123,140,-676,245,-9;-817,-558,-708,-676,985,228,187;-844,-397,158,245,228,-950,129;183,-558,-99,-9,187,129,-905],[-418,19,223,349,-143,561,784;19,200,-698,444,18,633,39;223,-698,-923,-365,419,-71,-104;349,444,-365,-116,64,-278,348;-143,18,419,64,-115,-772,526;561,633,-71,-278,-772,-62,360;784,39,-104,348,526,360,495],[-996,-141,409,84,635,-241,327;-141,607,111,-622,154,-49,-450;409,111,-233,-522,114,-388,-35;84,-622,-522,-496,-648,-210,-180;635,154,114,-648,178,-530,-75;-241,-49,-388,-210,-530,-505,-88;327,-450,-35,-180,-75,-88,505],[-505,-167,448,452,616,-300,473;-167,978,237,580,-364,334,104;448,237,948,74,-536,-860,-344;452,580,74,926,-758,31,581;616,-364,-536,-758,-472,-269,300;-300,334,-860,31,-269,464,-374;473,104,-344,581,300,-374,536],[-924,506,-147,-140,841,-163,-94;506,899,168,-373,-132,-214,618;-147,168,701,-230,-200,100,-632;-140,-373,-230,-86,122,-541,-169;841,-132,-200,122,815,874,-462;-163,-214,100,-541,874,521,521;-94,618,-632,-169,-462,521,998],[960,-103,392,192,-61,280,-369;-103,122,-804,-260,-197,314,76;392,-804,348,161,568,-213,10;192,-260,161,634,166,-222,738;-61,-197,568,166,574,179,-130;280,314,-213,-222,179,354,-241;-369,76,10,738,-130,-241,754],[844,283,407,-361,-784,-629,-443;283,895,-741,377,552,545,-356;407,-741,-446,713,-37,-642,-95;-361,377,713,-706,-509,790,-129;-784,552,-37,-509,929,-216,831;-629,545,-642,790,-216,-381,126;-443,-356,-95,-129,831,126,864],[-44,-613,-265,-59,-454,86,-523;-613,695,-185,100,70,-185,261;-265,-185,516,-915,-514,-305,-183;-59,100,-915,-479,673,-599,9;-454,70,-514,673,-97,147,443;86,-185,-305,-599,147,-52,171;-523,261,-183,9,443,171,40],[615,-292,734,37,350,511,-512;-292,394,773,-557,158,-754,212;734,773,466,406,412,519,-125;37,-557,406,964,117,-569,99;350,158,412,117,-131,-741,134;511,-754,519,-569,-741,-996,32;-512,212,-125,99,134,32,34],[-355,-682,-504,-263,483,226,392;-682,-581,45,142,631,-117,-233;-504,45,334,327,765,-196,-286;-263,142,327,-785,367,98,-324;483,631,765,367,482,-40,468;226,-117,-196,98,-40,151,495;392,-233,-286,-324,468,495,-171],[-691,-179,-303,319,211,-212,59;-179,-148,-340,-622,-170,332,323;-303,-340,-233,52,734,-50,-470;319,-622,52,-522,-204,344,-554;211,-170,734,-204,753,37,133;-212,332,-50,344,37,704,260;59,323,-470,-554,133,260,-214],[-430,244,-408,98,568,-419,-263;244,-498,-523,854,-242,436,573;-408,-523,761,-390,554,-762,-188;98,854,-390,526,196,-723,-193;568,-242,554,196,-930,-118,-299;-419,436,-762,-723,-118,-244,409;-263,573,-188,-193,-299,409,-954],[-735,487,539,-167,200,167,212;487,-195,356,-722,-42,338,77;539,356,37,-497,723,-74,388;-167,-722,-497,-702,-357,-134,-83;200,-42,723,-357,-229,-666,547;167,338,-74,-134,-666,482,-26;212,77,388,-83,547,-26,-699],[-560,-459,8,-566,424,-163,266;-459,40,251,-484,847,-77,-806;8,251,-120,431,23,-32,-17;-566,-484,431,114,-392,-411,-456;424,847,23,-392,492,-92,-128;-163,-77,-32,-411,-92,-644,47;266,-806,-17,-456,-128,47,-358],[-616,38,400,782,-451,-560,243;38,641,-945,-72,-426,-80,-308;400,-945,493,161,150,652,-130;782,-72,161,-182,-392,99,236;-451,-426,150,-392,-164,-7,155;-560,-80,652,99,-7,114,-744;243,-308,-130,236,155,-744,558],[-987,-215,49,-444,-384,-381,-367;-215,-468,61,-421,541,86,432;49,61,21,-308,862,-435,239;-444,-421,-308,-762,-189,62,-520;-384,541,862,-189,33,-358,-566;-381,86,-435,62,-358,-652,504;-367,432,239,-520,-566,504,223],[122,769,689,-167,-441,471,-585;769,217,-172,-209,-408,-284,370;689,-172,-762,714,380,131,-200;-167,-209,714,228,-157,153,-664;-441,-408,380,-157,70,476,-347;471,-284,131,153,476,-505,-284;-585,370,-200,-664,-347,-284,-925],[-435,-265,190,-229,366,212,-510;-265,972,-244,142,-542,304,-272;190,-244,492,-69,-610,555,-292;-229,142,-69,110,-380,-179,-362;366,-542,-610,-380,-600,-228,-80;212,304,555,-179,-228,-465,-65;-510,-272,-292,-362,-80,-65,-722],[-177,-233,784,85,183,-223,-84;-233,817,78,344,391,559,-496;784,78,839,224,330,371,230;85,344,224,-278,412,-272,197;183,391,330,412,639,-809,-132;-223,559,371,-272,-809,109,454;-84,-496,230,197,-132,454,-8],[466,393,20,79,-620,-613,-319;393,48,32,520,13,38,-394;20,32,-607,-369,-263,-144,701;79,520,-369,-666,399,-87,536;-620,13,-263,399,-198,640,-619;-613,38,-144,-87,640,-184,751;-319,-394,701,536,-619,751,-506],[-102,-407,-405,-138,-542,-43,669;-407,955,-156,256,-752,-475,-266;-405,-156,759,54,272,-562,123;-138,256,54,555,-155,-458,520;-542,-752,272,-155,432,678,-187;-43,-475,-562,-458,678,-679,863;669,-266,123,520,-187,863,999],[336,672,-224,-42,-744,803,26;672,-74,-277,402,-180,-131,-288;-224,-277,28,-862,-359,-183,-623;-42,402,-862,-49,-396,-288,-147;-744,-180,-359,-396,-399,401,425;803,-131,-183,-288,401,-523,402;26,-288,-623,-147,425,402,671],[343,302,451,869,-728,461,469;302,-479,-552,-94,99,335,343;451,-552,123,137,-22,-150,371;869,-94,137,-567,29,107,749;-728,99,-22,29,-921,126,78;461,335,-150,107,126,-967,774;469,343,371,749,78,774,-392],[304,146,-18,-752,-8,-481,-790;146,133,175,113,212,-370,-62;-18,175,-586,-334,-677,353,-505;-752,113,-334,-440,-592,431,180;-8,212,-677,-592,79,282,350;-481,-370,353,431,282,569,262;-790,-62,-505,180,350,262,725],[-892,304,-153,-826,-17,209,-21;304,-228,-16,751,167,590,495;-153,-16,339,94,-287,-176,-335;-826,751,94,759,-44,338,-62;-17,167,-287,-44,823,-262,72;209,590,-176,338,-262,166,-551;-21,495,-335,-62,72,-551,267],[858,408,-336,620,83,95,247;408,-973,229,-540,326,126,153;-336,229,379,-102,-37,-334,-233;620,-540,-102,51,-72,-782,372;83,326,-37,-72,778,-571,863;95,126,-334,-782,-571,884,101;247,153,-233,372,863,101,292],[805,581,525,-453,374,-453,64;581,665,155,36,-90,357,-181;525,155,-944,691,-432,-147,-299;-453,36,691,-785,-199,514,-43;374,-90,-432,-199,-278,-559,-390;-453,357,-147,514,-559,501,-89;64,-181,-299,-43,-390,-89,821],[-217,-496,-326,151,715,-222,58;-496,-627,281,-323,-691,-42,20;-326,281,754,-327,269,61,-702;151,-323,-327,418,544,349,-7;715,-691,269,544,-52,-146,-94;-222,-42,61,349,-146,23,656;58,20,-702,-7,-94,656,416],[258,-267,-600,-364,-541,52,-36;-267,-964,-55,343,-169,-401,-160;-600,-55,962,143,-364,136,231;-364,343,143,-814,-149,83,547;-541,-169,-364,-149,-297,441,-664;52,-401,136,83,441,-648,125;-36,-160,231,547,-664,125,-186],[708,-24,600,480,556,-701,628;-24,498,-49,-41,94,-69,407;600,-49,-836,281,641,-636,-372;480,-41,281,173,-193,18,351;556,94,641,-193,-414,-33,59;-701,-69,-636,18,-33,58,-212;628,407,-372,351,59,-212,838],[404,379,-164,490,-372,-323,-178;379,121,-352,-507,-379,-58,-253;-164,-352,936,760,534,-648,463;490,-507,760,540,-221,-193,-283;-372,-379,534,-221,965,114,-500;-323,-58,-648,-193,114,588,516;-178,-253,463,-283,-500,516,133],[-274,-8,774,69,632,746,-742;-8,550,834,-903,291,-438,-107;774,834,902,-160,-580,423,-143;69,-903,-160,852,453,216,-372;632,291,-580,453,562,211,56;746,-438,423,216,211,288,-255;-742,-107,-143,-372,56,-255,381],[29,-608,-241,-79,639,-259,44;-608,-80,727,279,150,-707,11;-241,727,-964,-562,-228,271,299;-79,279,-562,233,-245,-250,-16;639,150,-228,-245,208,-249,566;-259,-707,271,-250,-249,-498,342;44,11,299,-16,566,342,502],[-372,69,-132,48,802,42,-573;69,349,-147,702,-346,177,-132;-132,-147,-588,-729,-253,211,373;48,702,-729,-885,994,206,-391;802,-346,-253,994,-654,286,-125;42,177,211,206,286,-412,5;-573,-132,373,-391,-125,5,917],[857,-510,115,216,-52,263,11;-510,906,25,-444,-200,801,-659;115,25,832,493,-543,-283,-80;216,-444,493,-723,-89,-383,-48;-52,-200,-543,-89,228,641,179;263,801,-283,-383,641,-984,390;11,-659,-80,-48,179,390,314],[-786,-107,592,-837,329,-489,-279;-107,326,699,517,-347,109,-273;592,699,852,366,499,16,-329;-837,517,366,939,-584,-909,494;329,-347,499,-584,-172,-535,-62;-489,109,16,-909,-535,-147,223;-279,-273,-329,494,-62,223,442],[-529,-343,-828,-312,-108,143,-370;-343,583,-181,167,-353,654,490;-828,-181,586,334,-153,-633,214;-312,167,334,538,635,-73,-251;-108,-353,-153,635,338,-2,-38;143,654,-633,-73,-2,732,543;-370,490,214,-251,-38,543,-691],[-791,-269,-24,310,42,44,-620;-269,64,-128,341,635,482,-346;-24,-128,-745,451,-170,232,-236;310,341,451,403,466,-26,-684;42,635,-170,466,-274,510,-103;44,482,232,-26,510,35,-232;-620,-346,-236,-684,-103,-232,736],[-410,-80,172,-425,205,677,232;-80,373,214,214,-24,232,-602;172,214,771,493,250,-99,546;-425,214,493,881,-773,-465,-210;205,-24,250,-773,-858,231,664;677,232,-99,-465,231,337,-335;232,-602,546,-210,664,-335,-405],[268,-65,-243,164,-411,352,-74;-65,-70,-191,22,81,89,508;-243,-191,-211,140,-200,-766,687;164,22,140,572,30,-779,441;-411,81,-200,30,-903,-329,510;352,89,-766,-779,-329,276,352;-74,508,687,441,510,352,-884],[183,-42,-185,-223,389,-71,312;-42,365,387,-828,-348,91,-815;-185,387,-561,484,-238,-10,374;-223,-828,484,-835,383,2,397;389,-348,-238,383,-852,-936,152;-71,91,-10,2,-936,834,-652;312,-815,374,397,152,-652,-485],[577,44,346,411,287,817,385;44,293,-391,67,455,-125,-706;346,-391,-393,690,600,-139,601;411,67,690,-29,112,301,-324;287,455,600,112,431,296,-877;817,-125,-139,301,296,-373,255;385,-706,601,-324,-877,255,-210];[808,-278,875,-231,-399,765,-565,50;-278,221,592,-213,177,-142,857,-69;875,592,-413,56,-105,-81,-184,406;-231,-213,56,-429,-157,175,484,135;-399,177,-105,-157,997,663,302,59;765,-142,-81,175,663,-39,137,106;-565,857,-184,484,302,137,-521,-252;50,-69,406,135,59,106,-252,399],[161,157,43,-345,453,649,77,-136;157,-768,194,-548,480,-97,-710,-429;43,194,-445,490,285,-678,923,637;-345,-548,490,215,271,-107,926,102;453,480,285,271,739,-373,-185,-466;649,-97,-678,-107,-373,755,464,-453;77,-710,923,926,-185,464,-617,-261;-136,-429,637,102,-466,-453,-261,-779],[743,-327,77,563,9,-897,132,362;-327,-673,511,210,-354,-168,-545,301;77,511,514,525,-511,-457,122,-456;563,210,525,236,132,29,199,266;9,-354,-511,132,94,158,286,-78;-897,-168,-457,29,158,738,10,-492;132,-545,122,199,286,10,242,-381;362,301,-456,266,-78,-492,-381,767],[551,505,-571,261,236,-131,341,85;505,641,-277,-294,298,-125,11,271;-571,-277,416,390,-95,-423,166,-278;261,-294,390,-219,-483,582,476,-175;236,298,-95,-483,736,-212,209,49;-131,-125,-423,582,-212,-712,-294,110;341,11,166,476,209,-294,-524,-50;85,271,-278,-175,49,110,-50,-539],[475,359,-523,-420,609,-527,-78,-101;359,953,646,-263,-266,-137,5,307;-523,646,348,289,453,-535,-289,-657;-420,-263,289,963,-124,-118,-1,-70;609,-266,453,-124,-338,470,831,300;-527,-137,-535,-118,470,-970,226,517;-78,5,-289,-1,831,226,-634,404;-101,307,-657,-70,300,517,404,366],[980,164,-93,192,119,-740,245,657;164,844,-4,-506,111,284,-440,-335;-93,-4,474,41,7,583,308,434;192,-506,41,52,-17,477,-103,147;119,111,7,-17,3,-449,-606,-38;-740,284,583,477,-449,288,186,-168;245,-440,308,-103,-606,186,588,-283;657,-335,434,147,-38,-168,-283,-608],[702,374,72,726,26,-251,-277,-646;374,-197,772,48,42,-921,-95,183;72,772,-944,671,685,-164,-307,-742;726,48,671,212,86,57,173,606;26,42,685,86,-552,-80,-561,-73;-251,-921,-164,57,-80,72,497,195;-277,-95,-307,173,-561,497,-715,-35;-646,183,-742,606,-73,195,-35,384],[311,-486,254,208,305,101,379,-147;-486,-706,1,375,-160,249,566,-784;254,1,965,-582,-576,72,367,355;208,375,-582,-634,-189,771,-100,526;305,-160,-576,-189,766,-326,-797,366;101,249,72,771,-326,-275,-288,498;379,566,367,-100,-797,-288,-796,295;-147,-784,355,526,366,498,295,-216],[621,385,545,-215,-193,652,-102,-335;385,663,-954,337,-89,-287,-52,295;545,-954,228,-68,-319,-537,54,548;-215,337,-68,128,-189,-89,-541,578;-193,-89,-319,-189,-471,340,-24,-53;652,-287,-537,-89,340,232,201,-740;-102,-52,54,-541,-24,201,-425,-527;-335,295,548,578,-53,-740,-527,935],[-757,829,-286,395,13,484,72,535;829,-659,-621,-139,-267,-51,833,-148;-286,-621,973,-667,136,-158,-20,-334;395,-139,-667,820,-595,275,54,196;13,-267,136,-595,450,157,-109,879;484,-51,-158,275,157,797,686,22;72,833,-20,54,-109,686,209,-440;535,-148,-334,196,879,22,-440,-811],[-810,-857,-276,-493,-173,-325,372,514;-857,171,228,152,592,-219,-809,-613;-276,228,737,-440,158,-63,-17,-24;-493,152,-440,465,392,592,-11,268;-173,592,158,392,-113,158,-58,-431;-325,-219,-63,592,158,593,164,241;372,-809,-17,-11,-58,164,-75,-227;514,-613,-24,268,-431,241,-227,-207],[-320,220,-310,312,251,-597,-2,-48;220,-268,-316,-874,-290,284,-485,327;-310,-316,-550,899,-626,180,-659,263;312,-874,899,187,-23,-716,166,726;251,-290,-626,-23,-140,-255,146,-160;-597,284,180,-716,-255,-256,429,-32;-2,-485,-659,166,146,429,717,38;-48,327,263,726,-160,-32,38,-834],[-26,222,-112,-333,-202,214,90,-711;222,436,-141,344,-370,108,-703,-562;-112,-141,494,-214,11,-781,-221,231;-333,344,-214,865,175,-617,-41,414;-202,-370,11,175,569,182,-413,-311;214,108,-781,-617,182,-617,409,-260;90,-703,-221,-41,-413,409,209,-42;-711,-562,231,414,-311,-260,-42,481],[-564,30,35,-156,437,-180,-133,-249;30,-287,-632,-442,-332,631,-502,-67;35,-632,-917,-31,-191,495,-541,-644;-156,-442,-31,-83,312,-212,116,192;437,-332,-191,312,-299,-112,-316,232;-180,631,495,-212,-112,264,226,-87;-133,-502,-541,116,-316,226,754,-95;-249,-67,-644,192,232,-87,-95,598],[-912,-37,407,599,368,434,324,26;-37,-10,-78,-400,-21,187,-151,603;407,-78,-198,817,111,-796,859,-436;599,-400,817,968,-805,154,-479,592;368,-21,111,-805,-57,-376,-632,-17;434,187,-796,154,-376,743,369,280;324,-151,859,-479,-632,369,-851,658;26,603,-436,592,-17,280,658,-803],[-211,212,428,-720,-651,188,708,-289;212,-780,-18,-345,265,194,-487,48;428,-18,-501,38,343,685,285,25;-720,-345,38,744,244,519,672,425;-651,265,343,244,941,-318,-56,-181;188,194,685,519,-318,12,-413,161;708,-487,285,672,-56,-413,276,-549;-289,48,25,425,-181,161,-549,604],[-262,150,242,-310,314,-665,312,805;150,-403,-540,80,-676,-607,128,-249;242,-540,-208,-712,-542,-247,358,147;-310,80,-712,-127,337,-608,-614,579;314,-676,-542,337,545,-175,-746,-36;-665,-607,-247,-608,-175,-653,74,245;312,128,358,-614,-746,74,-934,564;805,-249,147,579,-36,245,564,86],[-621,172,354,106,936,-47,258,-305;172,-331,95,-233,-331,445,-542,40;354,95,-677,117,-16,-298,162,247;106,-233,117,372,367,-647,-232,-136;936,-331,-16,367,523,274,375,8;-47,445,-298,-647,274,707,-765,291;258,-542,162,-232,375,-765,36,-485;-305,40,247,-136,8,291,-485,-453],[845,-105,-231,350,329,-442,755,132;-105,399,674,634,123,34,-145,94;-231,674,-531,427,170,683,-181,-350;350,634,427,439,450,333,654,65;329,123,170,450,27,209,373,-483;-442,34,683,333,209,359,808,-578;755,-145,-181,654,373,808,235,-349;132,94,-350,65,-483,-578,-349,353],[-54,-425,166,21,458,-478,-71,-682;-425,837,-567,179,-231,166,-555,-1;166,-567,572,71,329,-143,132,-98;21,179,71,766,447,548,-249,-499;458,-231,329,447,-82,-770,-182,-82;-478,166,-143,548,-770,-679,303,55;-71,-555,132,-249,-182,303,-210,-606;-682,-1,-98,-499,-82,55,-606,-368],[-721,246,-538,945,-96,391,-352,-225;246,-99,-25,127,-123,-252,421,-586;-538,-25,836,-549,-188,242,-514,-467;945,127,-549,-67,-54,-308,-641,-797;-96,-123,-188,-54,690,-45,498,393;391,-252,242,-308,-45,233,728,-371;-352,421,-514,-641,498,728,323,-365;-225,-586,-467,-797,393,-371,-365,728],[-585,-371,752,-334,482,193,-119,-166;-371,-666,736,37,-634,575,65,-174;752,736,893,938,124,325,-414,233;-334,37,938,-467,62,-672,100,416;482,-634,124,62,19,-618,-522,180;193,575,325,-672,-618,-131,253,120;-119,65,-414,100,-522,253,-644,-289;-166,-174,233,416,180,120,-289,598],[-834,14,-85,202,-197,503,-44,-425;14,-689,522,-656,108,-258,56,378;-85,522,-379,-334,-421,540,-321,-436;202,-656,-334,521,-642,475,228,-493;-197,108,-421,-642,-881,-119,-114,177;503,-258,540,475,-119,-137,-41,-60;-44,56,-321,228,-114,-41,432,141;-425,378,-436,-493,177,-60,141,759],[-177,-670,-708,580,-790,-437,-319,-249;-670,173,836,-376,-175,52,366,163;-708,836,-848,-301,-568,384,-254,-718;580,-376,-301,892,-36,310,110,-594;-790,-175,-568,-36,-118,-368,-4,-50;-437,52,384,310,-368,-714,19,-852;-319,366,-254,110,-4,19,2,-241;-249,163,-718,-594,-50,-852,-241,8],[-188,-684,-298,581,626,-102,640,-271;-684,-286,-288,6,563,375,-501,454;-298,-288,-904,-198,816,454,-228,-953;581,6,-198,-901,369,393,169,-407;626,563,816,369,-598,53,-48,223;-102,375,454,393,53,-426,-349,3;640,-501,-228,169,-48,-349,-775,91;-271,454,-953,-407,223,3,91,469],[-406,180,601,-134,-338,-95,63,-351;180,932,-550,469,-303,-40,61,657;601,-550,-144,32,-116,-137,-494,-200;-134,469,32,-249,-351,-722,47,-786;-338,-303,-116,-351,811,238,108,-360;-95,-40,-137,-722,238,905,-138,729;63,61,-494,47,108,-138,-307,-188;-351,657,-200,-786,-360,729,-188,-372],[-301,-656,-404,122,-19,-420,519,32;-656,597,-843,358,-870,-408,-391,-86;-404,-843,489,47,384,-497,260,-724;122,358,47,-27,-191,369,-31,261;-19,-870,384,-191,-545,-383,-707,59;-420,-408,-497,369,-383,-550,514,-45;519,-391,260,-31,-707,514,654,-187;32,-86,-724,261,59,-45,-187,-161],[-353,-129,579,82,195,1,272,-273;-129,9,195,812,-184,51,440,82;579,195,-69,-472,-465,312,104,111;82,812,-472,361,659,-204,267,-156;195,-184,-465,659,-714,62,401,868;1,51,312,-204,62,-976,-556,-353;272,440,104,267,401,-556,-326,-96;-273,82,111,-156,868,-353,-96,-597],[91,-161,609,247,729,447,479,-399;-161,209,-393,-128,-19,-315,465,436;609,-393,-513,321,366,186,423,-297;247,-128,321,-119,124,636,-287,-577;729,-19,366,124,-71,335,552,-241;447,-315,186,636,335,519,310,422;479,465,423,-287,552,310,775,366;-399,436,-297,-577,-241,422,366,-355],[864,442,244,-155,-133,-41,-487,571;442,472,-683,-97,-649,-19,-485,-208;244,-683,-671,-128,-199,-608,150,-536;-155,-97,-128,-925,85,167,-183,-527;-133,-649,-199,85,233,279,-334,135;-41,-19,-608,167,279,69,-373,0;-487,-485,150,-183,-334,-373,-106,-426;571,-208,-536,-527,135,0,-426,523],[-277,799,399,46,-158,-105,-472,-446;799,-725,-636,528,427,918,-580,-205;399,-636,340,250,-379,298,78,-671;46,528,250,856,-187,-67,428,-623;-158,427,-379,-187,-784,-648,-372,-213;-105,918,298,-67,-648,271,-176,126;-472,-580,78,428,-372,-176,-837,585;-446,-205,-671,-623,-213,126,585,-866],[384,-598,-133,-338,148,490,-16,-371;-598,-995,648,-350,342,400,-125,32;-133,648,996,505,0,-19,486,334;-338,-350,505,699,-188,238,-14,-539;148,342,0,-188,138,72,-665,-298;490,400,-19,238,72,-151,484,656;-16,-125,486,-14,-665,484,781,90;-371,32,334,-539,-298,656,90,-913],[92,-103,-494,-476,-657,645,189,167;-103,-454,650,198,-5,483,-364,151;-494,650,-948,373,-314,704,-66,-189;-476,198,373,438,325,289,-566,-82;-657,-5,-314,325,52,-318,726,-194;645,483,704,289,-318,22,-205,572;189,-364,-66,-566,726,-205,416,-656;167,151,-189,-82,-194,572,-656,48],[256,-683,-311,472,475,156,8,-81;-683,-560,272,-892,197,-847,-241,-426;-311,272,-332,240,-20,-498,-603,-791;472,-892,240,-68,-38,543,340,-54;475,197,-20,-38,-489,-220,526,-790;156,-847,-498,543,-220,404,33,-444;8,-241,-603,340,526,33,855,-374;-81,-426,-791,-54,-790,-444,-374,-140],[834,120,-67,-684,-158,287,-257,0;120,696,454,-382,221,298,-420,430;-67,454,-831,61,505,88,29,-217;-684,-382,61,723,-59,907,-77,-198;-158,221,505,-59,-790,-96,-243,-44;287,298,88,907,-96,-375,326,338;-257,-420,29,-77,-243,326,-742,542;0,430,-217,-198,-44,338,542,487],[-73,376,-251,-591,142,88,-240,-553;376,392,-586,-685,-342,62,860,219;-251,-586,-980,358,-652,-34,-337,-669;-591,-685,358,-594,66,-704,-283,-462;142,-342,-652,66,185,23,-832,-505;88,62,-34,-704,23,-48,187,363;-240,860,-337,-283,-832,187,-309,-78;-553,219,-669,-462,-505,363,-78,-382],[704,123,-420,-628,168,47,-187,-517;123,-936,335,460,-331,160,-13,300;-420,335,-344,653,525,-826,-226,-89;-628,460,653,-237,111,633,256,44;168,-331,525,111,-218,-414,-423,103;47,160,-826,633,-414,-976,254,455;-187,-13,-226,256,-423,254,726,-701;-517,300,-89,44,103,455,-701,118],[74,-582,-710,287,45,-329,81,-158;-582,483,48,-32,-267,807,-673,-380;-710,48,657,667,-217,-765,-42,921;287,-32,667,-183,-549,724,-303,-390;45,-267,-217,-549,960,295,-273,141;-329,807,-765,724,295,-575,-576,-53;81,-673,-42,-303,-273,-576,-285,-94;-158,-380,921,-390,141,-53,-94,-403],[-363,-189,12,113,-405,265,-209,-520;-189,-265,-291,-8,655,-267,803,235;12,-291,379,316,615,-94,78,148;113,-8,316,804,764,533,-529,-432;-405,655,615,764,-433,-79,-430,-441;265,-267,-94,533,-79,147,-8,-616;-209,803,78,-529,-430,-8,964,-121;-520,235,148,-432,-441,-616,-121,230],[-715,-69,-734,299,-234,696,-106,718;-69,657,-278,445,109,408,-494,-33;-734,-278,447,31,-49,8,84,356;299,445,31,-354,352,-757,34,672;-234,109,-49,352,-899,523,27,240;696,408,8,-757,523,-903,-324,-774;-106,-494,84,34,27,-324,358,-217;718,-33,356,672,240,-774,-217,527],[-583,-373,75,-445,158,99,-393,319;-373,-531,89,-168,206,-120,582,184;75,89,666,118,341,107,76,-283;-445,-168,118,870,91,47,-477,-305;158,206,341,91,-961,84,77,-237;99,-120,107,47,84,647,-663,81;-393,582,76,-477,77,-663,98,-171;319,184,-283,-305,-237,81,-171,128],[-921,-483,442,-562,500,-511,-292,248;-483,-903,107,-330,515,-219,-111,3;442,107,-303,-132,-487,19,564,830;-562,-330,-132,-18,235,-14,-436,354;500,515,-487,235,-836,97,-343,-125;-511,-219,19,-14,97,811,-63,-162;-292,-111,564,-436,-343,-63,39,100;248,3,830,354,-125,-162,100,-238],[429,75,-149,-102,567,-56,350,788;75,-27,-189,302,-275,-157,-136,319;-149,-189,475,-172,82,98,-54,-680;-102,302,-172,192,288,249,728,-21;567,-275,82,288,421,-188,-834,-563;-56,-157,98,249,-188,989,-245,661;350,-136,-54,728,-834,-245,716,-165;788,319,-680,-21,-563,661,-165,-625],[771,-671,-414,135,-676,-505,-283,-540;-671,228,755,322,-429,-87,-218,-102;-414,755,678,120,-281,-41,62,-28;135,322,120,-69,-160,158,73,-533;-676,-429,-281,-160,677,-133,-518,821;-505,-87,-41,158,-133,-701,87,164;-283,-218,62,73,-518,87,-494,-727;-540,-102,-28,-533,821,164,-727,8],[7,-57,-530,89,212,72,221,-397;-57,-984,-288,-134,-115,-237,16,-609;-530,-288,-355,-75,487,-208,320,48;89,-134,-75,-20,-223,-303,-62,-119;212,-115,487,-223,-657,-306,248,-290;72,-237,-208,-303,-306,375,-375,154;221,16,320,-62,248,-375,-568,-201;-397,-609,48,-119,-290,154,-201,-626],[-320,-26,261,617,-684,-155,-3,-251;-26,-683,-415,890,596,106,194,-555;261,-415,-11,184,106,611,159,-57;617,890,184,122,-552,755,644,-332;-684,596,106,-552,164,-389,-260,-35;-155,106,611,755,-389,90,442,196;-3,194,159,644,-260,442,7,83;-251,-555,-57,-332,-35,196,83,-862],[-115,-242,247,-150,-239,-13,340,-158;-242,889,-712,172,-772,48,37,172;247,-712,749,333,-221,-244,-206,-474;-150,172,333,36,389,374,-73,-204;-239,-772,-221,389,599,-311,36,-293;-13,48,-244,374,-311,-985,-43,-149;340,37,-206,-73,36,-43,-949,633;-158,172,-474,-204,-293,-149,633,-202],[185,390,-301,-518,11,382,285,112;390,166,-418,66,-113,-163,-552,-874;-301,-418,-736,317,-216,713,-36,-508;-518,66,317,-191,865,108,964,218;11,-113,-216,865,-994,-528,234,-54;382,-163,713,108,-528,-481,509,742;285,-552,-36,964,234,509,-181,-354;112,-874,-508,218,-54,742,-354,606],[225,-41,-323,-325,857,2,-111,852;-41,-296,-186,181,-1,77,-152,-513;-323,-186,-964,372,-599,-264,24,-232;-325,181,372,-285,22,225,-502,-88;857,-1,-599,22,-500,354,352,114;2,77,-264,225,354,247,77,-245;-111,-152,24,-502,352,77,823,272;852,-513,-232,-88,114,-245,272,-640],[-882,182,-721,-2,708,658,-128,-405;182,-600,-779,-15,-33,-307,3,500;-721,-779,726,14,816,30,79,-513;-2,-15,14,-937,-385,-212,106,-673;708,-33,816,-385,652,857,125,-490;658,-307,30,-212,857,327,478,-519;-128,3,79,106,125,478,604,348;-405,500,-513,-673,-490,-519,348,-49],[-247,279,-233,300,-596,536,107,119;279,-955,-57,-108,-312,-241,-470,-649;-233,-57,968,-576,-494,160,-80,254;300,-108,-576,-275,258,-208,-187,-574;-596,-312,-494,258,312,301,262,202;536,-241,160,-208,301,-13,-220,-389;107,-470,-80,-187,262,-220,292,412;119,-649,254,-574,202,-389,412,428],[-992,-65,97,-390,110,-593,65,469;-65,849,100,813,302,-85,1,445;97,100,-914,841,-808,149,-604,-588;-390,813,841,-444,-129,338,276,-397;110,302,-808,-129,672,316,-197,88;-593,-85,149,338,316,350,-83,-642;65,1,-604,276,-197,-83,-872,249;469,445,-588,-397,88,-642,249,900],[-518,-140,218,137,-57,-375,618,614;-140,-544,255,156,-208,424,45,-306;218,255,851,-169,-208,100,432,-277;137,156,-169,276,-540,435,-567,591;-57,-208,-208,-540,-706,360,79,-168;-375,424,100,435,360,-959,-542,39;618,45,432,-567,79,-542,243,-547;614,-306,-277,591,-168,39,-547,985],[659,-3,124,177,-179,-29,764,-387;-3,-481,302,172,-11,23,30,-255;124,302,-722,255,-99,496,247,-661;177,172,255,-551,584,364,27,83;-179,-11,-99,584,-849,-119,-627,91;-29,23,496,364,-119,-189,195,-173;764,30,247,27,-627,195,-196,-547;-387,-255,-661,83,91,-173,-547,558],[-467,572,-60,174,-365,155,-386,-903;572,-724,298,97,302,-434,-77,173;-60,298,-941,-511,178,212,434,191;174,97,-511,-928,831,-352,584,114;-365,302,178,831,-165,-25,-308,-87;155,-434,212,-352,-25,-254,-314,-740;-386,-77,434,584,-308,-314,236,173;-903,173,191,114,-87,-740,173,-567],[584,220,-533,423,173,214,-377,623;220,662,-31,912,-94,45,606,512;-533,-31,-451,-122,-411,65,393,855;423,912,-122,-142,348,-541,449,368;173,-94,-411,348,934,376,213,-579;214,45,65,-541,376,700,116,432;-377,606,393,449,213,116,-404,-43;623,512,855,368,-579,432,-43,-804],[542,64,-578,858,-678,-686,373,-98;64,314,-421,610,-603,-73,414,-411;-578,-421,-644,-311,-172,136,198,-320;858,610,-311,639,941,-22,142,397;-678,-603,-172,941,-831,304,-262,-155;-686,-73,136,-22,304,463,-216,-88;373,414,198,142,-262,-216,236,-381;-98,-411,-320,397,-155,-88,-381,-264],[773,-819,-786,105,-88,-614,-700,-859;-819,-558,-403,725,-163,-168,-124,-35;-786,-403,-618,-257,-685,369,357,471;105,725,-257,430,-530,473,-178,347;-88,-163,-685,-530,-794,197,144,708;-614,-168,369,473,197,-255,282,237;-700,-124,357,-178,144,282,757,451;-859,-35,471,347,708,237,451,134],[-829,21,-560,-575,193,-236,-375,-315;21,-125,31,-537,-127,-577,-390,-607;-560,31,801,-352,13,-126,-42,169;-575,-537,-352,509,231,25,-174,122;193,-127,13,231,201,550,134,419;-236,-577,-126,25,550,-591,-149,-534;-375,-390,-42,-174,134,-149,-158,-290;-315,-607,169,122,419,-534,-290,412],[311,371,379,404,213,474,314,-104;371,683,-450,107,66,-27,35,37;379,-450,-232,17,-94,115,603,-1;404,107,17,-500,768,634,-765,14;213,66,-94,768,-80,62,-318,-243;474,-27,115,634,62,486,-331,594;314,35,603,-765,-318,-331,910,-389;-104,37,-1,14,-243,594,-389,-788],[-796,156,607,220,-460,23,-736,-365;156,620,-547,-507,-226,418,40,-217;607,-547,-238,283,-676,-375,77,263;220,-507,283,-262,-30,46,130,-325;-460,-226,-676,-30,-83,7,434,-307;23,418,-375,46,7,-664,756,-274;-736,40,77,130,434,756,601,65;-365,-217,263,-325,-307,-274,65,867],[332,-160,-560,30,-455,505,-16,-30;-160,227,293,157,-68,-201,-32,341;-560,293,-676,682,392,85,60,385;30,157,682,350,585,-1,-314,-117;-455,-68,392,585,571,224,-112,720;505,-201,85,-1,224,-69,-83,-237;-16,-32,60,-314,-112,-83,-20,333;-30,341,385,-117,720,-237,333,-638],[-257,400,-726,473,104,-420,-104,-332;400,-219,-591,389,-249,-163,230,-100;-726,-591,-491,-311,-280,605,-699,89;473,389,-311,-729,203,-358,451,-77;104,-249,-280,203,-113,-682,544,330;-420,-163,605,-358,-682,551,609,-65;-104,230,-699,451,544,609,921,-452;-332,-100,89,-77,330,-65,-452,575],[-172,-171,-32,549,-113,328,-33,-219;-171,-630,843,-273,-135,-17,-395,-30;-32,843,-249,-309,50,-250,481,525;549,-273,-309,-945,521,766,134,488;-113,-135,50,521,808,-341,311,485;328,-17,-250,766,-341,-684,846,-132;-33,-395,481,134,311,846,-536,-541;-219,-30,525,488,485,-132,-541,-235],[-7,-168,267,44,525,215,739,74;-168,-792,105,575,643,-374,-272,613;267,105,911,841,-72,316,-390,-109;44,575,841,-348,142,53,-49,-176;525,643,-72,142,369,463,269,-86;215,-374,316,53,463,-217,197,-37;739,-272,-390,-49,269,197,-922,32;74,613,-109,-176,-86,-37,32,595],[-211,856,-146,-570,-229,-636,-109,282;856,-94,-63,409,-620,234,498,641;-146,-63,134,90,533,93,156,-454;-570,409,90,-568,-617,-89,33,-511;-229,-620,533,-617,396,-278,526,-220;-636,234,93,-89,-278,456,-308,700;-109,498,156,33,526,-308,-456,-540;282,641,-454,-511,-220,700,-540,-886],[143,-192,-28,-357,370,50,359,143;-192,-232,729,-314,767,55,108,-599;-28,729,-278,12,-316,803,-842,869;-357,-314,12,-420,552,-467,634,388;370,767,-316,552,-500,-42,212,-277;50,55,803,-467,-42,392,885,98;359,108,-842,634,212,885,-183,-117;143,-599,869,388,-277,98,-117,938],[-801,780,-373,306,688,-182,573,-120;780,-749,424,-128,-456,584,116,-312;-373,424,-407,-389,-408,153,-533,48;306,-128,-389,571,-142,687,-170,-137;688,-456,-408,-142,17,-236,-234,507;-182,584,153,687,-236,-819,-447,865;573,116,-533,-170,-234,-447,-451,-411;-120,-312,48,-137,507,865,-411,459],[-157,-171,263,17,-728,-193,762,257;-171,-413,-239,-868,431,364,-566,-172;263,-239,-37,-585,311,362,-186,715;17,-868,-585,797,-416,-674,138,-520;-728,431,311,-416,-918,-227,-483,483;-193,364,362,-674,-227,-581,-508,923;762,-566,-186,138,-483,-508,42,-343;257,-172,715,-520,483,923,-343,-720],[367,329,361,-44,320,-128,349,580;329,-827,370,37,412,-234,358,399;361,370,-232,231,-103,-208,778,-174;-44,37,231,471,-605,450,-70,-310;320,412,-103,-605,416,229,143,-225;-128,-234,-208,450,229,-617,561,771;349,358,778,-70,143,561,-742,6;580,399,-174,-310,-225,771,6,-852],[-229,-391,772,601,-348,-207,312,952;-391,-368,-245,265,170,252,694,109;772,-245,893,-441,156,235,-210,-620;601,265,-441,838,585,-262,753,-32;-348,170,156,585,465,476,-52,-421;-207,252,235,-262,476,986,-370,-203;312,694,-210,753,-52,-370,-897,521;952,109,-620,-32,-421,-203,521,506],[-895,-403,690,-490,130,-670,-27,837;-403,-392,384,-401,932,195,-213,-813;690,384,658,205,448,-825,182,-445;-490,-401,205,-742,-179,-657,-368,36;130,932,448,-179,-606,717,-29,176;-670,195,-825,-657,717,-861,271,-35;-27,-213,182,-368,-29,271,541,369;837,-813,-445,36,176,-35,369,-628],[-208,-129,8,142,-466,103,11,-558;-129,136,84,631,198,715,-292,-724;8,84,-917,-178,-648,-243,868,-444;142,631,-178,-893,-614,792,146,-291;-466,198,-648,-614,22,83,-180,245;103,715,-243,792,83,-465,22,413;11,-292,868,146,-180,22,-818,895;-558,-724,-444,-291,245,413,895,617],[-749,13,400,364,-214,-750,632,-364;13,-929,664,398,-182,30,80,115;400,664,-703,58,84,472,-419,-60;364,398,58,-487,162,-686,-466,-577;-214,-182,84,162,138,504,674,759;-750,30,472,-686,504,439,770,311;632,80,-419,-466,674,770,859,393;-364,115,-60,-577,759,311,393,787],[-780,366,-190,-207,963,-465,-393,-877;366,-624,-844,-177,571,-282,-3,430;-190,-844,-927,753,440,-517,-286,378;-207,-177,753,-189,540,-9,322,889;963,571,440,540,-286,141,272,219;-465,-282,-517,-9,141,411,268,-27;-393,-3,-286,322,272,268,-738,-192;-877,430,378,889,219,-27,-192,462],[-969,275,-875,-677,-65,29,-457,281;275,-833,262,116,-111,-162,-803,262;-875,262,773,56,-424,277,613,-156;-677,116,56,-825,187,-17,-92,-595;-65,-111,-424,187,401,49,-206,235;29,-162,277,-17,49,4,-2,-491;-457,-803,613,-92,-206,-2,87,-117;281,262,-156,-595,235,-491,-117,746],[662,-401,-344,169,-494,-266,58,-462;-401,282,-394,-578,583,-777,129,-408;-344,-394,130,-422,-675,-224,-202,844;169,-578,-422,-772,46,-336,285,193;-494,583,-675,46,257,519,-626,361;-266,-777,-224,-336,519,-710,-395,-567;58,129,-202,285,-626,-395,197,-529;-462,-408,844,193,361,-567,-529,825],[771,-245,-364,456,818,466,-355,418;-245,683,63,841,-615,-647,-229,-571;-364,63,-904,-357,-173,248,-72,-122;456,841,-357,551,-822,-150,-466,-277;818,-615,-173,-822,26,-44,590,-105;466,-647,248,-150,-44,697,-201,462;-355,-229,-72,-466,590,-201,200,-273;418,-571,-122,-277,-105,462,-273,-389],[965,-217,305,-118,-647,45,-167,309;-217,400,-58,-466,871,47,24,-351;305,-58,600,440,81,-628,392,-551;-118,-466,440,821,30,408,-66,334;-647,871,81,30,372,-576,599,-252;45,47,-628,408,-576,-48,120,-643;-167,24,392,-66,599,120,376,-424;309,-351,-551,334,-252,-643,-424,353],[-551,-129,218,172,224,294,-114,759;-129,786,-11,-40,-258,-180,216,-302;218,-11,-593,339,-345,464,297,-39;172,-40,339,918,403,-652,524,-436;224,-258,-345,403,304,-88,731,-248;294,-180,464,-652,-88,-967,180,-17;-114,216,297,524,731,180,-709,369;759,-302,-39,-436,-248,-17,369,671],[751,511,288,32,-487,-406,560,-452;511,694,174,-578,-261,78,740,-114;288,174,-655,-159,93,-592,171,-450;32,-578,-159,-300,-98,-871,-337,414;-487,-261,93,-98,-360,130,114,734;-406,78,-592,-871,130,-107,-67,-138;560,740,171,-337,114,-67,-524,-192;-452,-114,-450,414,734,-138,-192,-172],[-409,-70,-354,16,302,674,-392,37;-70,812,-82,-106,-660,443,52,-681;-354,-82,-971,-380,676,0,78,-649;16,-106,-380,209,826,238,-415,-588;302,-660,676,826,691,-912,-414,392;674,443,0,238,-912,271,-704,-648;-392,52,78,-415,-414,-704,-564,238;37,-681,-649,-588,392,-648,238,143],[49,-361,-254,183,596,77,-489,223;-361,690,-97,731,-794,321,218,-377;-254,-97,-213,-178,50,-583,-87,-61;183,731,-178,-75,478,-828,194,635;596,-794,50,478,443,-66,-569,482;77,321,-583,-828,-66,-710,-145,152;-489,218,-87,194,-569,-145,-186,76;223,-377,-61,635,482,152,76,280],[12,-62,256,-318,-301,163,517,676;-62,140,-179,192,722,422,-51,460;256,-179,865,256,-222,223,512,-360;-318,192,256,-693,-478,-147,-717,-12;-301,722,-222,-478,356,-483,-401,58;163,422,223,-147,-483,615,-348,208;517,-51,512,-717,-401,-348,-94,658;676,460,-360,-12,58,208,658,774],[-482,-99,101,290,699,779,444,4;-99,-530,-619,805,-731,303,494,432;101,-619,35,-658,283,-201,776,133;290,805,-658,149,-429,40,117,-153;699,-731,283,-429,501,-178,-100,457;779,303,-201,40,-178,795,7,151;444,494,776,117,-100,7,790,-32;4,432,133,-153,457,151,-32,450],[-102,-121,606,747,-445,650,-248,-322;-121,-324,623,449,-222,79,-5,284;606,623,638,-378,-312,306,-624,223;747,449,-378,426,317,-322,-254,789;-445,-222,-312,317,80,-69,-729,-560;650,79,306,-322,-69,-4,19,290;-248,-5,-624,-254,-729,19,-786,717;-322,284,223,789,-560,290,717,536],[769,728,83,-893,-123,303,-727,73;728,2,44,-400,-118,-698,-106,462;83,44,611,395,-65,253,-311,-104;-893,-400,395,-888,-445,221,-342,454;-123,-118,-65,-445,-498,-643,-461,396;303,-698,253,221,-643,-309,-84,-275;-727,-106,-311,-342,-461,-84,-77,-83;73,462,-104,454,396,-275,-83,-915],[-264,-34,-773,-380,-165,-238,-451,233;-34,411,276,-418,-599,-411,-329,-122;-773,276,-527,-522,-863,-540,-534,-267;-380,-418,-522,-922,143,-219,-640,719;-165,-599,-863,143,-8,-426,-780,688;-238,-411,-540,-219,-426,956,578,525;-451,-329,-534,-640,-780,578,-482,611;233,-122,-267,719,688,525,611,-91],[-727,-204,-407,561,715,523,97,403;-204,321,6,-311,-835,-57,-320,-651;-407,6,-734,328,-513,-315,-684,467;561,-311,328,472,389,-406,158,144;715,-835,-513,389,-670,293,-288,243;523,-57,-315,-406,293,-126,-424,3;97,-320,-684,158,-288,-424,-20,-409;403,-651,467,144,243,3,-409,-404],[585,-649,-20,-788,-492,233,-3,-459;-649,592,-444,-52,108,-208,60,-471;-20,-444,-670,-284,112,-614,437,-51;-788,-52,-284,-851,-380,-418,-83,313;-492,108,112,-380,659,484,-148,-851;233,-208,-614,-418,484,-878,-229,-51;-3,60,437,-83,-148,-229,856,-48;-459,-471,-51,313,-851,-51,-48,-736],[-632,792,-88,-409,-516,253,57,7;792,-950,26,-138,-687,-384,-321,221;-88,26,395,-111,124,78,-866,9;-409,-138,-111,485,-381,-61,-227,-21;-516,-687,124,-381,-621,-608,-847,-447;253,-384,78,-61,-608,-807,-31,289;57,-321,-866,-227,-847,-31,-293,1;7,221,9,-21,-447,289,1,537],[-809,-182,-507,-173,66,-252,384,362;-182,973,76,-203,132,-386,-237,-167;-507,76,768,580,-290,-558,479,-341;-173,-203,580,561,346,469,-259,55;66,132,-290,346,-992,-268,-890,-687;-252,-386,-558,469,-268,770,382,-15;384,-237,479,-259,-890,382,735,-448;362,-167,-341,55,-687,-15,-448,-161],[862,-108,755,-38,-596,137,-448,-350;-108,763,-551,-180,-255,-748,-630,298;755,-551,543,495,442,833,91,-214;-38,-180,495,24,-157,-970,-101,-680;-596,-255,442,-157,468,-23,830,-133;137,-748,833,-970,-23,-377,-425,67;-448,-630,91,-101,830,-425,-360,-172;-350,298,-214,-680,-133,67,-172,-555],[445,-67,205,766,-107,-244,645,-225;-67,-335,16,578,-516,561,37,159;205,16,566,-155,79,35,336,12;766,578,-155,-980,-589,-244,278,-707;-107,-516,79,-589,604,149,-175,487;-244,561,35,-244,149,996,333,-445;645,37,336,278,-175,333,552,167;-225,159,12,-707,487,-445,167,-196],[719,465,663,-460,488,254,289,543;465,696,-397,462,-45,-60,-52,-414;663,-397,-498,-795,-1,85,-641,542;-460,462,-795,448,149,-162,-191,103;488,-45,-1,149,846,-310,151,-451;254,-60,85,-162,-310,-209,329,-401;289,-52,-641,-191,151,329,523,-535;543,-414,542,103,-451,-401,-535,-482],[686,168,490,158,-28,-255,-603,-335;168,81,80,586,-518,-173,-347,-52;490,80,681,-523,-47,726,175,-173;158,586,-523,-623,633,-510,-341,240;-28,-518,-47,633,-244,6,163,680;-255,-173,726,-510,6,-38,-308,536;-603,-347,175,-341,163,-308,373,-285;-335,-52,-173,240,680,536,-285,928],[-645,493,252,544,490,-55,678,489;493,300,175,264,592,-118,-149,162;252,175,506,-71,-783,476,-311,-383;544,264,-71,807,15,310,5,-54;490,592,-783,15,-208,-24,24,602;-55,-118,476,310,-24,-661,-438,622;678,-149,-311,5,24,-438,-191,-717;489,162,-383,-54,602,622,-717,633],[-649,492,-617,-501,436,492,68,420;492,-527,158,451,-751,-511,-27,362;-617,158,47,-742,287,-440,-207,-633;-501,451,-742,60,3,591,-272,576;436,-751,287,3,987,171,-341,216;492,-511,-440,591,171,754,-589,72;68,-27,-207,-272,-341,-589,-457,-540;420,362,-633,576,216,72,-540,-671],[-987,-794,-212,262,437,361,75,10;-794,-864,54,258,-749,196,-740,559;-212,54,-981,347,117,-94,-148,270;262,258,347,-102,186,251,-199,617;437,-749,117,186,308,-212,244,-56;361,196,-94,251,-212,630,404,-369;75,-740,-148,-199,244,404,-236,-387;10,559,270,617,-56,-369,-387,216],[460,-64,-595,-579,468,780,626,353;-64,-439,223,-29,-324,286,748,-228;-595,223,727,867,481,106,670,90;-579,-29,867,120,-139,-151,35,144;468,-324,481,-139,-673,229,347,552;780,286,106,-151,229,319,273,210;626,748,670,35,347,273,646,-330;353,-228,90,144,552,210,-330,-173]];} +TEST(deb=1,fin=6)= +{ + for(i=deb,fin, + print("dim=",i+2); + for(j=1,100, + Q=M[i,j]; + s=qfsolve(Q); + if(type(s)=="t_INT", print([j,s]), if(s~*Q*s, error(Q))); + ); + ); +} +TEST() + +G = [1,0,0;0,1,0;0,0,-34]; +qfparam(G, qfsolve(G)) +qfparam(G, qfsolve(G),1) +qfparam(G, qfsolve(G),2) + +qfsolve(Mat(0)) +qfsolve(Mat(1)) +qfsolve([1,2;2,1]) +qfsolve([0,1;1,1]) +qfsolve([35, 46; 46, 60]) + +qfparam(matdiagonal([1,1,-1]),[1,0,1]) +qfsolve(matdiagonal([1,1,-25])) + +qfsolve([1,0,0;0,3,0;0,0,-2]) +qfparam([0,0,-12;0,-12,0;-12,0,-1],[1,0,0]~,3) +q=[-1,-4,-8;-4,-15,-31;-8,-31,-62]/4; qfparam(q,qfsolve(q)) + +\\#1661 +qfsolve([1,0,0;0,1,1;0,0,1]); +\\#1725 +qfsolve(matdiagonal([1,1,1,1,1,1,-7])) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestQfsolve(unittest.TestCase): + def test_qfsolve(self): + M = [['[-634,-706,-200;-706,527,-110;-200,-110,-997]', '[-670,164,205;164,-391,-509;205,-509,-117]', + '[586,-448,120;-448,-342,-233;120,-233,-851]', '[-387,-147,450;-147,-808,-22;450,-22,-119]', + '[739,-44,-48;-44,-739,-134;-48,-134,459]', '[-519,-45,-514;-45,324,178;-514,178,-83]', + '[-482,-683,18;-683,705,852;18,852,315]', '[808,-16,555;-16,-723,-538;555,-538,-66]', + '[243,205,-14;205,-119,853;-14,853,891]', '[-220,10,-564;10,-440,-9;-564,-9,413]', + '[383,66,53;66,-962,-104;53,-104,300]', '[-845,257,264;257,-7,-866;264,-866,259]', + '[-76,676,371;676,-541,-332;371,-332,-417]', '[111,-203,-57;-203,-634,-30;-57,-30,275]', + '[-926,-548,-178;-548,483,141;-178,141,-953]', '[-810,-164,648;-164,-802,-612;648,-612,-274]', + '[818,88,630;88,369,524;630,524,-565]', '[-165,99,-70;99,83,-716;-70,-716,-493]', + '[-183,56,320;56,509,-931;320,-931,-543]', '[19,799,-94;799,-866,-658;-94,-658,-604]', + '[-859,-569,525;-569,476,217;525,217,-852]', '[-527,708,47;708,22,-79;47,-79,902]', + '[360,-425,126;-425,-578,-411;126,-411,581]', '[2,821,59;821,-893,524;59,524,-788]', + '[470,155,-752;155,-679,-683;-752,-683,-584]', '[398,107,-644;107,-840,374;-644,374,-274]', + '[-839,8,-410;8,-451,-774;-410,-774,801]', '[-556,-134,-368;-134,183,566;-368,566,686]', + '[-62,354,-396;354,313,350;-396,350,-891]', '[518,163,17;163,821,332;17,332,-593]', + '[574,-155,19;-155,424,305;19,305,-978]', '[-720,873,341;873,-131,-116;341,-116,-414]', + '[417,-39,201;-39,910,-9;201,-9,-538]', '[-34,-193,-22;-193,-632,362;-22,362,-778]', + '[36,-748,-131;-748,-21,147;-131,147,-143]', '[-236,-560,-211;-560,803,-632;-211,-632,620]', + '[708,-76,-360;-76,814,248;-360,248,263]', '[790,-271,-338;-271,-114,-400;-338,-400,-12]', + '[-744,-737,-70;-737,-270,-754;-70,-754,816]', '[-845,520,141;520,-559,73;141,73,132]', + '[-276,406,-305;406,153,-349;-305,-349,41]', '[632,62,653;62,-125,439;653,439,-256]', + '[-598,-39,-488;-39,-36,461;-488,461,-506]', '[406,99,-178;99,747,-99;-178,-99,781]', + '[686,-38,-491;-38,-330,-564;-491,-564,253]', '[427,69,-615;69,933,215;-615,215,-558]', + '[290,-326,-365;-326,928,208;-365,208,754]', '[-149,-113,197;-113,877,292;197,292,233]', + '[-701,-265,776;-265,911,-259;776,-259,-531]', '[81,-169,-170;-169,445,-107;-170,-107,632]', + '[-433,153,215;153,15,-362;215,-362,-77]', '[-108,10,-734;10,-133,-88;-734,-88,-154]', + '[-48,-365,-68;-365,413,-217;-68,-217,-436]', '[162,-63,184;-63,-728,-240;184,-240,-845]', + '[-96,-233,-747;-233,951,833;-747,833,-30]', '[-314,-311,-656;-311,322,-663;-656,-663,-639]', + '[-106,-465,-662;-465,-111,53;-662,53,-97]', '[-410,166,-445;166,-565,104;-445,104,823]', + '[180,-312,19;-312,984,-10;19,-10,701]', '[-165,936,-247;936,103,743;-247,743,-414]', + '[-571,451,-527;451,419,-499;-527,-499,-473]', '[-680,182,651;182,-194,-89;651,-89,-889]', + '[670,75,246;75,72,609;246,609,-58]', '[-929,-764,508;-764,-984,-405;508,-405,-915]', + '[102,736,116;736,634,722;116,722,-656]', '[33,214,-533;214,-205,-453;-533,-453,844]', + '[235,270,-692;270,68,-323;-692,-323,729]', '[945,236,5;236,-506,329;5,329,866]', + '[885,-737,539;-737,908,146;539,146,314]', '[-179,-252,-29;-252,-966,442;-29,442,-116]', + '[-496,-25,-581;-25,-90,-136;-581,-136,492]', '[513,432,-290;432,-708,47;-290,47,-933]', + '[364,-386,-310;-386,-460,224;-310,224,-363]', '[-124,214,795;214,-930,-213;795,-213,818]', + '[69,-552,-189;-552,807,-300;-189,-300,249]', '[-977,-141,-158;-141,169,199;-158,199,-355]', + '[929,268,383;268,945,618;383,618,943]', '[177,-329,-78;-329,-953,216;-78,216,644]', + '[-335,-314,-76;-314,-572,-229;-76,-229,-214]', '[609,-226,65;-226,578,271;65,271,-938]', + '[962,-213,483;-213,-159,383;483,383,473]', '[-821,-501,368;-501,-602,489;368,489,461]', + '[-636,-385,597;-385,-913,903;597,903,849]', '[967,350,-825;350,352,475;-825,475,974]', + '[-982,7,98;7,-563,-840;98,-840,-726]', '[-504,81,-124;81,-470,191;-124,191,-846]', + '[756,273,253;273,932,348;253,348,331]', '[52,-645,783;-645,-606,-565;783,-565,918]', + '[22,-781,-238;-781,-382,-637;-238,-637,-618]', '[-405,497,-397;497,-489,-593;-397,-593,-916]', + '[-856,5,85;5,-866,-24;85,-24,-540]', '[764,-153,9;-153,362,-127;9,-127,-1000]', + '[-551,-637,624;-637,-864,361;624,361,12]', '[-522,203,-199;203,-239,-581;-199,-581,-228]', + '[724,644,245;644,71,456;245,456,983]', '[-369,-142,164;-142,-644,302;164,302,580]', + '[-485,-786,-362;-786,-207,-326;-362,-326,-257]', '[373,-271,514;-271,734,390;514,390,-410]', + '[-223,-301,32;-301,-480,-549;32,-549,358]', '[-501,82,-557;82,609,-296;-557,-296,962]'], + ['[394,-209,-606,-399;-209,-552,157,-626;-606,157,144,-188;-399,-626,-188,293]', + '[-870,-559,-338,-156;-559,931,293,-7;-338,293,-920,46;-156,-7,46,-563]', + '[703,435,-32,-310;435,-313,103,-144;-32,103,-262,64;-310,-144,64,-769]', + '[523,481,141,-252;481,-291,-403,7;141,-403,-625,-556;-252,7,-556,847]', + '[473,331,-38,-36;331,-346,-409,58;-38,-409,-864,-20;-36,58,-20,-299]', + '[847,138,609,-195;138,-215,232,-257;609,232,953,220;-195,-257,220,63]', + '[544,-494,56,-441;-494,-73,154,-847;56,154,-427,565;-441,-847,565,-503]', + '[-548,200,253,353;200,-582,142,278;253,142,-514,-577;353,278,-577,-555]', + '[-954,-835,-720,-541;-835,-642,116,74;-720,116,-939,168;-541,74,168,32]', + '[-921,16,-253,-807;16,559,-16,-401;-253,-16,604,591;-807,-401,591,848]', + '[-184,326,-437,151;326,-560,373,-103;-437,373,-913,-731;151,-103,-731,735]', + '[637,57,-209,785;57,708,463,-909;-209,463,197,-275;785,-909,-275,751]', + '[901,175,-364,245;175,14,141,811;-364,141,-104,-499;245,811,-499,-705]', + '[-184,942,-258,171;942,-149,-629,366;-258,-629,-935,216;171,366,216,986]', + '[661,647,-235,-432;647,-176,177,192;-235,177,-123,379;-432,192,379,-760]', + '[-957,440,-161,-888;440,2,-148,-48;-161,-148,-598,-743;-888,-48,-743,550]', + '[959,720,-158,225;720,-588,-46,258;-158,-46,530,-753;225,258,-753,367]', + '[291,-64,-481,-53;-64,829,386,305;-481,386,638,213;-53,305,213,22]', + '[949,-74,304,129;-74,-143,-673,-167;304,-673,545,-43;129,-167,-43,-485]', + '[217,861,-669,-333;861,884,-12,675;-669,-12,110,-540;-333,675,-540,67]', + '[957,-415,416,493;-415,862,148,-308;416,148,453,-253;493,-308,-253,-822]', + '[-838,-392,-57,-288;-392,-83,130,323;-57,130,87,199;-288,323,199,-464]', + '[-43,256,-625,-195;256,-320,362,1;-625,362,-611,-142;-195,1,-142,-538]', + '[-524,-608,-260,-17;-608,-211,-123,-438;-260,-123,633,-264;-17,-438,-264,659]', + '[139,-93,776,-239;-93,384,67,-639;776,67,-561,-645;-239,-639,-645,895]', + '[704,-399,-485,-425;-399,-519,748,163;-485,748,-182,-274;-425,163,-274,834]', + '[67,-693,-88,664;-693,987,39,-62;-88,39,-915,-327;664,-62,-327,-434]', + '[-901,102,-239,-270;102,-311,-212,591;-239,-212,771,-105;-270,591,-105,502]', + '[-58,-876,422,-195;-876,-105,-761,-819;422,-761,-760,379;-195,-819,379,117]', + '[995,22,48,-495;22,519,368,-411;48,368,-925,720;-495,-411,720,632]', + '[445,-738,-222,299;-738,-786,-232,-352;-222,-232,-619,-341;299,-352,-341,81]', + '[-490,495,1,-342;495,-222,192,608;1,192,6,-412;-342,608,-412,-723]', + '[684,-101,124,-102;-101,395,-184,413;124,-184,-731,14;-102,413,14,-945]', + '[102,-118,-635,-737;-118,-652,37,575;-635,37,-879,-84;-737,575,-84,748]', + '[732,-244,-50,270;-244,-277,53,574;-50,53,-224,683;270,574,683,223]', + '[466,-48,-330,-472;-48,-834,699,-489;-330,699,-318,745;-472,-489,745,859]', + '[252,72,115,248;72,-846,11,-645;115,11,289,281;248,-645,281,-276]', + '[270,537,-17,345;537,289,-338,489;-17,-338,429,-701;345,489,-701,-214]', + '[731,812,-291,-457;812,-9,-77,294;-291,-77,217,156;-457,294,156,-646]', + '[246,160,-739,53;160,560,-7,437;-739,-7,-803,13;53,437,13,4]', + '[789,-415,-730,436;-415,905,-467,34;-730,-467,97,-35;436,34,-35,128]', + '[111,120,-205,-83;120,358,-58,284;-205,-58,-131,-463;-83,284,-463,825]', + '[96,-218,-174,-75;-218,-200,378,201;-174,378,-221,-29;-75,201,-29,169]', + '[841,-443,244,834;-443,-46,774,-48;244,774,188,194;834,-48,194,-966]', + '[-622,430,-699,-145;430,-977,30,-116;-699,30,-781,-447;-145,-116,-447,452]', + '[787,-20,-232,-250;-20,-50,310,-314;-232,310,-106,422;-250,-314,422,-894]', + '[17,275,-251,-497;275,-581,-179,196;-251,-179,-643,-558;-497,196,-558,-114]', + '[-867,-236,-249,300;-236,318,-308,237;-249,-308,721,-321;300,237,-321,531]', + '[738,575,-59,145;575,721,-480,442;-59,-480,592,170;145,442,170,-757]', + '[201,121,-379,162;121,-469,-132,378;-379,-132,-272,309;162,378,309,-280]', + '[908,109,-209,-921;109,-203,495,371;-209,495,350,240;-921,371,240,-571]', + '[93,29,-738,-360;29,-715,287,-725;-738,287,-523,-109;-360,-725,-109,16]', + '[-97,-86,131,-369;-86,231,-168,30;131,-168,-751,-484;-369,30,-484,-399]', + '[-815,-360,-481,-48;-360,320,326,191;-481,326,555,548;-48,191,548,-707]', + '[96,235,-680,612;235,748,-74,-298;-680,-74,-648,-670;612,-298,-670,622]', + '[-39,-344,297,-252;-344,834,-77,41;297,-77,-60,-279;-252,41,-279,645]', + '[914,196,209,-238;196,-7,44,447;209,44,16,-194;-238,447,-194,-632]', + '[-314,163,756,341;163,982,-61,288;756,-61,706,-76;341,288,-76,-321]', + '[-492,-316,-59,-350;-316,-861,-647,-270;-59,-647,837,-90;-350,-270,-90,-629]', + '[-565,450,97,156;450,984,-271,-315;97,-271,583,-40;156,-315,-40,-110]', + '[-496,-37,98,-453;-37,-152,-81,-349;98,-81,-811,-292;-453,-349,-292,-688]', + '[953,281,-556,904;281,311,-557,-644;-556,-557,845,100;904,-644,100,-359]', + '[-643,497,-310,-229;497,-925,172,255;-310,172,-151,350;-229,255,350,854]', + '[863,150,318,-30;150,-522,-464,-274;318,-464,-942,-256;-30,-274,-256,228]', + '[-211,493,-509,-6;493,215,344,-548;-509,344,227,-727;-6,-548,-727,-682]', + '[-276,-9,204,515;-9,-80,-2,-211;204,-2,-842,43;515,-211,43,543]', + '[-169,669,215,22;669,92,370,18;215,370,684,123;22,18,123,707]', + '[-577,-130,-286,-189;-130,-529,-189,-770;-286,-189,381,-12;-189,-770,-12,-169]', + '[952,-268,40,545;-268,-710,-236,196;40,-236,-559,-115;545,196,-115,571]', + '[418,132,-154,278;132,928,116,-122;-154,116,538,-528;278,-122,-528,37]', + '[782,83,-31,351;83,-662,-39,-609;-31,-39,-414,-249;351,-609,-249,215]', + '[318,532,-172,-248;532,-783,-399,10;-172,-399,-877,823;-248,10,823,-748]', + '[-68,233,-456,-484;233,225,-375,455;-456,-375,-324,188;-484,455,188,-250]', + '[-684,-179,65,466;-179,647,-392,-1;65,-392,-222,292;466,-1,292,-251]', + '[-592,447,-605,51;447,-233,430,67;-605,430,-573,-263;51,67,-263,-506]', + '[-43,308,-326,-746;308,-241,-537,-197;-326,-537,-407,34;-746,-197,34,112]', + '[112,95,137,533;95,317,807,711;137,807,4,26;533,711,26,-792]', + '[755,-108,121,-537;-108,-730,-485,-202;121,-485,753,29;-537,-202,29,965]', + '[-54,235,113,192;235,320,-837,-258;113,-837,398,-498;192,-258,-498,683]', + '[-852,55,-567,102;55,612,-594,460;-567,-594,29,-501;102,460,-501,-213]', + '[4,-100,473,-28;-100,202,64,48;473,64,-593,-616;-28,48,-616,-834]', + '[-692,-666,531,-306;-666,559,49,-619;531,49,-390,-730;-306,-619,-730,324]', + '[-641,-381,108,62;-381,118,-110,-194;108,-110,697,329;62,-194,329,-869]', + '[281,752,-869,350;752,-545,-169,138;-869,-169,782,-376;350,138,-376,97]', + '[-58,647,-85,391;647,-968,459,-166;-85,459,469,323;391,-166,323,-104]', + '[-20,728,757,569;728,531,530,-500;757,530,-47,101;569,-500,101,-500]', + '[-980,413,-81,602;413,647,118,30;-81,118,-787,-709;602,30,-709,582]', + '[518,-59,335,247;-59,-184,460,-518;335,460,510,-216;247,-518,-216,-7]', + '[762,-305,724,-25;-305,-328,805,414;724,805,-942,-83;-25,414,-83,-88]', + '[388,-318,-111,416;-318,146,-678,742;-111,-678,35,543;416,742,543,891]', + '[402,5,-176,845;5,-56,-427,-745;-176,-427,217,196;845,-745,196,363]', + '[981,159,-168,186;159,760,-718,816;-168,-718,356,-245;186,816,-245,244]', + '[495,-302,243,-33;-302,-118,97,-204;243,97,20,192;-33,-204,192,153]', + '[954,-725,339,422;-725,-4,-230,712;339,-230,-57,-11;422,712,-11,-690]', + '[765,-702,29,-644;-702,789,-366,75;29,-366,49,-479;-644,75,-479,575]', + '[-62,381,327,631;381,577,-512,-672;327,-512,146,158;631,-672,158,126]', + '[-947,541,87,-893;541,-495,-41,-665;87,-41,861,60;-893,-665,60,175]', + '[-910,488,-479,-431;488,991,143,229;-479,143,783,-356;-431,229,-356,-333]', + '[846,-356,-144,-336;-356,888,-228,-471;-144,-228,-194,-647;-336,-471,-647,-724]', + '[-10,454,119,65;454,468,-597,260;119,-597,567,-110;65,260,-110,106]'], + [ + '[-564,568,485,513,7;568,-526,612,-346,460;485,612,183,-757,-36;513,-346,-757,-536,505;7,460,-36,' + '505,693]', + '[-379,-94,-635,347,-257;-94,-489,84,-418,229;-635,84,361,-107,-17;347,-418,-107,-48,-715;-257,229,' + '-17,-715,-966]', + '[533,-388,15,340,-489;-388,-366,-37,-836,-93;15,-37,627,328,-271;340,-836,328,-576,-812;-489,-93,' + '-271,-812,-769]', + '[-518,-276,-221,336,787;-276,307,463,342,374;-221,463,-417,499,428;336,342,499,-572,-117;787,374,' + '428,-117,-648]', + '[-63,-268,835,-443,-432;-268,-811,713,-136,-363;835,713,58,151,791;-443,-136,151,-517,-412;-432,' + '-363,791,-412,104]', + '[-95,-786,24,-81,-432;-786,744,139,312,251;24,139,423,298,479;-81,312,298,-672,-239;-432,251,479,' + '-239,9]', + '[888,-546,-211,69,-50;-546,220,59,432,76;-211,59,454,552,432;69,432,552,283,-368;-50,76,432,-368,614]', + '[-164,-64,-626,247,-567;-64,116,-387,584,-334;-626,-387,555,-430,553;247,584,-430,213,-966;-567,' + '-334,553,-966,929]', + '[626,493,-33,391,-355;493,868,-572,193,394;-33,-572,252,-258,-172;391,193,-258,-822,349;-355,394,' + '-172,349,359]', + '[-554,412,-131,31,507;412,794,-428,-31,44;-131,-428,683,-157,330;31,-31,-157,-780,464;507,44,330,' + '464,-750]', + '[45,210,831,-678,-52;210,-539,157,219,-94;831,157,452,698,-380;-678,219,698,-203,-513;-52,-94,-380,' + '-513,-221]', + '[148,-171,-445,202,659;-171,-531,551,-48,-440;-445,551,502,18,-69;202,-48,18,240,-437;659,-440,-69,' + '-437,-778]', + '[-544,-88,-52,-34,-341;-88,238,517,527,306;-52,517,-192,403,79;-34,527,403,210,471;-341,306,79,471,' + '781]', + '[463,-680,-929,668,294;-680,-264,682,-498,864;-929,682,-503,-903,-562;668,-498,-903,438,-217;294,' + '864,-562,-217,-58]', + '[-66,-495,-201,-401,-128;-495,171,570,-139,-745;-201,570,614,-566,356;-401,-139,-566,-818,' + '-797;-128,-745,356,-797,967]', + '[-768,345,73,-335,-489;345,-478,52,211,-100;73,52,94,0,264;-335,211,0,619,-695;-489,-100,264,-695,' + '447]', + '[-239,-24,198,-123,-152;-24,374,-611,-425,-191;198,-611,589,-615,336;-123,-425,-615,26,-782;-152,' + '-191,336,-782,950]', + '[-336,670,8,196,86;670,857,144,-710,-682;8,144,648,-21,854;196,-710,-21,936,923;86,-682,854,923,-368]', + '[-536,235,-207,-112,-499;235,-391,-900,106,189;-207,-900,346,-359,581;-112,106,-359,-461,-341;-499,' + '189,581,-341,269]', + '[-264,431,731,73,-190;431,-513,-131,-101,-23;731,-131,-223,119,245;73,-101,119,-553,511;-190,-23,' + '245,511,530]', + '[943,-212,171,-448,-45;-212,-613,286,-453,-603;171,286,-36,-8,-134;-448,-453,-8,-452,-372;-45,-603,' + '-134,-372,-610]', + '[434,-204,457,47,-340;-204,-163,705,327,49;457,705,-463,-555,-40;47,327,-555,-996,-402;-340,49,-40,' + '-402,421]', + '[202,-242,-953,-143,-284;-242,161,225,-197,-828;-953,225,151,-407,808;-143,-197,-407,535,348;-284,' + '-828,808,348,-688]', + '[-668,725,-427,528,330;725,813,-586,-488,209;-427,-586,951,107,-254;528,-488,107,2,-472;330,209,' + '-254,-472,294]', + '[-839,-247,50,445,-82;-247,114,-527,-150,-201;50,-527,-504,-233,96;445,-150,-233,863,697;-82,-201,' + '96,697,254]', + '[-975,-683,-223,410,591;-683,-56,-133,-592,424;-223,-133,-633,174,-339;410,-592,174,453,-286;591,' + '424,-339,-286,-850]', + '[69,75,609,39,182;75,36,292,587,251;609,292,-678,151,-196;39,587,151,-906,-435;182,251,-196,-435,948]', + '[-102,251,-928,478,-2;251,-622,449,-307,-166;-928,449,-832,512,0;478,-307,512,925,491;-2,-166,0,' + '491,646]', + '[14,768,-575,216,555;768,-196,422,772,-823;-575,422,-373,684,305;216,772,684,904,569;555,-823,305,' + '569,15]', + '[741,-172,99,-82,-553;-172,-787,573,320,225;99,573,-672,-740,569;-82,320,-740,-198,-943;-553,225,' + '569,-943,-413]', + '[-981,21,38,19,43;21,-55,-303,568,243;38,-303,-376,-55,-721;19,568,-55,83,-402;43,243,-721,-402,943]', + '[710,97,-685,411,71;97,-324,773,-582,597;-685,773,-692,393,-204;411,-582,393,410,11;71,597,-204,11,' + '-238]', + '[-765,404,-10,-80,251;404,-195,2,167,304;-10,2,369,328,308;-80,167,328,-859,-281;251,304,308,-281,' + '151]', + '[126,584,513,334,-25;584,-358,-99,27,329;513,-99,793,-106,195;334,27,-106,-532,-18;-25,329,195,-18,' + '617]', + '[732,-546,81,-379,-399;-546,-205,79,19,-73;81,79,987,-435,575;-379,19,-435,999,-90;-399,-73,575,' + '-90,-341]', + '[-373,-891,190,539,327;-891,-997,-89,185,433;190,-89,778,-1,-337;539,185,-1,394,-141;327,433,-337,' + '-141,281]', + '[-624,102,-778,200,-350;102,-748,-333,146,-243;-778,-333,-10,90,145;200,146,90,-728,146;-350,-243,' + '145,146,-166]', + '[-848,-806,255,240,283;-806,373,744,858,404;255,744,-504,55,-867;240,858,55,950,101;283,404,-867,' + '101,427]', + '[302,-557,-629,100,8;-557,-627,502,60,226;-629,502,-812,748,352;100,60,748,658,330;8,226,352,330,' + '-252]', + '[280,575,579,-515,257;575,-355,-201,203,163;579,-201,689,-540,58;-515,203,-540,737,-342;257,163,58,' + '-342,485]', + '[491,353,76,-533,337;353,756,-358,-237,105;76,-358,-301,350,-232;-533,-237,350,905,558;337,105,' + '-232,558,616]', + '[-594,299,-104,-275,37;299,883,503,695,592;-104,503,-275,199,248;-275,695,199,21,-32;37,592,248,' + '-32,692]', + '[-79,448,106,323,-45;448,-967,649,351,400;106,649,-458,-435,275;323,351,-435,-117,-759;-45,400,275,' + '-759,-165]', + '[-740,-85,540,-27,244;-85,-934,472,575,171;540,472,-947,476,550;-27,575,476,-582,566;244,171,550,' + '566,-509]', + '[831,-113,-331,92,-472;-113,89,110,-295,93;-331,110,338,665,-273;92,-295,665,-754,558;-472,93,-273,' + '558,-883]', + '[277,-733,-472,67,638;-733,170,-229,160,-805;-472,-229,510,-61,-135;67,160,-61,-89,-231;638,-805,' + '-135,-231,769]', + '[567,517,-261,-38,357;517,386,2,777,226;-261,2,590,-394,-296;-38,777,-394,188,-236;357,226,-296,' + '-236,209]', + '[-697,-632,494,513,-241;-632,95,-245,487,100;494,-245,-37,0,15;513,487,0,717,-33;-241,100,15,-33,440]', + '[-474,-135,-35,-406,-241;-135,-128,402,-26,-170;-35,402,-933,-41,-138;-406,-26,-41,791,-167;-241,' + '-170,-138,-167,-286]', + '[-854,-121,-48,-570,419;-121,-59,22,-196,368;-48,22,-194,-258,-46;-570,-196,-258,497,6;419,368,-46,' + '6,-124]', + '[-306,470,671,-322,41;470,988,-964,131,193;671,-964,-218,175,378;-322,131,175,470,-50;41,193,378,' + '-50,506]', + '[478,-324,-581,89,540;-324,-885,-57,-600,-464;-581,-57,785,-69,-182;89,-600,-69,-595,157;540,-464,' + '-182,157,-322]', + '[-724,62,466,-176,570;62,-735,181,-420,-19;466,181,53,-293,-14;-176,-420,-293,-990,344;570,-19,-14,' + '344,-771]', + '[-429,13,-134,543,-175;13,-200,-702,291,-202;-134,-702,684,-389,321;543,291,-389,-510,189;-175,' + '-202,321,189,-713]', + '[919,83,-70,309,-566;83,-977,402,-190,-312;-70,402,-829,-533,106;309,-190,-533,-306,-35;-566,-312,' + '106,-35,-599]', + '[-620,-223,29,-150,-213;-223,248,497,-768,-305;29,497,-657,798,0;-150,-768,798,930,30;-213,-305,0,' + '30,-51]', + '[-965,53,-98,155,195;53,-349,634,225,948;-98,634,-847,125,573;155,225,125,33,507;195,948,573,507,' + '-390]', + '[-526,338,50,394,607;338,435,-100,590,403;50,-100,-480,-228,792;394,590,-228,-377,-478;607,403,792,' + '-478,514]', + '[-293,280,-137,60,247;280,-6,116,-506,177;-137,116,-906,764,452;60,-506,764,-420,275;247,177,452,' + '275,294]', + '[307,490,-31,-208,347;490,-456,726,-453,113;-31,726,-892,450,-532;-208,-453,450,-393,-230;347,113,' + '-532,-230,-417]', + '[700,408,-90,-330,249;408,325,-344,-6,64;-90,-344,608,358,-550;-330,-6,358,342,388;249,64,-550,388,' + '628]', + '[-668,-7,558,-90,3;-7,805,67,158,8;558,67,178,-635,401;-90,158,-635,-163,-413;3,8,401,-413,-501]', + '[-940,319,-177,-311,170;319,-588,749,843,403;-177,749,-134,-381,-577;-311,843,-381,-709,-161;170,' + '403,-577,-161,995]', + '[458,-800,-2,-551,-101;-800,-832,477,-256,329;-2,477,384,-263,183;-551,-256,-263,800,-468;-101,329,' + '183,-468,-321]', + '[-198,-129,-271,347,-584;-129,182,36,-962,-226;-271,36,-274,-336,-522;347,-962,-336,456,-115;-584,' + '-226,-522,-115,557]', + '[360,283,902,651,-69;283,-673,-326,-867,39;902,-326,199,130,582;651,-867,130,471,37;-69,39,582,37,' + '796]', + '[-795,-20,-143,-308,554;-20,-521,609,174,563;-143,609,-539,44,159;-308,174,44,122,-707;554,563,159,' + '-707,-584]', + '[-885,550,178,-421,145;550,-413,-180,-757,578;178,-180,-501,208,345;-421,-757,208,-882,136;145,578,' + '345,136,-705]', + '[188,552,-114,248,-867;552,-594,-348,266,-172;-114,-348,-428,604,242;248,266,604,617,-81;-867,-172,' + '242,-81,867]', + '[702,361,239,-502,172;361,-932,-89,-486,-789;239,-89,991,91,349;-502,-486,91,447,280;172,-789,349,' + '280,-236]', + '[-717,-249,-608,-505,97;-249,-222,-65,157,505;-608,-65,-796,697,614;-505,157,697,187,139;97,505,' + '614,139,-747]', + '[829,126,59,-147,-5;126,-239,-261,-327,475;59,-261,-13,-210,-417;-147,-327,-210,594,-249;-5,475,' + '-417,-249,637]', + '[710,116,-118,709,285;116,-847,-351,28,-535;-118,-351,-348,232,-256;709,28,232,479,-382;285,-535,' + '-256,-382,906]', + '[-383,-85,563,-666,563;-85,924,974,356,211;563,974,14,250,-510;-666,356,250,458,166;563,211,-510,' + '166,753]', + '[-968,18,-75,638,-462;18,-37,79,-504,-92;-75,79,-543,72,253;638,-504,72,-896,929;-462,-92,253,929,' + '-319]', + '[614,-856,-127,541,-245;-856,-676,816,-940,-298;-127,816,-220,-522,140;541,-940,-522,878,581;-245,' + '-298,140,581,245]', + '[-85,-34,-122,-478,-115;-34,-759,-367,-193,603;-122,-367,605,276,79;-478,-193,276,798,508;-115,603,' + '79,508,592]', + '[-333,-138,-112,-263,179;-138,817,756,-48,391;-112,756,969,-731,752;-263,-48,-731,156,-321;179,391,' + '752,-321,-712]', + '[477,249,-294,-37,336;249,440,-302,622,-527;-294,-302,-692,-319,-269;-37,622,-319,685,-541;336,' + '-527,-269,-541,-967]', + '[-873,138,-286,-799,317;138,779,-78,13,-300;-286,-78,394,24,61;-799,13,24,-578,-441;317,-300,61,' + '-441,178]', + '[731,432,388,128,763;432,-160,-144,-97,24;388,-144,888,330,135;128,-97,330,-884,-301;763,24,135,' + '-301,-902]', + '[903,29,435,-334,522;29,876,526,26,449;435,526,-16,162,27;-334,26,162,-659,-382;522,449,27,-382,' + '262]', + '[-379,-816,431,-196,-632;-816,-939,-65,-621,111;431,-65,254,247,-416;-196,-621,247,-377,-50;-632,' + '111,-416,-50,493]', + '[-140,-350,-271,364,-657;-350,-321,-101,-87,-648;-271,-101,117,-376,-616;364,-87,-376,-331,26;-657,' + '-648,-616,26,-793]', + '[-846,962,-39,798,-742;962,-844,404,123,562;-39,404,-536,44,-729;798,123,44,-552,71;-742,562,-729,' + '71,-458]', + '[-943,-160,-175,148,-289;-160,625,624,-87,123;-175,624,-198,-23,-459;148,-87,-23,-854,291;-289,123,' + '-459,291,119]', + '[125,24,-75,172,605;24,-192,-385,707,129;-75,-385,-106,-110,-81;172,707,-110,179,239;605,129,-81,' + '239,-216]', + '[329,-86,307,-776,-546;-86,818,256,100,-332;307,256,-805,-398,321;-776,100,-398,-761,-576;-546,' + '-332,321,-576,-2]', + '[934,-696,-129,-171,-99;-696,-882,385,-535,-707;-129,385,488,305,8;-171,-535,305,-27,465;-99,-707,' + '8,465,-329]', + '[-279,11,260,-35,-333;11,175,-854,-246,-126;260,-854,-31,487,43;-35,-246,487,-775,195;-333,-126,43,' + '195,-956]', + '[-999,613,-166,-58,808;613,-518,-574,-664,416;-166,-574,-387,313,95;-58,-664,313,872,-34;808,416,' + '95,-34,851]', + '[-746,-456,-738,326,418;-456,418,848,62,483;-738,848,-980,104,-547;326,62,104,118,-18;418,483,-547,' + '-18,301]', + '[268,-302,-195,725,103;-302,-931,-885,812,-278;-195,-885,-3,-572,-280;725,812,-572,719,867;103,' + '-278,-280,867,551]', + '[544,230,-284,344,-698;230,-593,-370,-322,576;-284,-370,-979,-118,-9;344,-322,-118,942,714;-698,' + '576,-9,714,-851]', + '[301,-368,-694,45,212;-368,388,110,-530,-364;-694,110,271,-9,418;45,-530,-9,-838,-239;212,-364,418,' + '-239,-448]', + '[-243,224,27,249,337;224,317,-432,-383,133;27,-432,-681,779,-89;249,-383,779,844,405;337,133,-89,' + '405,138]', + '[481,61,-452,385,-156;61,-549,-691,-389,-36;-452,-691,597,345,-685;385,-389,345,-748,598;-156,-36,' + '-685,598,-745]', + '[-586,846,126,-357,704;846,-840,746,-6,203;126,746,673,-556,-262;-357,-6,-556,556,-206;704,203,' + '-262,-206,663]', + '[796,-218,-314,-352,214;-218,-973,649,-525,410;-314,649,-108,-642,-177;-352,-525,-642,139,-568;214,' + '410,-177,-568,-655]', + '[540,393,834,299,-166;393,153,35,109,150;834,35,-660,-529,569;299,109,-529,695,558;-166,150,569,' + '558,989]'], + [ + '[250,623,394,139,394,-485;623,950,605,-643,19,-311;394,605,-188,799,386,-600;139,-643,799,248,659,' + '-616;394,19,386,659,236,-145;-485,-311,-600,-616,-145,-743]', + '[899,543,-487,324,-284,-752;543,-305,-138,-108,-66,-360;-487,-138,-936,121,573,506;324,-108,121,' + '164,-5,-438;-284,-66,573,-5,-878,151;-752,-360,506,-438,151,-891]', + '[-349,136,-393,659,-232,488;136,42,806,279,327,313;-393,806,687,588,-121,223;659,279,588,109,-205,' + '714;-232,327,-121,-205,684,-747;488,313,223,714,-747,192]', + '[932,463,-748,68,-150,-264;463,-444,384,866,726,125;-748,384,-31,-160,804,179;68,866,-160,-498,159,' + '-183;-150,726,804,159,794,463;-264,125,179,-183,463,-507]', + '[519,132,272,-150,56,-96;132,451,38,560,-365,190;272,38,-686,135,-238,-510;-150,560,135,353,-129,' + '240;56,-365,-238,-129,571,-256;-96,190,-510,240,-256,-627]', + '[-694,137,-268,131,-429,-201;137,-130,-69,-39,-130,336;-268,-69,622,-515,174,453;131,-39,-515,-333,' + '165,-316;-429,-130,174,165,853,836;-201,336,453,-316,836,-31]', + '[920,-703,166,174,-451,124;-703,-651,56,297,-34,-24;166,56,530,148,14,516;174,297,148,503,317,' + '82;-451,-34,14,317,934,350;124,-24,516,82,350,-921]', + '[284,333,-642,510,563,441;333,909,442,561,-372,-319;-642,442,72,684,46,-802;510,561,684,-936,-48,' + '285;563,-372,46,-48,546,221;441,-319,-802,285,221,-149]', + '[556,-200,75,-156,529,264;-200,-689,-314,98,-144,-60;75,-314,110,-517,-399,81;-156,98,-517,768,471,' + '706;529,-144,-399,471,-607,134;264,-60,81,706,134,-336]', + '[-31,76,-13,412,-442,-71;76,-179,-306,469,-82,-107;-13,-306,-505,162,71,253;412,469,162,-376,190,' + '231;-442,-82,71,190,-374,-517;-71,-107,253,231,-517,467]', + '[-52,334,-360,-86,-466,80;334,478,43,-203,500,-33;-360,43,294,417,-590,-507;-86,-203,417,305,772,' + '480;-466,500,-590,772,-476,180;80,-33,-507,480,180,-603]', + '[-534,-134,-366,388,-656,-393;-134,-847,565,-148,372,137;-366,565,-550,-68,-262,-716;388,-148,-68,' + '-832,254,162;-656,372,-262,254,-795,47;-393,137,-716,162,47,870]', + '[-49,385,306,-659,479,-423;385,811,-288,5,608,-839;306,-288,-851,-383,-206,117;-659,5,-383,-936,' + '408,569;479,608,-206,408,-438,-203;-423,-839,117,569,-203,-584]', + '[138,-137,32,189,-635,168;-137,-782,19,-224,-133,-523;32,19,726,-57,271,-138;189,-224,-57,-884,' + '-565,-630;-635,-133,271,-565,-305,529;168,-523,-138,-630,529,390]', + '[-875,-791,-144,511,108,-164;-791,-59,-596,6,-520,534;-144,-596,-721,355,201,-129;511,6,355,738,' + '-58,-318;108,-520,201,-58,-41,436;-164,534,-129,-318,436,-743]', + '[457,540,-477,847,412,-89;540,-196,305,841,20,176;-477,305,293,-290,-627,-747;847,841,-290,-962,' + '-147,33;412,20,-627,-147,-651,824;-89,176,-747,33,824,-472]', + '[440,36,42,-257,307,556;36,112,-417,496,-199,298;42,-417,-624,417,395,195;-257,496,417,291,407,' + '142;307,-199,395,407,-724,-167;556,298,195,142,-167,486]', + '[-56,311,800,-536,-91,451;311,724,-120,403,159,339;800,-120,-169,-600,304,-562;-536,403,-600,-444,' + '-404,-475;-91,159,304,-404,886,163;451,339,-562,-475,163,701]', + '[831,-9,-193,250,-259,-177;-9,-279,-447,671,-344,243;-193,-447,119,250,-220,-13;250,671,250,-404,' + '359,-171;-259,-344,-220,359,-77,-141;-177,243,-13,-171,-141,-71]', + '[-290,-385,-7,232,300,-595;-385,715,544,-108,-746,-590;-7,544,365,-105,-187,-159;232,-108,-105,' + '-923,582,334;300,-746,-187,582,-281,651;-595,-590,-159,334,651,322]', + '[-907,229,-390,78,347,-413;229,945,-480,151,-738,711;-390,-480,-89,-188,-693,6;78,151,-188,656,' + '-586,443;347,-738,-693,-586,-751,-396;-413,711,6,443,-396,-17]', + '[-915,-17,591,161,16,-448;-17,177,300,723,326,0;591,300,489,-680,-591,279;161,723,-680,-119,-371,' + '-937;16,326,-591,-371,-724,-244;-448,0,279,-937,-244,-270]', + '[-376,-205,333,-491,171,364;-205,968,120,251,-80,-334;333,120,-33,-346,-517,-757;-491,251,-346,-74,' + '-261,618;171,-80,-517,-261,-537,169;364,-334,-757,618,169,-464]', + '[-158,-435,-280,29,549,-51;-435,-742,427,308,817,-432;-280,427,-317,544,472,-361;29,308,544,-951,' + '256,35;549,817,472,256,907,284;-51,-432,-361,35,284,460]', + '[-497,-300,-715,433,44,-341;-300,296,-76,-900,-319,-644;-715,-76,239,710,-30,-232;433,-900,710,' + '-780,25,-612;44,-319,-30,25,-91,677;-341,-644,-232,-612,677,963]', + '[-483,-373,254,58,112,-472;-373,781,-720,645,432,442;254,-720,227,145,719,-242;58,645,145,-265,' + '-308,-19;112,432,719,-308,-110,305;-472,442,-242,-19,305,-641]', + '[426,717,-190,194,600,-397;717,-324,392,98,238,68;-190,392,-313,316,-723,535;194,98,316,721,419,' + '483;600,238,-723,419,-820,9;-397,68,535,483,9,737]', + '[-682,519,-724,-204,-606,-348;519,-484,299,23,-49,-319;-724,299,-794,342,-498,36;-204,23,342,276,' + '611,332;-606,-49,-498,611,-962,-432;-348,-319,36,332,-432,-955]', + '[971,-610,-29,-607,146,-692;-610,-906,-177,217,536,-522;-29,-177,398,-61,49,-333;-607,217,-61,-421,' + '-69,-21;146,536,49,-69,578,754;-692,-522,-333,-21,754,-889]', + '[137,612,379,731,-89,149;612,-706,-257,-698,507,290;379,-257,110,407,455,260;731,-698,407,659,82,' + '-404;-89,507,455,82,-618,-136;149,290,260,-404,-136,-790]', + '[714,-226,-159,177,-129,450;-226,381,-254,-349,-409,95;-159,-254,-961,129,446,-302;177,-349,129,' + '-396,-198,-214;-129,-409,446,-198,415,-123;450,95,-302,-214,-123,415]', + '[141,699,-683,-890,449,-692;699,-533,-356,293,-166,268;-683,-356,-473,32,-16,151;-890,293,32,-183,' + '240,335;449,-166,-16,240,-534,-122;-692,268,151,335,-122,266]', + '[-307,377,889,-520,-105,-446;377,900,305,302,43,297;889,305,-834,187,-880,294;-520,302,187,-446,' + '-649,-515;-105,43,-880,-649,662,-387;-446,297,294,-515,-387,-570]', + '[-526,-630,488,-512,101,-657;-630,212,-529,-261,-16,7;488,-529,429,172,105,-875;-512,-261,172,-720,' + '172,230;101,-16,105,172,724,-11;-657,7,-875,230,-11,833]', + '[704,840,-58,-261,667,-482;840,-160,90,-382,-89,462;-58,90,-133,59,281,-62;-261,-382,59,-485,784,' + '4;667,-89,281,784,-563,67;-482,462,-62,4,67,-634]', + '[-462,-146,772,494,397,834;-146,174,23,377,15,528;772,23,-445,-144,116,-225;494,377,-144,660,-471,' + '-251;397,15,116,-471,455,-443;834,528,-225,-251,-443,580]', + '[-48,-185,267,-414,206,-165;-185,592,-46,269,84,-306;267,-46,251,-64,-640,82;-414,269,-64,878,-529,' + '-361;206,84,-640,-529,840,48;-165,-306,82,-361,48,929]', + '[376,830,212,-693,32,-372;830,-39,37,-397,140,74;212,37,384,-533,621,577;-693,-397,-533,492,348,' + '-103;32,140,621,348,-107,169;-372,74,577,-103,169,-106]', + '[-460,583,225,-2,687,55;583,724,294,-832,17,-361;225,294,-714,86,-234,272;-2,-832,86,-598,199,' + '-81;687,17,-234,199,-370,-394;55,-361,272,-81,-394,-16]', + '[-352,-297,28,362,-321,-290;-297,972,10,227,-145,526;28,10,-794,-10,397,305;362,227,-10,-94,-400,' + '-430;-321,-145,397,-400,869,352;-290,526,305,-430,352,-93]', + '[-699,-128,29,418,-137,946;-128,-946,293,336,152,-100;29,293,473,-603,233,-260;418,336,-603,883,' + '882,-183;-137,152,233,882,248,-197;946,-100,-260,-183,-197,-688]', + '[696,-143,489,-228,405,549;-143,-919,749,-176,-471,-816;489,749,-221,-272,598,671;-228,-176,-272,' + '652,-51,-6;405,-471,598,-51,563,-734;549,-816,671,-6,-734,360]', + '[-521,405,92,352,-158,-111;405,-696,-361,115,-444,-459;92,-361,871,142,267,-36;352,115,142,905,253,' + '-199;-158,-444,267,253,-320,189;-111,-459,-36,-199,189,-46]', + '[-790,367,117,-43,175,409;367,654,131,-823,-37,377;117,131,89,-14,-185,-317;-43,-823,-14,963,241,' + '767;175,-37,-185,241,-141,-149;409,377,-317,767,-149,811]', + '[-250,666,475,-73,701,-21;666,-136,214,213,-718,185;475,214,-42,456,177,-302;-73,213,456,191,15,' + '231;701,-718,177,15,-331,-490;-21,185,-302,231,-490,-339]', + '[-20,-312,-255,12,-45,123;-312,415,-415,311,-577,424;-255,-415,700,229,-535,222;12,311,229,763,' + '-800,986;-45,-577,-535,-800,784,-45;123,424,222,986,-45,689]', + '[85,-623,-81,-82,440,358;-623,-864,244,108,-61,210;-81,244,-158,46,215,-33;-82,108,46,-955,-36,' + '-402;440,-61,215,-36,-236,-879;358,210,-33,-402,-879,-70]', + '[-750,-192,-92,279,-99,-155;-192,658,-202,628,-366,-563;-92,-202,194,203,38,335;279,628,203,-276,' + '-149,-27;-99,-366,38,-149,550,-79;-155,-563,335,-27,-79,-310]', + '[959,206,-23,-249,793,256;206,-19,-578,284,-8,539;-23,-578,318,-396,292,538;-249,284,-396,394,581,' + '112;793,-8,292,581,721,-371;256,539,538,112,-371,-869]', + '[157,372,-914,641,146,-734;372,-704,130,631,250,466;-914,130,-789,526,675,-252;641,631,526,-341,' + '155,93;146,250,675,155,-321,-845;-734,466,-252,93,-845,18]', + '[408,179,-258,-35,370,-745;179,753,-494,-183,-725,512;-258,-494,255,447,-200,-648;-35,-183,447,912,' + '596,125;370,-725,-200,596,-262,250;-745,512,-648,125,250,-767]', + '[770,-730,289,36,-314,-199;-730,259,-746,740,286,-508;289,-746,580,251,-401,103;36,740,251,764,372,' + '167;-314,286,-401,372,-269,-853;-199,-508,103,167,-853,-34]', + '[-579,325,661,-348,645,-729;325,433,871,801,221,-631;661,871,846,-124,27,433;-348,801,-124,-251,' + '-990,-97;645,221,27,-990,-957,-618;-729,-631,433,-97,-618,-373]', + '[221,204,482,-309,-150,-760;204,-265,-487,-295,26,-244;482,-487,-961,-108,-113,405;-309,-295,-108,' + '-800,-369,-21;-150,26,-113,-369,122,475;-760,-244,405,-21,475,347]', + '[-820,32,-50,356,-705,-243;32,-651,543,121,-684,-186;-50,543,186,-247,656,-244;356,121,-247,350,' + '100,247;-705,-684,656,100,-680,906;-243,-186,-244,247,906,-469]', + '[431,-287,357,-430,-130,373;-287,-248,500,113,895,-59;357,500,60,-576,82,192;-430,113,-576,-478,' + '-772,369;-130,895,82,-772,-462,268;373,-59,192,369,268,-734]', + '[-352,-378,98,-49,374,623;-378,-999,197,68,266,180;98,197,701,-208,-129,-412;-49,68,-208,863,-117,' + '442;374,266,-129,-117,-518,694;623,180,-412,442,694,501]', + '[924,168,-46,550,41,84;168,608,-653,-514,-201,693;-46,-653,-744,751,158,-75;550,-514,751,-549,143,' + '-563;41,-201,158,143,-564,-356;84,693,-75,-563,-356,731]', + '[993,644,-32,-19,-163,372;644,467,-377,297,387,-321;-32,-377,920,76,-455,808;-19,297,76,649,-450,' + '71;-163,387,-455,-450,284,-158;372,-321,808,71,-158,529]', + '[246,248,608,-198,-18,405;248,-359,243,479,-563,-14;608,243,-109,140,314,98;-198,479,140,488,264,' + '321;-18,-563,314,264,-853,-387;405,-14,98,321,-387,616]', + '[-637,-606,-12,-32,902,-41;-606,912,162,-371,-284,-739;-12,162,-909,-711,34,-326;-32,-371,-711,379,' + '-626,151;902,-284,34,-626,-716,125;-41,-739,-326,151,125,-764]', + '[-538,-632,-235,904,480,53;-632,-156,-336,-342,82,-172;-235,-336,-24,123,129,-444;904,-342,123,' + '-125,-151,83;480,82,129,-151,70,-48;53,-172,-444,83,-48,-537]', + '[497,-860,-57,197,-237,-131;-860,-312,-391,202,329,550;-57,-391,139,165,49,578;197,202,165,-771,' + '580,131;-237,329,49,580,643,164;-131,550,578,131,164,-341]', + '[-735,583,120,164,-565,-76;583,-174,-174,389,-674,-180;120,-174,464,375,-454,-451;164,389,375,-605,' + '-317,-821;-565,-674,-454,-317,456,-456;-76,-180,-451,-821,-456,-373]', + '[687,580,851,459,139,-93;580,-476,-912,455,-605,381;851,-912,-532,663,140,-736;459,455,663,665,' + '-312,223;139,-605,140,-312,-724,-185;-93,381,-736,223,-185,132]', + '[160,-532,608,-331,-600,60;-532,613,853,310,296,44;608,853,35,54,212,-7;-331,310,54,519,480,' + '33;-600,296,212,480,293,689;60,44,-7,33,689,266]', + '[579,4,-562,-731,175,-782;4,318,392,468,-568,-563;-562,392,-891,348,256,7;-731,468,348,327,-178,' + '-422;175,-568,256,-178,837,-723;-782,-563,7,-422,-723,-238]', + '[-739,453,742,543,-791,-417;453,793,169,-102,-156,-188;742,169,-17,108,-351,-553;543,-102,108,-599,' + '-18,195;-791,-156,-351,-18,-223,-114;-417,-188,-553,195,-114,-322]', + '[-678,-308,-290,52,175,14;-308,-988,-705,135,-705,-532;-290,-705,-291,-494,-87,-725;52,135,-494,' + '-500,-506,-189;175,-705,-87,-506,-943,-583;14,-532,-725,-189,-583,995]', + '[-837,134,-213,-67,200,104;134,-490,-400,635,199,-255;-213,-400,682,59,-221,322;-67,635,59,-797,' + '284,-399;200,199,-221,284,881,577;104,-255,322,-399,577,477]', + '[555,14,-887,-202,695,528;14,-927,330,-314,375,-391;-887,330,-134,464,446,346;-202,-314,464,-313,' + '345,363;695,375,446,345,-79,-184;528,-391,346,363,-184,780]', + '[422,58,282,210,-461,94;58,796,706,258,588,-301;282,706,-838,-252,291,-204;210,258,-252,-718,-112,' + '414;-461,588,291,-112,-480,-630;94,-301,-204,414,-630,-889]', + '[-256,759,-214,685,465,-315;759,-944,538,57,-482,299;-214,538,307,640,-137,403;685,57,640,-235,367,' + '213;465,-482,-137,367,188,33;-315,299,403,213,33,-175]', + '[-880,-536,-590,-111,127,-279;-536,749,-180,-387,331,44;-590,-180,-735,-445,347,-44;-111,-387,-445,' + '704,-43,-22;127,331,347,-43,-197,215;-279,44,-44,-22,215,-766]', + '[356,180,416,168,658,-14;180,-229,-316,-408,-834,-724;416,-316,408,-197,-218,-406;168,-408,-197,' + '-754,88,429;658,-834,-218,88,-244,587;-14,-724,-406,429,587,-556]', + '[-968,504,-302,-234,-393,667;504,-948,-680,598,-100,770;-302,-680,-94,-419,135,-350;-234,598,-419,' + '-386,303,350;-393,-100,135,303,-116,69;667,770,-350,350,69,411]', + '[385,259,177,46,13,120;259,-467,445,-398,210,189;177,445,560,58,-26,560;46,-398,58,-874,224,63;13,' + '210,-26,224,-628,156;120,189,560,63,156,-497]', + '[-124,429,577,-223,-36,405;429,343,-398,-302,448,-48;577,-398,920,304,768,570;-223,-302,304,-55,' + '-415,-71;-36,448,768,-415,906,-490;405,-48,570,-71,-490,-330]', + '[714,684,-730,-19,290,-210;684,-984,59,256,72,280;-730,59,-122,46,-7,936;-19,256,46,-177,-697,' + '-104;290,72,-7,-697,-812,502;-210,280,936,-104,502,956]', + '[-835,240,277,73,220,448;240,921,286,617,309,52;277,286,3,202,21,42;73,617,202,966,233,-318;220,' + '309,21,233,540,-165;448,52,42,-318,-165,-601]', + '[826,58,-448,7,570,254;58,-803,-45,327,496,-321;-448,-45,753,861,396,313;7,327,861,-277,-240,' + '-484;570,496,396,-240,-350,605;254,-321,313,-484,605,477]', + '[-847,-687,565,-182,719,62;-687,299,138,-496,-38,-438;565,138,256,-156,416,41;-182,-496,-156,-816,' + '580,-533;719,-38,416,580,610,118;62,-438,41,-533,118,-910]', + '[-646,-187,760,489,-95,91;-187,-112,-162,-729,-435,-220;760,-162,-249,197,65,180;489,-729,197,-196,' + '-9,250;-95,-435,65,-9,245,520;91,-220,180,250,520,682]', + '[368,-508,-170,198,508,-43;-508,-900,203,-730,-33,-499;-170,203,-192,-47,151,-75;198,-730,-47,82,' + '-271,-61;508,-33,151,-271,324,737;-43,-499,-75,-61,737,417]', + '[982,350,-168,63,808,-314;350,372,-245,-844,427,-780;-168,-245,350,195,122,322;63,-844,195,-138,' + '-112,434;808,427,122,-112,-418,460;-314,-780,322,434,460,-548]', + '[-754,146,14,154,313,436;146,798,668,499,-626,241;14,668,-954,-68,372,386;154,499,-68,-798,619,' + '-444;313,-626,372,619,588,-121;436,241,386,-444,-121,-831]', + '[-822,-100,-182,39,-913,-73;-100,-374,-379,-64,254,-58;-182,-379,-974,-473,-71,-805;39,-64,-473,' + '-169,335,-471;-913,254,-71,335,320,-419;-73,-58,-805,-471,-419,-161]', + '[-649,-296,877,-659,-394,522;-296,804,-65,456,87,-811;877,-65,931,365,284,113;-659,456,365,73,-174,' + '184;-394,87,284,-174,920,498;522,-811,113,184,498,-483]', + '[288,-408,-114,771,519,-372;-408,-362,-282,565,-94,-137;-114,-282,180,-813,-311,-227;771,565,-813,' + '-306,175,-422;519,-94,-311,175,438,5;-372,-137,-227,-422,5,76]', + '[-298,145,-880,-215,268,-450;145,390,415,-316,-284,-189;-880,415,-89,-21,615,-306;-215,-316,-21,' + '486,576,-214;268,-284,615,576,456,258;-450,-189,-306,-214,258,132]', + '[453,260,-81,-494,-121,164;260,-679,662,-549,-175,625;-81,662,-590,-494,144,349;-494,-549,-494,' + '-510,144,-489;-121,-175,144,144,355,546;164,625,349,-489,546,-822]', + '[-326,-26,-165,-218,342,-278;-26,961,-454,-298,-621,-509;-165,-454,927,-413,-84,-789;-218,-298,' + '-413,603,478,709;342,-621,-84,478,549,-67;-278,-509,-789,709,-67,-356]', + '[888,443,211,186,-204,-166;443,518,339,768,635,-52;211,339,626,-115,854,-179;186,768,-115,910,278,' + '-208;-204,635,854,278,-616,663;-166,-52,-179,-208,663,-371]', + '[13,149,-183,503,388,145;149,174,-481,287,-14,744;-183,-481,11,487,209,73;503,287,487,421,469,' + '-933;388,-14,209,469,463,-219;145,744,73,-933,-219,945]', + '[996,129,-245,-267,-30,-569;129,-399,-692,96,-24,70;-245,-692,508,-256,-412,-59;-267,96,-256,-3,' + '286,-96;-30,-24,-412,286,-964,131;-569,70,-59,-96,131,677]', + '[-568,492,-797,-185,-77,-181;492,-608,237,-143,488,270;-797,237,-19,834,473,-442;-185,-143,834,74,' + '-505,714;-77,488,473,-505,-343,-615;-181,270,-442,714,-615,-168]', + '[825,-302,-377,296,221,542;-302,166,174,-89,44,-213;-377,174,-190,195,-711,26;296,-89,195,425,388,' + '190;221,44,-711,388,669,-69;542,-213,26,190,-69,-292]', + '[302,-942,-32,-165,458,115;-942,-9,-21,447,-412,346;-32,-21,728,-513,-514,-422;-165,447,-513,477,' + '390,315;458,-412,-514,390,173,-532;115,346,-422,315,-532,-499]', + '[370,599,-62,-34,-115,57;599,319,433,423,358,-417;-62,433,-994,-74,147,-352;-34,423,-74,886,128,' + '-472;-115,358,147,128,976,-150;57,-417,-352,-472,-150,-775]', + '[946,-23,-247,-316,628,-800;-23,4,290,-227,-567,-930;-247,290,-403,-185,-505,162;-316,-227,-185,' + '-181,485,2;628,-567,-505,485,603,-833;-800,-930,162,2,-833,382]'], + [ + '[-657,218,-1,-499,774,297,-562;218,670,298,71,678,450,417;-1,298,-906,345,-505,-13,146;-499,71,345,' + '-163,-45,-350,-9;774,678,-505,-45,464,68,-744;297,450,-13,-350,68,883,-33;-562,417,146,-9,-744,-33,' + '-653]', + '[-651,277,-344,-557,-100,-5,30;277,173,742,649,426,637,138;-344,742,349,-680,182,-76,-124;-557,649,' + '-680,727,235,513,882;-100,426,182,235,252,-194,-8;-5,637,-76,513,-194,-40,-555;30,138,-124,882,-8,' + '-555,984]', + '[-278,169,-928,416,-189,-786,198;169,-688,123,604,-852,-286,421;-928,123,495,-55,-54,172,149;416,' + '604,-55,156,-103,-362,215;-189,-852,-54,-103,-976,80,67;-786,-286,172,-362,80,-328,445;198,421,149,' + '215,67,445,517]', + '[753,310,-161,167,18,192,-314;310,-549,163,639,67,-150,664;-161,163,871,155,248,-423,194;167,639,' + '155,589,-765,-850,-131;18,67,248,-765,-223,-49,-580;192,-150,-423,-850,-49,-803,440;-314,664,194,' + '-131,-580,440,-791]', + '[-898,-426,-688,-411,-129,-434,-26;-426,287,-618,-166,355,-45,-437;-688,-618,-43,-143,394,-406,' + '-272;-411,-166,-143,-714,548,-679,-178;-129,355,394,548,792,348,291;-434,-45,-406,-679,348,338,' + '-506;-26,-437,-272,-178,291,-506,-872]', + '[-669,-536,-125,567,-808,511,-118;-536,197,84,-11,-443,627,-430;-125,84,286,499,-314,9,-34;567,-11,' + '499,-476,11,-699,-53;-808,-443,-314,11,935,18,261;511,627,9,-699,18,634,11;-118,-430,-34,-53,261,' + '11,-169]', + '[-379,96,11,-80,-343,-385,-744;96,681,62,-343,-10,-240,-9;11,62,-642,-767,183,-421,-800;-80,-343,' + '-767,-259,73,-665,-382;-343,-10,183,73,761,-111,-300;-385,-240,-421,-665,-111,195,-170;-744,-9,' + '-800,-382,-300,-170,662]', + '[876,196,80,-115,-372,220,206;196,343,477,60,-128,751,-298;80,477,256,433,496,-477,143;-115,60,433,' + '522,345,-800,338;-372,-128,496,345,-362,86,575;220,751,-477,-800,86,697,123;206,-298,143,338,575,' + '123,-616]', + '[-205,-318,175,-27,-488,270,-295;-318,-753,-278,-529,199,-352,787;175,-278,-968,-412,450,198,' + '602;-27,-529,-412,778,285,-105,941;-488,199,450,285,455,-842,-66;270,-352,198,-105,-842,380,' + '-103;-295,787,602,941,-66,-103,-790]', + '[-462,-521,403,76,-219,-161,-546;-521,-472,179,-303,552,606,-494;403,179,-991,-245,514,337,133;76,' + '-303,-245,-514,87,-233,31;-219,552,514,87,561,151,462;-161,606,337,-233,151,-74,16;-546,-494,133,' + '31,462,16,-631]', + '[505,53,-114,-406,664,319,-243;53,-983,-393,166,-180,-68,-172;-114,-393,-995,-463,-266,127,' + '-821;-406,166,-463,262,13,36,150;664,-180,-266,13,423,42,-635;319,-68,127,36,42,968,480;-243,-172,' + '-821,150,-635,480,-782]', + '[302,-223,276,-96,85,-138,-263;-223,-793,-501,-293,422,529,382;276,-501,-943,207,514,-70,771;-96,' + '-293,207,586,11,338,756;85,422,514,11,120,-390,411;-138,529,-70,338,-390,-419,302;-263,382,771,756,' + '411,302,481]', + '[335,-465,13,-133,-195,16,593;-465,-737,108,-543,-28,-65,-2;13,108,-416,881,-60,863,225;-133,-543,' + '881,-122,-191,-803,463;-195,-28,-60,-191,69,190,312;16,-65,863,-803,190,-573,-331;593,-2,225,463,' + '312,-331,561]', + '[557,-886,-442,139,-237,575,-334;-886,-165,-99,-578,-587,250,123;-442,-99,20,-206,398,-509,' + '-613;139,-578,-206,696,-250,476,52;-237,-587,398,-250,543,-176,742;575,250,-509,476,-176,-668,' + '162;-334,123,-613,52,742,162,-72]', + '[-256,738,-236,-81,521,512,-67;738,300,67,62,-520,34,235;-236,67,780,-469,140,-228,-247;-81,62,' + '-469,-822,502,649,-368;521,-520,140,502,333,-809,84;512,34,-228,649,-809,-75,657;-67,235,-247,-368,' + '84,657,483]', + '[254,-269,69,341,-754,473,147;-269,660,-699,-134,-24,-67,-45;69,-699,35,-307,-16,-47,-528;341,-134,' + '-307,438,342,-610,-74;-754,-24,-16,342,526,-721,646;473,-67,-47,-610,-721,-454,127;147,-45,-528,' + '-74,646,127,-659]', + '[-407,581,-416,67,66,-379,187;581,633,417,225,-352,62,-64;-416,417,85,-214,722,488,518;67,225,-214,' + '-15,95,265,-36;66,-352,722,95,709,98,-614;-379,62,488,265,98,977,-111;187,-64,518,-36,-614,-111,' + '-144]', + '[168,-149,226,-257,-324,-242,256;-149,-395,-559,7,-415,305,667;226,-559,-737,263,-112,-876,' + '431;-257,7,263,-693,-145,436,617;-324,-415,-112,-145,-8,848,-685;-242,305,-876,436,848,-331,' + '-33;256,667,431,617,-685,-33,781]', + '[-493,150,-108,-195,-30,-562,-557;150,-58,-320,79,-129,-456,191;-108,-320,82,441,-625,151,' + '-112;-195,79,441,625,505,134,188;-30,-129,-625,505,113,788,-446;-562,-456,151,134,788,931,52;-557,' + '191,-112,188,-446,52,-693]', + '[-257,20,262,-274,5,446,-284;20,734,-134,-390,-164,378,335;262,-134,990,643,-3,411,-69;-274,-390,' + '643,398,612,218,-65;5,-164,-3,612,443,634,-337;446,378,411,218,634,200,-841;-284,335,-69,-65,-337,' + '-841,340]', + '[-414,-84,167,142,7,298,-197;-84,-576,795,356,596,289,368;167,795,-594,250,428,-7,44;142,356,250,' + '-481,-357,527,-336;7,596,428,-357,-906,-321,140;298,289,-7,527,-321,804,408;-197,368,44,-336,140,' + '408,668]', + '[35,557,-451,383,189,-443,-533;557,832,995,177,-357,273,139;-451,995,-184,442,40,-357,348;383,177,' + '442,226,-487,-215,-284;189,-357,40,-487,398,-83,151;-443,273,-357,-215,-83,-241,-542;-533,139,348,' + '-284,151,-542,831]', + '[956,-222,-121,-224,-8,-422,-439;-222,965,799,-60,127,808,-458;-121,799,548,-769,25,-235,42;-224,' + '-60,-769,-396,350,-309,433;-8,127,25,350,879,276,339;-422,808,-235,-309,276,-39,-29;-439,-458,42,' + '433,339,-29,-717]', + '[-747,583,508,-311,-22,-100,-176;583,558,777,487,25,626,-218;508,777,446,33,-254,-526,-197;-311,' + '487,33,-865,942,-591,-153;-22,25,-254,942,-566,-310,192;-100,626,-526,-591,-310,750,59;-176,-218,' + '-197,-153,192,59,-920]', + '[667,-531,-248,620,-72,-156,-279;-531,665,-153,-237,-231,91,265;-248,-153,-1,306,-352,-492,202;620,' + '-237,306,-891,-340,1,618;-72,-231,-352,-340,779,68,764;-156,91,-492,1,68,137,33;-279,265,202,618,' + '764,33,653]', + '[386,163,-387,-254,-208,-40,737;163,-296,-546,225,-17,99,-15;-387,-546,571,-72,-895,-100,291;-254,' + '225,-72,-195,-222,478,-592;-208,-17,-895,-222,318,-708,-336;-40,99,-100,478,-708,-883,-148;737,-15,' + '291,-592,-336,-148,-698]', + '[431,-211,-112,160,-3,841,366;-211,198,79,-453,-183,223,183;-112,79,243,-204,480,168,-648;160,-453,' + '-204,169,-80,-52,-341;-3,-183,480,-80,-577,274,55;841,223,168,-52,274,-702,-478;366,183,-648,-341,' + '55,-478,928]', + '[431,21,-4,646,197,366,-363;21,48,904,207,-20,476,597;-4,904,-660,754,211,347,407;646,207,754,-647,' + '-10,-39,387;197,-20,211,-10,726,-372,2;366,476,347,-39,-372,-308,274;-363,597,407,387,2,274,77]', + '[709,192,222,174,-105,-173,364;192,-471,-174,-116,-107,338,-4;222,-174,-911,256,118,-443,412;174,' + '-116,256,781,249,-525,-98;-105,-107,118,249,-658,-81,-154;-173,338,-443,-525,-81,854,719;364,-4,' + '412,-98,-154,719,739]', + '[708,-639,135,400,-524,462,384;-639,-711,90,-302,-496,858,-220;135,90,929,324,212,876,-833;400,' + '-302,324,525,335,-20,-493;-524,-496,212,335,67,491,399;462,858,876,-20,491,640,249;384,-220,-833,' + '-493,399,249,421]', + '[-365,216,-176,275,9,-248,-76;216,459,-334,167,121,427,255;-176,-334,-151,146,-879,-846,-181;275,' + '167,146,-387,-162,149,24;9,121,-879,-162,402,768,560;-248,427,-846,149,768,-290,-195;-76,255,-181,' + '24,560,-195,-123]', + '[-225,283,143,-512,790,-529,-203;283,-405,91,328,236,451,-197;143,91,707,294,-156,-39,413;-512,328,' + '294,-517,641,-27,630;790,236,-156,641,892,474,-414;-529,451,-39,-27,474,494,728;-203,-197,413,630,' + '-414,728,445]', + '[293,247,547,-187,-63,-225,-510;247,525,-182,861,-350,482,515;547,-182,-140,-139,-91,-749,303;-187,' + '861,-139,-856,-402,-307,-198;-63,-350,-91,-402,-432,-406,-440;-225,482,-749,-307,-406,665,' + '-243;-510,515,303,-198,-440,-243,313]', + '[431,282,150,482,-570,-252,294;282,224,240,90,-700,-554,-81;150,240,-516,-74,62,373,328;482,90,-74,' + '-313,189,-54,-730;-570,-700,62,189,402,-26,-282;-252,-554,373,-54,-26,-709,-683;294,-81,328,-730,' + '-282,-683,110]', + '[-174,143,517,614,-145,-362,-519;143,741,383,-381,22,-514,-678;517,383,849,-409,-496,-56,497;614,' + '-381,-409,659,-347,340,736;-145,22,-496,-347,526,296,137;-362,-514,-56,340,296,648,95;-519,-678,' + '497,736,137,95,-934]', + '[318,-645,275,-730,-326,633,107;-645,-247,-156,-53,116,-511,-162;275,-156,-630,-570,262,-343,' + '526;-730,-53,-570,-631,690,329,-312;-326,116,262,690,-455,-207,-152;633,-511,-343,329,-207,-711,' + '-496;107,-162,526,-312,-152,-496,-417]', + '[-101,-812,-33,66,-774,363,378;-812,681,-71,-263,-128,747,547;-33,-71,641,531,613,-531,-99;66,-263,' + '531,579,167,-450,0;-774,-128,613,167,638,-645,-153;363,747,-531,-450,-645,304,-43;378,547,-99,0,' + '-153,-43,408]', + '[-386,189,698,382,-278,-611,609;189,-601,2,-478,344,261,301;698,2,710,-587,-393,-304,255;382,-478,' + '-587,98,-652,-87,87;-278,344,-393,-652,-788,-168,-508;-611,261,-304,-87,-168,792,-22;609,301,255,' + '87,-508,-22,672]', + '[1,-104,-86,40,-647,816,-352;-104,406,-81,-537,493,80,-435;-86,-81,-284,-66,554,-623,680;40,-537,' + '-66,-356,29,-443,248;-647,493,554,29,746,138,685;816,80,-623,-443,138,424,34;-352,-435,680,248,685,' + '34,922]', + '[-682,-50,318,-106,241,743,-780;-50,926,20,385,-582,626,237;318,20,-374,-88,-69,-122,-824;-106,385,' + '-88,-49,-469,390,398;241,-582,-69,-469,-978,-624,-206;743,626,-122,390,-624,557,538;-780,237,-824,' + '398,-206,538,868]', + '[-910,-842,182,171,273,-403,17;-842,737,478,-363,723,319,-225;182,478,99,507,-469,54,-186;171,-363,' + '507,427,-128,271,-239;273,723,-469,-128,-682,-455,-389;-403,319,54,271,-455,712,-162;17,-225,-186,' + '-239,-389,-162,892]', + '[-364,164,-488,-562,-12,-482,416;164,652,-86,436,180,-102,20;-488,-86,-351,-471,-252,346,250;-562,' + '436,-471,758,516,-14,163;-12,180,-252,516,204,-524,-219;-482,-102,346,-14,-524,306,101;416,20,250,' + '163,-219,101,-523]', + '[-916,-771,265,-35,-501,783,587;-771,-632,15,187,687,-308,-32;265,15,103,-346,-254,91,89;-35,187,' + '-346,707,-63,14,436;-501,687,-254,-63,440,-502,-91;783,-308,91,14,-502,405,-182;587,-32,89,436,-91,' + '-182,-450]', + '[-53,-809,-515,-200,44,-145,326;-809,-948,512,-124,-898,-316,322;-515,512,936,153,-148,-146,' + '206;-200,-124,153,959,-152,-321,7;44,-898,-148,-152,71,-76,-786;-145,-316,-146,-321,-76,817,' + '-700;326,322,206,7,-786,-700,-662]', + '[-302,67,-462,263,105,8,292;67,327,-823,-42,-113,527,30;-462,-823,417,55,860,-10,425;263,-42,55,' + '173,281,-394,122;105,-113,860,281,-854,-221,-99;8,527,-10,-394,-221,227,-182;292,30,425,122,-99,' + '-182,-346]', + '[-119,795,-290,-384,121,-469,430;795,-552,645,-722,-394,-170,51;-290,645,600,-222,12,-297,117;-384,' + '-722,-222,-454,-223,-475,-789;121,-394,12,-223,-411,321,529;-469,-170,-297,-475,321,-873,182;430,' + '51,117,-789,529,182,-349]', + '[117,509,-692,-458,-347,-602,203;509,279,-346,393,-879,798,-496;-692,-346,-973,97,-705,-283,' + '62;-458,393,97,-21,-167,-709,-206;-347,-879,-705,-167,-400,-300,-501;-602,798,-283,-709,-300,-803,' + '-620;203,-496,62,-206,-501,-620,920]', + '[975,303,-34,653,-515,-128,-160;303,-703,-62,-749,-24,-40,-108;-34,-62,-391,-85,254,-713,-443;653,' + '-749,-85,597,298,-433,-134;-515,-24,254,298,-460,738,375;-128,-40,-713,-433,738,312,487;-160,-108,' + '-443,-134,375,487,-620]', + '[-981,789,214,562,462,-166,172;789,-829,323,554,-240,35,-524;214,323,491,-355,881,-401,74;562,554,' + '-355,639,-211,10,80;462,-240,881,-211,-383,-868,100;-166,35,-401,10,-868,-229,-605;172,-524,74,80,' + '100,-605,-209]', + '[429,863,-528,200,-44,-239,687;863,-427,684,-810,364,101,-64;-528,684,-196,102,247,-284,-142;200,' + '-810,102,-89,-719,-163,137;-44,364,247,-719,775,-524,247;-239,101,-284,-163,-524,-630,37;687,-64,' + '-142,137,247,37,766]', + '[442,-92,461,-146,-273,75,326;-92,721,243,-13,-137,49,325;461,243,-944,-341,-654,63,-261;-146,-13,' + '-341,-232,-147,518,-381;-273,-137,-654,-147,-976,366,-674;75,49,63,518,366,835,584;326,325,-261,' + '-381,-674,584,-946]', + '[458,294,-391,31,-493,233,-911;294,-262,327,-369,388,-85,-94;-391,327,491,-2,275,45,-40;31,-369,-2,' + '-769,-802,-38,108;-493,388,275,-802,65,-592,706;233,-85,45,-38,-592,696,-294;-911,-94,-40,108,706,' + '-294,419]', + '[991,340,-589,-442,-22,210,897;340,258,-15,-71,-366,29,-201;-589,-15,-888,148,149,-278,246;-442,' + '-71,148,-834,-182,-161,-222;-22,-366,149,-182,-625,-676,111;210,29,-278,-161,-676,38,342;897,-201,' + '246,-222,111,342,798]', + '[736,29,739,-519,-41,174,-774;29,-184,24,-309,826,9,-527;739,24,135,-420,306,589,353;-519,-309,' + '-420,-441,-63,-146,-272;-41,826,306,-63,-953,-569,-297;174,9,589,-146,-569,652,-511;-774,-527,353,' + '-272,-297,-511,-479]', + '[-109,587,6,96,377,-33,-97;587,-609,-191,364,-276,-540,-52;6,-191,500,-21,158,-698,249;96,364,-21,' + '746,-2,-430,-804;377,-276,158,-2,498,-389,626;-33,-540,-698,-430,-389,968,-594;-97,-52,249,-804,' + '626,-594,216]', + '[-571,-349,-384,108,271,604,-1;-349,-949,-190,-891,-93,-143,173;-384,-190,652,-74,-346,-159,' + '618;108,-891,-74,-925,-782,-1,345;271,-93,-346,-782,-244,496,485;604,-143,-159,-1,496,724,166;-1,' + '173,618,345,485,166,604]', + '[-613,73,540,200,372,355,166;73,-962,190,-582,-117,-596,393;540,190,155,18,-327,-89,762;200,-582,' + '18,805,-3,529,-308;372,-117,-327,-3,-604,-88,-450;355,-596,-89,529,-88,679,-111;166,393,762,-308,' + '-450,-111,-247]', + '[330,524,-107,-556,-84,57,783;524,663,-148,373,685,-204,405;-107,-148,-216,104,-264,471,51;-556,' + '373,104,-862,97,-167,-661;-84,685,-264,97,261,745,-393;57,-204,471,-167,745,785,54;783,405,51,-661,' + '-393,54,436]', + '[977,-115,278,768,-817,-844,183;-115,287,178,-402,-558,-397,-558;278,178,-402,123,-708,158,-99;768,' + '-402,123,140,-676,245,-9;-817,-558,-708,-676,985,228,187;-844,-397,158,245,228,-950,129;183,-558,' + '-99,-9,187,129,-905]', + '[-418,19,223,349,-143,561,784;19,200,-698,444,18,633,39;223,-698,-923,-365,419,-71,-104;349,444,' + '-365,-116,64,-278,348;-143,18,419,64,-115,-772,526;561,633,-71,-278,-772,-62,360;784,39,-104,348,' + '526,360,495]', + '[-996,-141,409,84,635,-241,327;-141,607,111,-622,154,-49,-450;409,111,-233,-522,114,-388,-35;84,' + '-622,-522,-496,-648,-210,-180;635,154,114,-648,178,-530,-75;-241,-49,-388,-210,-530,-505,-88;327,' + '-450,-35,-180,-75,-88,505]', + '[-505,-167,448,452,616,-300,473;-167,978,237,580,-364,334,104;448,237,948,74,-536,-860,-344;452,' + '580,74,926,-758,31,581;616,-364,-536,-758,-472,-269,300;-300,334,-860,31,-269,464,-374;473,104,' + '-344,581,300,-374,536]', + '[-924,506,-147,-140,841,-163,-94;506,899,168,-373,-132,-214,618;-147,168,701,-230,-200,100,' + '-632;-140,-373,-230,-86,122,-541,-169;841,-132,-200,122,815,874,-462;-163,-214,100,-541,874,521,' + '521;-94,618,-632,-169,-462,521,998]', + '[960,-103,392,192,-61,280,-369;-103,122,-804,-260,-197,314,76;392,-804,348,161,568,-213,10;192,' + '-260,161,634,166,-222,738;-61,-197,568,166,574,179,-130;280,314,-213,-222,179,354,-241;-369,76,10,' + '738,-130,-241,754]', + '[844,283,407,-361,-784,-629,-443;283,895,-741,377,552,545,-356;407,-741,-446,713,-37,-642,-95;-361,' + '377,713,-706,-509,790,-129;-784,552,-37,-509,929,-216,831;-629,545,-642,790,-216,-381,126;-443,' + '-356,-95,-129,831,126,864]', + '[-44,-613,-265,-59,-454,86,-523;-613,695,-185,100,70,-185,261;-265,-185,516,-915,-514,-305,' + '-183;-59,100,-915,-479,673,-599,9;-454,70,-514,673,-97,147,443;86,-185,-305,-599,147,-52,171;-523,' + '261,-183,9,443,171,40]', + '[615,-292,734,37,350,511,-512;-292,394,773,-557,158,-754,212;734,773,466,406,412,519,-125;37,-557,' + '406,964,117,-569,99;350,158,412,117,-131,-741,134;511,-754,519,-569,-741,-996,32;-512,212,-125,99,' + '134,32,34]', + '[-355,-682,-504,-263,483,226,392;-682,-581,45,142,631,-117,-233;-504,45,334,327,765,-196,-286;-263,' + '142,327,-785,367,98,-324;483,631,765,367,482,-40,468;226,-117,-196,98,-40,151,495;392,-233,-286,' + '-324,468,495,-171]', + '[-691,-179,-303,319,211,-212,59;-179,-148,-340,-622,-170,332,323;-303,-340,-233,52,734,-50,' + '-470;319,-622,52,-522,-204,344,-554;211,-170,734,-204,753,37,133;-212,332,-50,344,37,704,260;59,' + '323,-470,-554,133,260,-214]', + '[-430,244,-408,98,568,-419,-263;244,-498,-523,854,-242,436,573;-408,-523,761,-390,554,-762,-188;98,' + '854,-390,526,196,-723,-193;568,-242,554,196,-930,-118,-299;-419,436,-762,-723,-118,-244,409;-263,' + '573,-188,-193,-299,409,-954]', + '[-735,487,539,-167,200,167,212;487,-195,356,-722,-42,338,77;539,356,37,-497,723,-74,388;-167,-722,' + '-497,-702,-357,-134,-83;200,-42,723,-357,-229,-666,547;167,338,-74,-134,-666,482,-26;212,77,388,' + '-83,547,-26,-699]', + '[-560,-459,8,-566,424,-163,266;-459,40,251,-484,847,-77,-806;8,251,-120,431,23,-32,-17;-566,-484,' + '431,114,-392,-411,-456;424,847,23,-392,492,-92,-128;-163,-77,-32,-411,-92,-644,47;266,-806,-17,' + '-456,-128,47,-358]', + '[-616,38,400,782,-451,-560,243;38,641,-945,-72,-426,-80,-308;400,-945,493,161,150,652,-130;782,-72,' + '161,-182,-392,99,236;-451,-426,150,-392,-164,-7,155;-560,-80,652,99,-7,114,-744;243,-308,-130,236,' + '155,-744,558]', + '[-987,-215,49,-444,-384,-381,-367;-215,-468,61,-421,541,86,432;49,61,21,-308,862,-435,239;-444,' + '-421,-308,-762,-189,62,-520;-384,541,862,-189,33,-358,-566;-381,86,-435,62,-358,-652,504;-367,432,' + '239,-520,-566,504,223]', + '[122,769,689,-167,-441,471,-585;769,217,-172,-209,-408,-284,370;689,-172,-762,714,380,131,' + '-200;-167,-209,714,228,-157,153,-664;-441,-408,380,-157,70,476,-347;471,-284,131,153,476,-505,' + '-284;-585,370,-200,-664,-347,-284,-925]', + '[-435,-265,190,-229,366,212,-510;-265,972,-244,142,-542,304,-272;190,-244,492,-69,-610,555,' + '-292;-229,142,-69,110,-380,-179,-362;366,-542,-610,-380,-600,-228,-80;212,304,555,-179,-228,-465,' + '-65;-510,-272,-292,-362,-80,-65,-722]', + '[-177,-233,784,85,183,-223,-84;-233,817,78,344,391,559,-496;784,78,839,224,330,371,230;85,344,224,' + '-278,412,-272,197;183,391,330,412,639,-809,-132;-223,559,371,-272,-809,109,454;-84,-496,230,197,' + '-132,454,-8]', + '[466,393,20,79,-620,-613,-319;393,48,32,520,13,38,-394;20,32,-607,-369,-263,-144,701;79,520,-369,' + '-666,399,-87,536;-620,13,-263,399,-198,640,-619;-613,38,-144,-87,640,-184,751;-319,-394,701,536,' + '-619,751,-506]', + '[-102,-407,-405,-138,-542,-43,669;-407,955,-156,256,-752,-475,-266;-405,-156,759,54,272,-562,' + '123;-138,256,54,555,-155,-458,520;-542,-752,272,-155,432,678,-187;-43,-475,-562,-458,678,-679,' + '863;669,-266,123,520,-187,863,999]', + '[336,672,-224,-42,-744,803,26;672,-74,-277,402,-180,-131,-288;-224,-277,28,-862,-359,-183,-623;-42,' + '402,-862,-49,-396,-288,-147;-744,-180,-359,-396,-399,401,425;803,-131,-183,-288,401,-523,402;26,' + '-288,-623,-147,425,402,671]', + '[343,302,451,869,-728,461,469;302,-479,-552,-94,99,335,343;451,-552,123,137,-22,-150,371;869,-94,' + '137,-567,29,107,749;-728,99,-22,29,-921,126,78;461,335,-150,107,126,-967,774;469,343,371,749,78,' + '774,-392]', + '[304,146,-18,-752,-8,-481,-790;146,133,175,113,212,-370,-62;-18,175,-586,-334,-677,353,-505;-752,' + '113,-334,-440,-592,431,180;-8,212,-677,-592,79,282,350;-481,-370,353,431,282,569,262;-790,-62,-505,' + '180,350,262,725]', + '[-892,304,-153,-826,-17,209,-21;304,-228,-16,751,167,590,495;-153,-16,339,94,-287,-176,-335;-826,' + '751,94,759,-44,338,-62;-17,167,-287,-44,823,-262,72;209,590,-176,338,-262,166,-551;-21,495,-335,' + '-62,72,-551,267]', + '[858,408,-336,620,83,95,247;408,-973,229,-540,326,126,153;-336,229,379,-102,-37,-334,-233;620,-540,' + '-102,51,-72,-782,372;83,326,-37,-72,778,-571,863;95,126,-334,-782,-571,884,101;247,153,-233,372,' + '863,101,292]', + '[805,581,525,-453,374,-453,64;581,665,155,36,-90,357,-181;525,155,-944,691,-432,-147,-299;-453,36,' + '691,-785,-199,514,-43;374,-90,-432,-199,-278,-559,-390;-453,357,-147,514,-559,501,-89;64,-181,-299,' + '-43,-390,-89,821]', + '[-217,-496,-326,151,715,-222,58;-496,-627,281,-323,-691,-42,20;-326,281,754,-327,269,61,-702;151,' + '-323,-327,418,544,349,-7;715,-691,269,544,-52,-146,-94;-222,-42,61,349,-146,23,656;58,20,-702,-7,' + '-94,656,416]', + '[258,-267,-600,-364,-541,52,-36;-267,-964,-55,343,-169,-401,-160;-600,-55,962,143,-364,136,' + '231;-364,343,143,-814,-149,83,547;-541,-169,-364,-149,-297,441,-664;52,-401,136,83,441,-648,' + '125;-36,-160,231,547,-664,125,-186]', + '[708,-24,600,480,556,-701,628;-24,498,-49,-41,94,-69,407;600,-49,-836,281,641,-636,-372;480,-41,' + '281,173,-193,18,351;556,94,641,-193,-414,-33,59;-701,-69,-636,18,-33,58,-212;628,407,-372,351,59,' + '-212,838]', + '[404,379,-164,490,-372,-323,-178;379,121,-352,-507,-379,-58,-253;-164,-352,936,760,534,-648,' + '463;490,-507,760,540,-221,-193,-283;-372,-379,534,-221,965,114,-500;-323,-58,-648,-193,114,588,' + '516;-178,-253,463,-283,-500,516,133]', + '[-274,-8,774,69,632,746,-742;-8,550,834,-903,291,-438,-107;774,834,902,-160,-580,423,-143;69,-903,' + '-160,852,453,216,-372;632,291,-580,453,562,211,56;746,-438,423,216,211,288,-255;-742,-107,-143,' + '-372,56,-255,381]', + '[29,-608,-241,-79,639,-259,44;-608,-80,727,279,150,-707,11;-241,727,-964,-562,-228,271,299;-79,279,' + '-562,233,-245,-250,-16;639,150,-228,-245,208,-249,566;-259,-707,271,-250,-249,-498,342;44,11,299,' + '-16,566,342,502]', + '[-372,69,-132,48,802,42,-573;69,349,-147,702,-346,177,-132;-132,-147,-588,-729,-253,211,373;48,702,' + '-729,-885,994,206,-391;802,-346,-253,994,-654,286,-125;42,177,211,206,286,-412,5;-573,-132,373,' + '-391,-125,5,917]', + '[857,-510,115,216,-52,263,11;-510,906,25,-444,-200,801,-659;115,25,832,493,-543,-283,-80;216,-444,' + '493,-723,-89,-383,-48;-52,-200,-543,-89,228,641,179;263,801,-283,-383,641,-984,390;11,-659,-80,-48,' + '179,390,314]', + '[-786,-107,592,-837,329,-489,-279;-107,326,699,517,-347,109,-273;592,699,852,366,499,16,-329;-837,' + '517,366,939,-584,-909,494;329,-347,499,-584,-172,-535,-62;-489,109,16,-909,-535,-147,223;-279,-273,' + '-329,494,-62,223,442]', + '[-529,-343,-828,-312,-108,143,-370;-343,583,-181,167,-353,654,490;-828,-181,586,334,-153,-633,' + '214;-312,167,334,538,635,-73,-251;-108,-353,-153,635,338,-2,-38;143,654,-633,-73,-2,732,543;-370,' + '490,214,-251,-38,543,-691]', + '[-791,-269,-24,310,42,44,-620;-269,64,-128,341,635,482,-346;-24,-128,-745,451,-170,232,-236;310,' + '341,451,403,466,-26,-684;42,635,-170,466,-274,510,-103;44,482,232,-26,510,35,-232;-620,-346,-236,' + '-684,-103,-232,736]', + '[-410,-80,172,-425,205,677,232;-80,373,214,214,-24,232,-602;172,214,771,493,250,-99,546;-425,214,' + '493,881,-773,-465,-210;205,-24,250,-773,-858,231,664;677,232,-99,-465,231,337,-335;232,-602,546,' + '-210,664,-335,-405]', + '[268,-65,-243,164,-411,352,-74;-65,-70,-191,22,81,89,508;-243,-191,-211,140,-200,-766,687;164,22,' + '140,572,30,-779,441;-411,81,-200,30,-903,-329,510;352,89,-766,-779,-329,276,352;-74,508,687,441,' + '510,352,-884]', + '[183,-42,-185,-223,389,-71,312;-42,365,387,-828,-348,91,-815;-185,387,-561,484,-238,-10,374;-223,' + '-828,484,-835,383,2,397;389,-348,-238,383,-852,-936,152;-71,91,-10,2,-936,834,-652;312,-815,374,' + '397,152,-652,-485]', + '[577,44,346,411,287,817,385;44,293,-391,67,455,-125,-706;346,-391,-393,690,600,-139,601;411,67,690,' + '-29,112,301,-324;287,455,600,112,431,296,-877;817,-125,-139,301,296,-373,255;385,-706,601,-324,' + '-877,255,-210]'], + [ + '[808,-278,875,-231,-399,765,-565,50;-278,221,592,-213,177,-142,857,-69;875,592,-413,56,-105,-81,' + '-184,406;-231,-213,56,-429,-157,175,484,135;-399,177,-105,-157,997,663,302,59;765,-142,-81,175,663,' + '-39,137,106;-565,857,-184,484,302,137,-521,-252;50,-69,406,135,59,106,-252,399]', + '[161,157,43,-345,453,649,77,-136;157,-768,194,-548,480,-97,-710,-429;43,194,-445,490,285,-678,923,' + '637;-345,-548,490,215,271,-107,926,102;453,480,285,271,739,-373,-185,-466;649,-97,-678,-107,-373,' + '755,464,-453;77,-710,923,926,-185,464,-617,-261;-136,-429,637,102,-466,-453,-261,-779]', + '[743,-327,77,563,9,-897,132,362;-327,-673,511,210,-354,-168,-545,301;77,511,514,525,-511,-457,122,' + '-456;563,210,525,236,132,29,199,266;9,-354,-511,132,94,158,286,-78;-897,-168,-457,29,158,738,10,' + '-492;132,-545,122,199,286,10,242,-381;362,301,-456,266,-78,-492,-381,767]', + '[551,505,-571,261,236,-131,341,85;505,641,-277,-294,298,-125,11,271;-571,-277,416,390,-95,-423,166,' + '-278;261,-294,390,-219,-483,582,476,-175;236,298,-95,-483,736,-212,209,49;-131,-125,-423,582,-212,' + '-712,-294,110;341,11,166,476,209,-294,-524,-50;85,271,-278,-175,49,110,-50,-539]', + '[475,359,-523,-420,609,-527,-78,-101;359,953,646,-263,-266,-137,5,307;-523,646,348,289,453,-535,' + '-289,-657;-420,-263,289,963,-124,-118,-1,-70;609,-266,453,-124,-338,470,831,300;-527,-137,-535,' + '-118,470,-970,226,517;-78,5,-289,-1,831,226,-634,404;-101,307,-657,-70,300,517,404,366]', + '[980,164,-93,192,119,-740,245,657;164,844,-4,-506,111,284,-440,-335;-93,-4,474,41,7,583,308,' + '434;192,-506,41,52,-17,477,-103,147;119,111,7,-17,3,-449,-606,-38;-740,284,583,477,-449,288,186,' + '-168;245,-440,308,-103,-606,186,588,-283;657,-335,434,147,-38,-168,-283,-608]', + '[702,374,72,726,26,-251,-277,-646;374,-197,772,48,42,-921,-95,183;72,772,-944,671,685,-164,-307,' + '-742;726,48,671,212,86,57,173,606;26,42,685,86,-552,-80,-561,-73;-251,-921,-164,57,-80,72,497,' + '195;-277,-95,-307,173,-561,497,-715,-35;-646,183,-742,606,-73,195,-35,384]', + '[311,-486,254,208,305,101,379,-147;-486,-706,1,375,-160,249,566,-784;254,1,965,-582,-576,72,367,' + '355;208,375,-582,-634,-189,771,-100,526;305,-160,-576,-189,766,-326,-797,366;101,249,72,771,-326,' + '-275,-288,498;379,566,367,-100,-797,-288,-796,295;-147,-784,355,526,366,498,295,-216]', + '[621,385,545,-215,-193,652,-102,-335;385,663,-954,337,-89,-287,-52,295;545,-954,228,-68,-319,-537,' + '54,548;-215,337,-68,128,-189,-89,-541,578;-193,-89,-319,-189,-471,340,-24,-53;652,-287,-537,-89,' + '340,232,201,-740;-102,-52,54,-541,-24,201,-425,-527;-335,295,548,578,-53,-740,-527,935]', + '[-757,829,-286,395,13,484,72,535;829,-659,-621,-139,-267,-51,833,-148;-286,-621,973,-667,136,-158,' + '-20,-334;395,-139,-667,820,-595,275,54,196;13,-267,136,-595,450,157,-109,879;484,-51,-158,275,157,' + '797,686,22;72,833,-20,54,-109,686,209,-440;535,-148,-334,196,879,22,-440,-811]', + '[-810,-857,-276,-493,-173,-325,372,514;-857,171,228,152,592,-219,-809,-613;-276,228,737,-440,158,' + '-63,-17,-24;-493,152,-440,465,392,592,-11,268;-173,592,158,392,-113,158,-58,-431;-325,-219,-63,592,' + '158,593,164,241;372,-809,-17,-11,-58,164,-75,-227;514,-613,-24,268,-431,241,-227,-207]', + '[-320,220,-310,312,251,-597,-2,-48;220,-268,-316,-874,-290,284,-485,327;-310,-316,-550,899,-626,' + '180,-659,263;312,-874,899,187,-23,-716,166,726;251,-290,-626,-23,-140,-255,146,-160;-597,284,180,' + '-716,-255,-256,429,-32;-2,-485,-659,166,146,429,717,38;-48,327,263,726,-160,-32,38,-834]', + '[-26,222,-112,-333,-202,214,90,-711;222,436,-141,344,-370,108,-703,-562;-112,-141,494,-214,11,-781,' + '-221,231;-333,344,-214,865,175,-617,-41,414;-202,-370,11,175,569,182,-413,-311;214,108,-781,-617,' + '182,-617,409,-260;90,-703,-221,-41,-413,409,209,-42;-711,-562,231,414,-311,-260,-42,481]', + '[-564,30,35,-156,437,-180,-133,-249;30,-287,-632,-442,-332,631,-502,-67;35,-632,-917,-31,-191,495,' + '-541,-644;-156,-442,-31,-83,312,-212,116,192;437,-332,-191,312,-299,-112,-316,232;-180,631,495,' + '-212,-112,264,226,-87;-133,-502,-541,116,-316,226,754,-95;-249,-67,-644,192,232,-87,-95,598]', + '[-912,-37,407,599,368,434,324,26;-37,-10,-78,-400,-21,187,-151,603;407,-78,-198,817,111,-796,859,' + '-436;599,-400,817,968,-805,154,-479,592;368,-21,111,-805,-57,-376,-632,-17;434,187,-796,154,-376,' + '743,369,280;324,-151,859,-479,-632,369,-851,658;26,603,-436,592,-17,280,658,-803]', + '[-211,212,428,-720,-651,188,708,-289;212,-780,-18,-345,265,194,-487,48;428,-18,-501,38,343,685,285,' + '25;-720,-345,38,744,244,519,672,425;-651,265,343,244,941,-318,-56,-181;188,194,685,519,-318,12,' + '-413,161;708,-487,285,672,-56,-413,276,-549;-289,48,25,425,-181,161,-549,604]', + '[-262,150,242,-310,314,-665,312,805;150,-403,-540,80,-676,-607,128,-249;242,-540,-208,-712,-542,' + '-247,358,147;-310,80,-712,-127,337,-608,-614,579;314,-676,-542,337,545,-175,-746,-36;-665,-607,' + '-247,-608,-175,-653,74,245;312,128,358,-614,-746,74,-934,564;805,-249,147,579,-36,245,564,86]', + '[-621,172,354,106,936,-47,258,-305;172,-331,95,-233,-331,445,-542,40;354,95,-677,117,-16,-298,162,' + '247;106,-233,117,372,367,-647,-232,-136;936,-331,-16,367,523,274,375,8;-47,445,-298,-647,274,707,' + '-765,291;258,-542,162,-232,375,-765,36,-485;-305,40,247,-136,8,291,-485,-453]', + '[845,-105,-231,350,329,-442,755,132;-105,399,674,634,123,34,-145,94;-231,674,-531,427,170,683,-181,' + '-350;350,634,427,439,450,333,654,65;329,123,170,450,27,209,373,-483;-442,34,683,333,209,359,808,' + '-578;755,-145,-181,654,373,808,235,-349;132,94,-350,65,-483,-578,-349,353]', + '[-54,-425,166,21,458,-478,-71,-682;-425,837,-567,179,-231,166,-555,-1;166,-567,572,71,329,-143,132,' + '-98;21,179,71,766,447,548,-249,-499;458,-231,329,447,-82,-770,-182,-82;-478,166,-143,548,-770,-679,' + '303,55;-71,-555,132,-249,-182,303,-210,-606;-682,-1,-98,-499,-82,55,-606,-368]', + '[-721,246,-538,945,-96,391,-352,-225;246,-99,-25,127,-123,-252,421,-586;-538,-25,836,-549,-188,242,' + '-514,-467;945,127,-549,-67,-54,-308,-641,-797;-96,-123,-188,-54,690,-45,498,393;391,-252,242,-308,' + '-45,233,728,-371;-352,421,-514,-641,498,728,323,-365;-225,-586,-467,-797,393,-371,-365,728]', + '[-585,-371,752,-334,482,193,-119,-166;-371,-666,736,37,-634,575,65,-174;752,736,893,938,124,325,' + '-414,233;-334,37,938,-467,62,-672,100,416;482,-634,124,62,19,-618,-522,180;193,575,325,-672,-618,' + '-131,253,120;-119,65,-414,100,-522,253,-644,-289;-166,-174,233,416,180,120,-289,598]', + '[-834,14,-85,202,-197,503,-44,-425;14,-689,522,-656,108,-258,56,378;-85,522,-379,-334,-421,540,' + '-321,-436;202,-656,-334,521,-642,475,228,-493;-197,108,-421,-642,-881,-119,-114,177;503,-258,540,' + '475,-119,-137,-41,-60;-44,56,-321,228,-114,-41,432,141;-425,378,-436,-493,177,-60,141,759]', + '[-177,-670,-708,580,-790,-437,-319,-249;-670,173,836,-376,-175,52,366,163;-708,836,-848,-301,-568,' + '384,-254,-718;580,-376,-301,892,-36,310,110,-594;-790,-175,-568,-36,-118,-368,-4,-50;-437,52,384,' + '310,-368,-714,19,-852;-319,366,-254,110,-4,19,2,-241;-249,163,-718,-594,-50,-852,-241,8]', + '[-188,-684,-298,581,626,-102,640,-271;-684,-286,-288,6,563,375,-501,454;-298,-288,-904,-198,816,' + '454,-228,-953;581,6,-198,-901,369,393,169,-407;626,563,816,369,-598,53,-48,223;-102,375,454,393,53,' + '-426,-349,3;640,-501,-228,169,-48,-349,-775,91;-271,454,-953,-407,223,3,91,469]', + '[-406,180,601,-134,-338,-95,63,-351;180,932,-550,469,-303,-40,61,657;601,-550,-144,32,-116,-137,' + '-494,-200;-134,469,32,-249,-351,-722,47,-786;-338,-303,-116,-351,811,238,108,-360;-95,-40,-137,' + '-722,238,905,-138,729;63,61,-494,47,108,-138,-307,-188;-351,657,-200,-786,-360,729,-188,-372]', + '[-301,-656,-404,122,-19,-420,519,32;-656,597,-843,358,-870,-408,-391,-86;-404,-843,489,47,384,-497,' + '260,-724;122,358,47,-27,-191,369,-31,261;-19,-870,384,-191,-545,-383,-707,59;-420,-408,-497,369,' + '-383,-550,514,-45;519,-391,260,-31,-707,514,654,-187;32,-86,-724,261,59,-45,-187,-161]', + '[-353,-129,579,82,195,1,272,-273;-129,9,195,812,-184,51,440,82;579,195,-69,-472,-465,312,104,' + '111;82,812,-472,361,659,-204,267,-156;195,-184,-465,659,-714,62,401,868;1,51,312,-204,62,-976,-556,' + '-353;272,440,104,267,401,-556,-326,-96;-273,82,111,-156,868,-353,-96,-597]', + '[91,-161,609,247,729,447,479,-399;-161,209,-393,-128,-19,-315,465,436;609,-393,-513,321,366,186,' + '423,-297;247,-128,321,-119,124,636,-287,-577;729,-19,366,124,-71,335,552,-241;447,-315,186,636,335,' + '519,310,422;479,465,423,-287,552,310,775,366;-399,436,-297,-577,-241,422,366,-355]', + '[864,442,244,-155,-133,-41,-487,571;442,472,-683,-97,-649,-19,-485,-208;244,-683,-671,-128,-199,' + '-608,150,-536;-155,-97,-128,-925,85,167,-183,-527;-133,-649,-199,85,233,279,-334,135;-41,-19,-608,' + '167,279,69,-373,0;-487,-485,150,-183,-334,-373,-106,-426;571,-208,-536,-527,135,0,-426,523]', + '[-277,799,399,46,-158,-105,-472,-446;799,-725,-636,528,427,918,-580,-205;399,-636,340,250,-379,298,' + '78,-671;46,528,250,856,-187,-67,428,-623;-158,427,-379,-187,-784,-648,-372,-213;-105,918,298,-67,' + '-648,271,-176,126;-472,-580,78,428,-372,-176,-837,585;-446,-205,-671,-623,-213,126,585,-866]', + '[384,-598,-133,-338,148,490,-16,-371;-598,-995,648,-350,342,400,-125,32;-133,648,996,505,0,-19,486,' + '334;-338,-350,505,699,-188,238,-14,-539;148,342,0,-188,138,72,-665,-298;490,400,-19,238,72,-151,' + '484,656;-16,-125,486,-14,-665,484,781,90;-371,32,334,-539,-298,656,90,-913]', + '[92,-103,-494,-476,-657,645,189,167;-103,-454,650,198,-5,483,-364,151;-494,650,-948,373,-314,704,' + '-66,-189;-476,198,373,438,325,289,-566,-82;-657,-5,-314,325,52,-318,726,-194;645,483,704,289,-318,' + '22,-205,572;189,-364,-66,-566,726,-205,416,-656;167,151,-189,-82,-194,572,-656,48]', + '[256,-683,-311,472,475,156,8,-81;-683,-560,272,-892,197,-847,-241,-426;-311,272,-332,240,-20,-498,' + '-603,-791;472,-892,240,-68,-38,543,340,-54;475,197,-20,-38,-489,-220,526,-790;156,-847,-498,543,' + '-220,404,33,-444;8,-241,-603,340,526,33,855,-374;-81,-426,-791,-54,-790,-444,-374,-140]', + '[834,120,-67,-684,-158,287,-257,0;120,696,454,-382,221,298,-420,430;-67,454,-831,61,505,88,29,' + '-217;-684,-382,61,723,-59,907,-77,-198;-158,221,505,-59,-790,-96,-243,-44;287,298,88,907,-96,-375,' + '326,338;-257,-420,29,-77,-243,326,-742,542;0,430,-217,-198,-44,338,542,487]', + '[-73,376,-251,-591,142,88,-240,-553;376,392,-586,-685,-342,62,860,219;-251,-586,-980,358,-652,-34,' + '-337,-669;-591,-685,358,-594,66,-704,-283,-462;142,-342,-652,66,185,23,-832,-505;88,62,-34,-704,23,' + '-48,187,363;-240,860,-337,-283,-832,187,-309,-78;-553,219,-669,-462,-505,363,-78,-382]', + '[704,123,-420,-628,168,47,-187,-517;123,-936,335,460,-331,160,-13,300;-420,335,-344,653,525,-826,' + '-226,-89;-628,460,653,-237,111,633,256,44;168,-331,525,111,-218,-414,-423,103;47,160,-826,633,-414,' + '-976,254,455;-187,-13,-226,256,-423,254,726,-701;-517,300,-89,44,103,455,-701,118]', + '[74,-582,-710,287,45,-329,81,-158;-582,483,48,-32,-267,807,-673,-380;-710,48,657,667,-217,-765,-42,' + '921;287,-32,667,-183,-549,724,-303,-390;45,-267,-217,-549,960,295,-273,141;-329,807,-765,724,295,' + '-575,-576,-53;81,-673,-42,-303,-273,-576,-285,-94;-158,-380,921,-390,141,-53,-94,-403]', + '[-363,-189,12,113,-405,265,-209,-520;-189,-265,-291,-8,655,-267,803,235;12,-291,379,316,615,-94,78,' + '148;113,-8,316,804,764,533,-529,-432;-405,655,615,764,-433,-79,-430,-441;265,-267,-94,533,-79,147,' + '-8,-616;-209,803,78,-529,-430,-8,964,-121;-520,235,148,-432,-441,-616,-121,230]', + '[-715,-69,-734,299,-234,696,-106,718;-69,657,-278,445,109,408,-494,-33;-734,-278,447,31,-49,8,84,' + '356;299,445,31,-354,352,-757,34,672;-234,109,-49,352,-899,523,27,240;696,408,8,-757,523,-903,-324,' + '-774;-106,-494,84,34,27,-324,358,-217;718,-33,356,672,240,-774,-217,527]', + '[-583,-373,75,-445,158,99,-393,319;-373,-531,89,-168,206,-120,582,184;75,89,666,118,341,107,76,' + '-283;-445,-168,118,870,91,47,-477,-305;158,206,341,91,-961,84,77,-237;99,-120,107,47,84,647,-663,' + '81;-393,582,76,-477,77,-663,98,-171;319,184,-283,-305,-237,81,-171,128]', + '[-921,-483,442,-562,500,-511,-292,248;-483,-903,107,-330,515,-219,-111,3;442,107,-303,-132,-487,19,' + '564,830;-562,-330,-132,-18,235,-14,-436,354;500,515,-487,235,-836,97,-343,-125;-511,-219,19,-14,97,' + '811,-63,-162;-292,-111,564,-436,-343,-63,39,100;248,3,830,354,-125,-162,100,-238]', + '[429,75,-149,-102,567,-56,350,788;75,-27,-189,302,-275,-157,-136,319;-149,-189,475,-172,82,98,-54,' + '-680;-102,302,-172,192,288,249,728,-21;567,-275,82,288,421,-188,-834,-563;-56,-157,98,249,-188,989,' + '-245,661;350,-136,-54,728,-834,-245,716,-165;788,319,-680,-21,-563,661,-165,-625]', + '[771,-671,-414,135,-676,-505,-283,-540;-671,228,755,322,-429,-87,-218,-102;-414,755,678,120,-281,' + '-41,62,-28;135,322,120,-69,-160,158,73,-533;-676,-429,-281,-160,677,-133,-518,821;-505,-87,-41,158,' + '-133,-701,87,164;-283,-218,62,73,-518,87,-494,-727;-540,-102,-28,-533,821,164,-727,8]', + '[7,-57,-530,89,212,72,221,-397;-57,-984,-288,-134,-115,-237,16,-609;-530,-288,-355,-75,487,-208,' + '320,48;89,-134,-75,-20,-223,-303,-62,-119;212,-115,487,-223,-657,-306,248,-290;72,-237,-208,-303,' + '-306,375,-375,154;221,16,320,-62,248,-375,-568,-201;-397,-609,48,-119,-290,154,-201,-626]', + '[-320,-26,261,617,-684,-155,-3,-251;-26,-683,-415,890,596,106,194,-555;261,-415,-11,184,106,611,' + '159,-57;617,890,184,122,-552,755,644,-332;-684,596,106,-552,164,-389,-260,-35;-155,106,611,755,' + '-389,90,442,196;-3,194,159,644,-260,442,7,83;-251,-555,-57,-332,-35,196,83,-862]', + '[-115,-242,247,-150,-239,-13,340,-158;-242,889,-712,172,-772,48,37,172;247,-712,749,333,-221,-244,' + '-206,-474;-150,172,333,36,389,374,-73,-204;-239,-772,-221,389,599,-311,36,-293;-13,48,-244,374,' + '-311,-985,-43,-149;340,37,-206,-73,36,-43,-949,633;-158,172,-474,-204,-293,-149,633,-202]', + '[185,390,-301,-518,11,382,285,112;390,166,-418,66,-113,-163,-552,-874;-301,-418,-736,317,-216,713,' + '-36,-508;-518,66,317,-191,865,108,964,218;11,-113,-216,865,-994,-528,234,-54;382,-163,713,108,-528,' + '-481,509,742;285,-552,-36,964,234,509,-181,-354;112,-874,-508,218,-54,742,-354,606]', + '[225,-41,-323,-325,857,2,-111,852;-41,-296,-186,181,-1,77,-152,-513;-323,-186,-964,372,-599,-264,' + '24,-232;-325,181,372,-285,22,225,-502,-88;857,-1,-599,22,-500,354,352,114;2,77,-264,225,354,247,77,' + '-245;-111,-152,24,-502,352,77,823,272;852,-513,-232,-88,114,-245,272,-640]', + '[-882,182,-721,-2,708,658,-128,-405;182,-600,-779,-15,-33,-307,3,500;-721,-779,726,14,816,30,79,' + '-513;-2,-15,14,-937,-385,-212,106,-673;708,-33,816,-385,652,857,125,-490;658,-307,30,-212,857,327,' + '478,-519;-128,3,79,106,125,478,604,348;-405,500,-513,-673,-490,-519,348,-49]', + '[-247,279,-233,300,-596,536,107,119;279,-955,-57,-108,-312,-241,-470,-649;-233,-57,968,-576,-494,' + '160,-80,254;300,-108,-576,-275,258,-208,-187,-574;-596,-312,-494,258,312,301,262,202;536,-241,160,' + '-208,301,-13,-220,-389;107,-470,-80,-187,262,-220,292,412;119,-649,254,-574,202,-389,412,428]', + '[-992,-65,97,-390,110,-593,65,469;-65,849,100,813,302,-85,1,445;97,100,-914,841,-808,149,-604,' + '-588;-390,813,841,-444,-129,338,276,-397;110,302,-808,-129,672,316,-197,88;-593,-85,149,338,316,' + '350,-83,-642;65,1,-604,276,-197,-83,-872,249;469,445,-588,-397,88,-642,249,900]', + '[-518,-140,218,137,-57,-375,618,614;-140,-544,255,156,-208,424,45,-306;218,255,851,-169,-208,100,' + '432,-277;137,156,-169,276,-540,435,-567,591;-57,-208,-208,-540,-706,360,79,-168;-375,424,100,435,' + '360,-959,-542,39;618,45,432,-567,79,-542,243,-547;614,-306,-277,591,-168,39,-547,985]', + '[659,-3,124,177,-179,-29,764,-387;-3,-481,302,172,-11,23,30,-255;124,302,-722,255,-99,496,247,' + '-661;177,172,255,-551,584,364,27,83;-179,-11,-99,584,-849,-119,-627,91;-29,23,496,364,-119,-189,' + '195,-173;764,30,247,27,-627,195,-196,-547;-387,-255,-661,83,91,-173,-547,558]', + '[-467,572,-60,174,-365,155,-386,-903;572,-724,298,97,302,-434,-77,173;-60,298,-941,-511,178,212,' + '434,191;174,97,-511,-928,831,-352,584,114;-365,302,178,831,-165,-25,-308,-87;155,-434,212,-352,-25,' + '-254,-314,-740;-386,-77,434,584,-308,-314,236,173;-903,173,191,114,-87,-740,173,-567]', + '[584,220,-533,423,173,214,-377,623;220,662,-31,912,-94,45,606,512;-533,-31,-451,-122,-411,65,393,' + '855;423,912,-122,-142,348,-541,449,368;173,-94,-411,348,934,376,213,-579;214,45,65,-541,376,700,' + '116,432;-377,606,393,449,213,116,-404,-43;623,512,855,368,-579,432,-43,-804]', + '[542,64,-578,858,-678,-686,373,-98;64,314,-421,610,-603,-73,414,-411;-578,-421,-644,-311,-172,136,' + '198,-320;858,610,-311,639,941,-22,142,397;-678,-603,-172,941,-831,304,-262,-155;-686,-73,136,-22,' + '304,463,-216,-88;373,414,198,142,-262,-216,236,-381;-98,-411,-320,397,-155,-88,-381,-264]', + '[773,-819,-786,105,-88,-614,-700,-859;-819,-558,-403,725,-163,-168,-124,-35;-786,-403,-618,-257,' + '-685,369,357,471;105,725,-257,430,-530,473,-178,347;-88,-163,-685,-530,-794,197,144,708;-614,-168,' + '369,473,197,-255,282,237;-700,-124,357,-178,144,282,757,451;-859,-35,471,347,708,237,451,134]', + '[-829,21,-560,-575,193,-236,-375,-315;21,-125,31,-537,-127,-577,-390,-607;-560,31,801,-352,13,-126,' + '-42,169;-575,-537,-352,509,231,25,-174,122;193,-127,13,231,201,550,134,419;-236,-577,-126,25,550,' + '-591,-149,-534;-375,-390,-42,-174,134,-149,-158,-290;-315,-607,169,122,419,-534,-290,412]', + '[311,371,379,404,213,474,314,-104;371,683,-450,107,66,-27,35,37;379,-450,-232,17,-94,115,603,' + '-1;404,107,17,-500,768,634,-765,14;213,66,-94,768,-80,62,-318,-243;474,-27,115,634,62,486,-331,' + '594;314,35,603,-765,-318,-331,910,-389;-104,37,-1,14,-243,594,-389,-788]', + '[-796,156,607,220,-460,23,-736,-365;156,620,-547,-507,-226,418,40,-217;607,-547,-238,283,-676,-375,' + '77,263;220,-507,283,-262,-30,46,130,-325;-460,-226,-676,-30,-83,7,434,-307;23,418,-375,46,7,-664,' + '756,-274;-736,40,77,130,434,756,601,65;-365,-217,263,-325,-307,-274,65,867]', + '[332,-160,-560,30,-455,505,-16,-30;-160,227,293,157,-68,-201,-32,341;-560,293,-676,682,392,85,60,' + '385;30,157,682,350,585,-1,-314,-117;-455,-68,392,585,571,224,-112,720;505,-201,85,-1,224,-69,-83,' + '-237;-16,-32,60,-314,-112,-83,-20,333;-30,341,385,-117,720,-237,333,-638]', + '[-257,400,-726,473,104,-420,-104,-332;400,-219,-591,389,-249,-163,230,-100;-726,-591,-491,-311,' + '-280,605,-699,89;473,389,-311,-729,203,-358,451,-77;104,-249,-280,203,-113,-682,544,330;-420,-163,' + '605,-358,-682,551,609,-65;-104,230,-699,451,544,609,921,-452;-332,-100,89,-77,330,-65,-452,575]', + '[-172,-171,-32,549,-113,328,-33,-219;-171,-630,843,-273,-135,-17,-395,-30;-32,843,-249,-309,50,' + '-250,481,525;549,-273,-309,-945,521,766,134,488;-113,-135,50,521,808,-341,311,485;328,-17,-250,766,' + '-341,-684,846,-132;-33,-395,481,134,311,846,-536,-541;-219,-30,525,488,485,-132,-541,-235]', + '[-7,-168,267,44,525,215,739,74;-168,-792,105,575,643,-374,-272,613;267,105,911,841,-72,316,-390,' + '-109;44,575,841,-348,142,53,-49,-176;525,643,-72,142,369,463,269,-86;215,-374,316,53,463,-217,197,' + '-37;739,-272,-390,-49,269,197,-922,32;74,613,-109,-176,-86,-37,32,595]', + '[-211,856,-146,-570,-229,-636,-109,282;856,-94,-63,409,-620,234,498,641;-146,-63,134,90,533,93,156,' + '-454;-570,409,90,-568,-617,-89,33,-511;-229,-620,533,-617,396,-278,526,-220;-636,234,93,-89,-278,' + '456,-308,700;-109,498,156,33,526,-308,-456,-540;282,641,-454,-511,-220,700,-540,-886]', + '[143,-192,-28,-357,370,50,359,143;-192,-232,729,-314,767,55,108,-599;-28,729,-278,12,-316,803,-842,' + '869;-357,-314,12,-420,552,-467,634,388;370,767,-316,552,-500,-42,212,-277;50,55,803,-467,-42,392,' + '885,98;359,108,-842,634,212,885,-183,-117;143,-599,869,388,-277,98,-117,938]', + '[-801,780,-373,306,688,-182,573,-120;780,-749,424,-128,-456,584,116,-312;-373,424,-407,-389,-408,' + '153,-533,48;306,-128,-389,571,-142,687,-170,-137;688,-456,-408,-142,17,-236,-234,507;-182,584,153,' + '687,-236,-819,-447,865;573,116,-533,-170,-234,-447,-451,-411;-120,-312,48,-137,507,865,-411,459]', + '[-157,-171,263,17,-728,-193,762,257;-171,-413,-239,-868,431,364,-566,-172;263,-239,-37,-585,311,' + '362,-186,715;17,-868,-585,797,-416,-674,138,-520;-728,431,311,-416,-918,-227,-483,483;-193,364,362,' + '-674,-227,-581,-508,923;762,-566,-186,138,-483,-508,42,-343;257,-172,715,-520,483,923,-343,-720]', + '[367,329,361,-44,320,-128,349,580;329,-827,370,37,412,-234,358,399;361,370,-232,231,-103,-208,778,' + '-174;-44,37,231,471,-605,450,-70,-310;320,412,-103,-605,416,229,143,-225;-128,-234,-208,450,229,' + '-617,561,771;349,358,778,-70,143,561,-742,6;580,399,-174,-310,-225,771,6,-852]', + '[-229,-391,772,601,-348,-207,312,952;-391,-368,-245,265,170,252,694,109;772,-245,893,-441,156,235,' + '-210,-620;601,265,-441,838,585,-262,753,-32;-348,170,156,585,465,476,-52,-421;-207,252,235,-262,' + '476,986,-370,-203;312,694,-210,753,-52,-370,-897,521;952,109,-620,-32,-421,-203,521,506]', + '[-895,-403,690,-490,130,-670,-27,837;-403,-392,384,-401,932,195,-213,-813;690,384,658,205,448,-825,' + '182,-445;-490,-401,205,-742,-179,-657,-368,36;130,932,448,-179,-606,717,-29,176;-670,195,-825,-657,' + '717,-861,271,-35;-27,-213,182,-368,-29,271,541,369;837,-813,-445,36,176,-35,369,-628]', + '[-208,-129,8,142,-466,103,11,-558;-129,136,84,631,198,715,-292,-724;8,84,-917,-178,-648,-243,868,' + '-444;142,631,-178,-893,-614,792,146,-291;-466,198,-648,-614,22,83,-180,245;103,715,-243,792,83,' + '-465,22,413;11,-292,868,146,-180,22,-818,895;-558,-724,-444,-291,245,413,895,617]', + '[-749,13,400,364,-214,-750,632,-364;13,-929,664,398,-182,30,80,115;400,664,-703,58,84,472,-419,' + '-60;364,398,58,-487,162,-686,-466,-577;-214,-182,84,162,138,504,674,759;-750,30,472,-686,504,439,' + '770,311;632,80,-419,-466,674,770,859,393;-364,115,-60,-577,759,311,393,787]', + '[-780,366,-190,-207,963,-465,-393,-877;366,-624,-844,-177,571,-282,-3,430;-190,-844,-927,753,440,' + '-517,-286,378;-207,-177,753,-189,540,-9,322,889;963,571,440,540,-286,141,272,219;-465,-282,-517,-9,' + '141,411,268,-27;-393,-3,-286,322,272,268,-738,-192;-877,430,378,889,219,-27,-192,462]', + '[-969,275,-875,-677,-65,29,-457,281;275,-833,262,116,-111,-162,-803,262;-875,262,773,56,-424,277,' + '613,-156;-677,116,56,-825,187,-17,-92,-595;-65,-111,-424,187,401,49,-206,235;29,-162,277,-17,49,4,' + '-2,-491;-457,-803,613,-92,-206,-2,87,-117;281,262,-156,-595,235,-491,-117,746]', + '[662,-401,-344,169,-494,-266,58,-462;-401,282,-394,-578,583,-777,129,-408;-344,-394,130,-422,-675,' + '-224,-202,844;169,-578,-422,-772,46,-336,285,193;-494,583,-675,46,257,519,-626,361;-266,-777,-224,' + '-336,519,-710,-395,-567;58,129,-202,285,-626,-395,197,-529;-462,-408,844,193,361,-567,-529,825]', + '[771,-245,-364,456,818,466,-355,418;-245,683,63,841,-615,-647,-229,-571;-364,63,-904,-357,-173,248,' + '-72,-122;456,841,-357,551,-822,-150,-466,-277;818,-615,-173,-822,26,-44,590,-105;466,-647,248,-150,' + '-44,697,-201,462;-355,-229,-72,-466,590,-201,200,-273;418,-571,-122,-277,-105,462,-273,-389]', + '[965,-217,305,-118,-647,45,-167,309;-217,400,-58,-466,871,47,24,-351;305,-58,600,440,81,-628,392,' + '-551;-118,-466,440,821,30,408,-66,334;-647,871,81,30,372,-576,599,-252;45,47,-628,408,-576,-48,120,' + '-643;-167,24,392,-66,599,120,376,-424;309,-351,-551,334,-252,-643,-424,353]', + '[-551,-129,218,172,224,294,-114,759;-129,786,-11,-40,-258,-180,216,-302;218,-11,-593,339,-345,464,' + '297,-39;172,-40,339,918,403,-652,524,-436;224,-258,-345,403,304,-88,731,-248;294,-180,464,-652,-88,' + '-967,180,-17;-114,216,297,524,731,180,-709,369;759,-302,-39,-436,-248,-17,369,671]', + '[751,511,288,32,-487,-406,560,-452;511,694,174,-578,-261,78,740,-114;288,174,-655,-159,93,-592,171,' + '-450;32,-578,-159,-300,-98,-871,-337,414;-487,-261,93,-98,-360,130,114,734;-406,78,-592,-871,130,' + '-107,-67,-138;560,740,171,-337,114,-67,-524,-192;-452,-114,-450,414,734,-138,-192,-172]', + '[-409,-70,-354,16,302,674,-392,37;-70,812,-82,-106,-660,443,52,-681;-354,-82,-971,-380,676,0,78,' + '-649;16,-106,-380,209,826,238,-415,-588;302,-660,676,826,691,-912,-414,392;674,443,0,238,-912,271,' + '-704,-648;-392,52,78,-415,-414,-704,-564,238;37,-681,-649,-588,392,-648,238,143]', + '[49,-361,-254,183,596,77,-489,223;-361,690,-97,731,-794,321,218,-377;-254,-97,-213,-178,50,-583,' + '-87,-61;183,731,-178,-75,478,-828,194,635;596,-794,50,478,443,-66,-569,482;77,321,-583,-828,-66,' + '-710,-145,152;-489,218,-87,194,-569,-145,-186,76;223,-377,-61,635,482,152,76,280]', + '[12,-62,256,-318,-301,163,517,676;-62,140,-179,192,722,422,-51,460;256,-179,865,256,-222,223,512,' + '-360;-318,192,256,-693,-478,-147,-717,-12;-301,722,-222,-478,356,-483,-401,58;163,422,223,-147,' + '-483,615,-348,208;517,-51,512,-717,-401,-348,-94,658;676,460,-360,-12,58,208,658,774]', + '[-482,-99,101,290,699,779,444,4;-99,-530,-619,805,-731,303,494,432;101,-619,35,-658,283,-201,776,' + '133;290,805,-658,149,-429,40,117,-153;699,-731,283,-429,501,-178,-100,457;779,303,-201,40,-178,795,' + '7,151;444,494,776,117,-100,7,790,-32;4,432,133,-153,457,151,-32,450]', + '[-102,-121,606,747,-445,650,-248,-322;-121,-324,623,449,-222,79,-5,284;606,623,638,-378,-312,306,' + '-624,223;747,449,-378,426,317,-322,-254,789;-445,-222,-312,317,80,-69,-729,-560;650,79,306,-322,' + '-69,-4,19,290;-248,-5,-624,-254,-729,19,-786,717;-322,284,223,789,-560,290,717,536]', + '[769,728,83,-893,-123,303,-727,73;728,2,44,-400,-118,-698,-106,462;83,44,611,395,-65,253,-311,' + '-104;-893,-400,395,-888,-445,221,-342,454;-123,-118,-65,-445,-498,-643,-461,396;303,-698,253,221,' + '-643,-309,-84,-275;-727,-106,-311,-342,-461,-84,-77,-83;73,462,-104,454,396,-275,-83,-915]', + '[-264,-34,-773,-380,-165,-238,-451,233;-34,411,276,-418,-599,-411,-329,-122;-773,276,-527,-522,' + '-863,-540,-534,-267;-380,-418,-522,-922,143,-219,-640,719;-165,-599,-863,143,-8,-426,-780,688;-238,' + '-411,-540,-219,-426,956,578,525;-451,-329,-534,-640,-780,578,-482,611;233,-122,-267,719,688,525,' + '611,-91]', + '[-727,-204,-407,561,715,523,97,403;-204,321,6,-311,-835,-57,-320,-651;-407,6,-734,328,-513,-315,' + '-684,467;561,-311,328,472,389,-406,158,144;715,-835,-513,389,-670,293,-288,243;523,-57,-315,-406,' + '293,-126,-424,3;97,-320,-684,158,-288,-424,-20,-409;403,-651,467,144,243,3,-409,-404]', + '[585,-649,-20,-788,-492,233,-3,-459;-649,592,-444,-52,108,-208,60,-471;-20,-444,-670,-284,112,-614,' + '437,-51;-788,-52,-284,-851,-380,-418,-83,313;-492,108,112,-380,659,484,-148,-851;233,-208,-614,' + '-418,484,-878,-229,-51;-3,60,437,-83,-148,-229,856,-48;-459,-471,-51,313,-851,-51,-48,-736]', + '[-632,792,-88,-409,-516,253,57,7;792,-950,26,-138,-687,-384,-321,221;-88,26,395,-111,124,78,-866,' + '9;-409,-138,-111,485,-381,-61,-227,-21;-516,-687,124,-381,-621,-608,-847,-447;253,-384,78,-61,-608,' + '-807,-31,289;57,-321,-866,-227,-847,-31,-293,1;7,221,9,-21,-447,289,1,537]', + '[-809,-182,-507,-173,66,-252,384,362;-182,973,76,-203,132,-386,-237,-167;-507,76,768,580,-290,-558,' + '479,-341;-173,-203,580,561,346,469,-259,55;66,132,-290,346,-992,-268,-890,-687;-252,-386,-558,469,' + '-268,770,382,-15;384,-237,479,-259,-890,382,735,-448;362,-167,-341,55,-687,-15,-448,-161]', + '[862,-108,755,-38,-596,137,-448,-350;-108,763,-551,-180,-255,-748,-630,298;755,-551,543,495,442,' + '833,91,-214;-38,-180,495,24,-157,-970,-101,-680;-596,-255,442,-157,468,-23,830,-133;137,-748,833,' + '-970,-23,-377,-425,67;-448,-630,91,-101,830,-425,-360,-172;-350,298,-214,-680,-133,67,-172,-555]', + '[445,-67,205,766,-107,-244,645,-225;-67,-335,16,578,-516,561,37,159;205,16,566,-155,79,35,336,' + '12;766,578,-155,-980,-589,-244,278,-707;-107,-516,79,-589,604,149,-175,487;-244,561,35,-244,149,' + '996,333,-445;645,37,336,278,-175,333,552,167;-225,159,12,-707,487,-445,167,-196]', + '[719,465,663,-460,488,254,289,543;465,696,-397,462,-45,-60,-52,-414;663,-397,-498,-795,-1,85,-641,' + '542;-460,462,-795,448,149,-162,-191,103;488,-45,-1,149,846,-310,151,-451;254,-60,85,-162,-310,-209,' + '329,-401;289,-52,-641,-191,151,329,523,-535;543,-414,542,103,-451,-401,-535,-482]', + '[686,168,490,158,-28,-255,-603,-335;168,81,80,586,-518,-173,-347,-52;490,80,681,-523,-47,726,175,' + '-173;158,586,-523,-623,633,-510,-341,240;-28,-518,-47,633,-244,6,163,680;-255,-173,726,-510,6,-38,' + '-308,536;-603,-347,175,-341,163,-308,373,-285;-335,-52,-173,240,680,536,-285,928]', + '[-645,493,252,544,490,-55,678,489;493,300,175,264,592,-118,-149,162;252,175,506,-71,-783,476,-311,' + '-383;544,264,-71,807,15,310,5,-54;490,592,-783,15,-208,-24,24,602;-55,-118,476,310,-24,-661,-438,' + '622;678,-149,-311,5,24,-438,-191,-717;489,162,-383,-54,602,622,-717,633]', + '[-649,492,-617,-501,436,492,68,420;492,-527,158,451,-751,-511,-27,362;-617,158,47,-742,287,-440,' + '-207,-633;-501,451,-742,60,3,591,-272,576;436,-751,287,3,987,171,-341,216;492,-511,-440,591,171,' + '754,-589,72;68,-27,-207,-272,-341,-589,-457,-540;420,362,-633,576,216,72,-540,-671]', + '[-987,-794,-212,262,437,361,75,10;-794,-864,54,258,-749,196,-740,559;-212,54,-981,347,117,-94,-148,' + '270;262,258,347,-102,186,251,-199,617;437,-749,117,186,308,-212,244,-56;361,196,-94,251,-212,630,' + '404,-369;75,-740,-148,-199,244,404,-236,-387;10,559,270,617,-56,-369,-387,216]', + '[460,-64,-595,-579,468,780,626,353;-64,-439,223,-29,-324,286,748,-228;-595,223,727,867,481,106,670,' + '90;-579,-29,867,120,-139,-151,35,144;468,-324,481,-139,-673,229,347,552;780,286,106,-151,229,319,' + '273,210;626,748,670,35,347,273,646,-330;353,-228,90,144,552,210,-330,-173]']] + + res = ['[2, 42762409]', '[3, 3617]', '[4, 5]', '[5, 43]', '[6, 31]', '[9, 5]', '[11, 7]', '[12, 3]', + '[13, 17]', '[14, 19]', '[15, 73]', '[16, 79]', '[17, 38287]', '[18, 3774601]', '[19, 7]', + '[20, 3]', '[21, 61]', '[22, 3]', '[23, 229]', '[24, 7]', '[25, 3]', '[27, 68196433]', + '[28, 2393]', '[29, 13]', '[30, 145963897]', '[31, 71]', '[33, 433]', '[34, 3]', '[35, 409]', + '[36, 3]', '[37, -1]', '[38, 11483]', '[41, 11]', '[44, -1]', '[45, 281]', '[46, 4363]', + '[47, -1]', '[48, 7]', '[49, 41]', '[52, 5965507]', '[53, 13]', '[56, 135319]', '[57, 2473301]', + '[58, 141613]', '[59, -1]', '[60, 109]', '[61, 3]', '[62, -1]', '[65, 5]', '[66, 13]', '[67, 11]', + '[68, 271]', '[69, 7]', '[70, 642419]', '[73, 29]', '[74, 1951]', '[76, 3]', '[77, -1]', '[78, 107]', + '[79, -1]', '[80, 48199741]', '[81, 89]', '[82, 11]', '[83, 157]', '[84, 197]', '[85, 5]', '[86, -1]', + '[87, -1]', '[88, 11]', '[89, 29]', '[90, 7]', '[91, -1]', '[92, 3]', '[93, 17]', '[94, 7]', + '[95, 3]', '[98, 31]', '[99, 19]', '[20, 2]', '[71, 2]', '[81, 2]', '[96, 2]', '[100, 2]'] + + def test(deb=0, fin=6): + k=0 + for i in range(deb, fin): + for j in range(0, 100): + Q = M[i][j]; + s = pari.qfsolve(Q); + if pari.type(s) == '"t_INT"': + self.assertEquals('[%d, %s]' % (j + 1, str(s)), res[k]) + k += 1 + test() + + G = '[1,0,0;0,1,0;0,0,-34]'; + self.assertEquals(pari.qfparam(G, pari.qfsolve(G)), '[-3, -10, 3; 5, -6, -5; -1, 0, -1]') + self.assertEquals(pari.qfparam(G, pari.qfsolve(G), 1), '[-3, 2, 11; 5, -26, 27; -1, 4, -5]') + self.assertEquals(pari.qfparam(G, pari.qfsolve(G), 2), '[-3, -16, -10; 5, 4, -6; -1, -2, -2]') + + self.assertEquals(pari.qfsolve(pari.Mat(0)), '[1]~') + self.assertEquals(pari.qfsolve(pari.Mat(1)), '-1') + self.assertEquals(pari.qfsolve('[1,2;2,1]'), '-2') + self.assertEquals(pari.qfsolve('[0,1;1,1]'), '[1, 0]~') + self.assertEquals(pari.qfsolve('[35, 46; 46, 60]'), '[-42, 35]~') + + self.assertEquals(pari.qfparam(pari.matdiagonal([1, 1, -1]), [1, 0, 1]), '[-1, 0, 1; 0, 2, 0; 1, 0, 1]') + self.assertEquals(pari.qfsolve(pari.matdiagonal([1, 1, -25])), '[0, 5, -1]~') + + self.assertEquals(pari.qfsolve('[1,0,0;0,3,0;0,0,-2]'), '3') + self.assertEquals(pari.qfparam('[0,0,-12;0,-12,0;-12,0,-1]', '[1,0,0]~', 3), '[-12, 0, -1; 0, 24, 0; 0, 0, 24]') + q = '[-1,-4,-8;-4,-15,-31;-8,-31,-62]/4'; + self.assertEquals(pari.qfparam(q, pari.qfsolve(q)), '[310, -62, 3; -62, 16, -1; -18, 2, 0]') + + # #1661 + with self.assertRaises(PariError) as context: + pari.qfsolve('[1,0,0;0,1,1;0,0,1]'); + self.assertTrue('incorrect type in qfsolve [not symmetric] (t_MAT)' in str(context.exception)) + + # #1725 + self.assertEquals(pari.qfsolve(pari.matdiagonal([1, 1, 1, 1, 1, 1, -7])), '[1, 1, -1, -2, 0, 0, -1]~') + +"""**** Original expected results **** + +dim=3 +[2, 42762409] +[3, 3617] +[4, 5] +[5, 43] +[6, 31] +[9, 5] +[11, 7] +[12, 3] +[13, 17] +[14, 19] +[15, 73] +[16, 79] +[17, 38287] +[18, 3774601] +[19, 7] +[20, 3] +[21, 61] +[22, 3] +[23, 229] +[24, 7] +[25, 3] +[27, 68196433] +[28, 2393] +[29, 13] +[30, 145963897] +[31, 71] +[33, 433] +[34, 3] +[35, 409] +[36, 3] +[37, -1] +[38, 11483] +[41, 11] +[44, -1] +[45, 281] +[46, 4363] +[47, -1] +[48, 7] +[49, 41] +[52, 5965507] +[53, 13] +[56, 135319] +[57, 2473301] +[58, 141613] +[59, -1] +[60, 109] +[61, 3] +[62, -1] +[65, 5] +[66, 13] +[67, 11] +[68, 271] +[69, 7] +[70, 642419] +[73, 29] +[74, 1951] +[76, 3] +[77, -1] +[78, 107] +[79, -1] +[80, 48199741] +[81, 89] +[82, 11] +[83, 157] +[84, 197] +[85, 5] +[86, -1] +[87, -1] +[88, 11] +[89, 29] +[90, 7] +[91, -1] +[92, 3] +[93, 17] +[94, 7] +[95, 3] +[98, 31] +[99, 19] +dim=4 +[20, 2] +[71, 2] +[81, 2] +[96, 2] +[100, 2] +dim=5 +dim=6 +dim=7 +dim=8 + +[-3 -10 3] + +[ 5 -6 -5] + +[-1 0 -1] + + +[-3 2 11] + +[ 5 -26 27] + +[-1 4 -5] + + +[-3 -16 -10] + +[ 5 4 -6] + +[-1 -2 -2] + +[1]~ +-1 +-2 +[1, 0]~ +[-42, 35]~ + +[-1 0 1] + +[ 0 2 0] + +[ 1 0 1] + +[0, 5, -1]~ +3 + +[-12 0 -1] + +[ 0 24 0] + +[ 0 0 24] + + +[310 -62 3] + +[-62 16 -1] + +[-18 2 0] + + *** at top-level: qfsolve([1,0,0;0,1,1 + *** ^-------------------- + *** qfsolve: incorrect type in qfsolve [not symmetric] (t_MAT). +[1, 1, -1, -2, 0, 0, -1]~ + +""" diff --git a/tests/unittests/set.py b/tests/unittests/set.py new file mode 100644 index 0000000..898747d --- /dev/null +++ b/tests/unittests/set.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file set : +Set(Vecsmall([1,2,1,3])) +Set(List([])) +L=List([1,3,1,2,3]); +Set(L) +listsort(L,1); L +Set(1) +a=Set([5,-2,7,3,5,1,x,"1"]) +b=Set([7,5,-5,7,2,"1"]) +setintersect(a,b) +setisset([-3,5,7,7]) +setisset(a) +setminus(a,b) +setsearch(a,3) +setsearch(a,"1") +setsearch(b,3) +setsearch(L,3) +setsearch(1,3) +setunion(a,b) +X = [1,2,3]; Y = [2,3,4]; +setbinop((x,y)->x+y, X,Y) +setbinop((x,y)->x+y, X) +setbinop(x->x, X) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestSet(unittest.TestCase): + def test_set(self): + self.assertEquals(pari.Set(pari.Vecsmall([1,2,1,3])), '[1, 2, 3]') + self.assertEquals(pari.Set(pari.List([])), '[]') + L=pari.List([1, 3, 1, 2, 3]); + self.assertEquals(pari.Set(L), '[1, 2, 3]') + pari.listsort(L, 1) + self.assertEquals(L, 'List([1, 2, 3])') + self.assertEquals(pari.Set(1), '[1]') + a = pari.Set([5, -2, 7, 3, 5, 1, 'x', '"1"']) + b = pari.Set([7, 5, -5, 7, 2, '"1"']) + self.assertEquals(str(a), '[-2, 1, 3, 5, 7, x, "1"]') + self.assertEquals(str(b), '[-5, 2, 5, 7, "1"]') + self.assertEquals(pari.setintersect(a, b), '[5, 7, "1"]') + self.assertEquals(str(pari.setisset([-3, 5, 7, 7])), '0') + self.assertEquals(str(pari.setisset(a)), '1') + self.assertEquals(pari.setminus(a, b), '[-2, 1, 3, x]') + self.assertEquals(str(pari.setsearch(a, 3)), '3') + self.assertEquals(str(pari.setsearch(a, '"1"')), '7') + self.assertEquals(str(pari.setsearch(b, 3)), '0') + self.assertEquals(str(pari.setsearch(L, 3)), '3') + with self.assertRaises(PariError) as context: + pari.setsearch(1, 3) + self.assertTrue('type in setsearch (t_INT)' in str(context.exception)) + self.assertEquals(pari.setunion(a, b), '[-5, -2, 1, 2, 3, 5, 7, x, "1"]') + + X = [1, 2, 3]; + Y = [2, 3, 4]; + pari.setbinop('(x,y)->x+y', X, Y) + pari.setbinop('(x,y)->x+y', X) + with self.assertRaises(PariError) as context: + pari.setbinop('x->x', X) + self.assertTrue('incorrect type in setbinop [function needs exactly 2 arguments] (t_CLOSURE)' in + str(context.exception)) + +"""**** Original expected results **** +[1, 2, 3] +[] +[1, 2, 3] +List([1, 2, 3]) +[1] +[-2, 1, 3, 5, 7, x, "1"] +[-5, 2, 5, 7, "1"] +[5, 7, "1"] +0 +1 +[-2, 1, 3, x] +3 +7 +0 +3 + *** at top-level: setsearch(1,3) + *** ^-------------- + *** setsearch: incorrect type in setsearch (t_INT). +[-5, -2, 1, 2, 3, 5, 7, x, "1"] +[3, 4, 5, 6, 7] +[2, 3, 4, 5, 6] + *** at top-level: setbinop(x->x,X) + *** ^---------------- + *** setbinop: incorrect type in setbinop [function needs exactly 2 arguments] (t_CLOSURE). +""" diff --git a/tests/unittests/subcyclo.py b/tests/unittests/subcyclo.py new file mode 100644 index 0000000..a14c015 --- /dev/null +++ b/tests/unittests/subcyclo.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +"""Original pari/GP test file subcyclo : +polsubcyclo(8,1) +polsubcyclo(1048,2) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestSubcyclo(unittest.TestCase): + def test_subcyclo(self): + self.assertEquals(pari.polsubcyclo(8,1), '[x - 1]') + self.assertEquals(pari.polsubcyclo(1048,2), '[x^2 + 2, x^2 + 262, x^2 - 262, x^2 - 2, x^2 - 131, x^2 + 1, x' + + '^2 + x + 33]') + +"""**** Original expected results **** + +x - 1 +[x^2 + 2, x^2 + 262, x^2 - 262, x^2 - 2, x^2 - 131, x^2 + 1, x^2 + x + 33] + +""" diff --git a/tests/unittests/sumdedekind.py b/tests/unittests/sumdedekind.py new file mode 100644 index 0000000..01497a8 --- /dev/null +++ b/tests/unittests/sumdedekind.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file sumdedekind : +sumdedekind(-2,-3) +sumdedekind(2, 4) +sumdedekind(123186,28913191) +sumdedekind(2^64+1, 2^65) +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestSumdedekind(unittest.TestCase): + def test_sumdedekind(self): + self.assertEquals(pari.sumdedekind(-2, -3), '-1/18') + self.assertEquals(pari.sumdedekind(2, 4), '0') + self.assertEquals(pari.sumdedekind(123186, 28913191), '1145846923/57826382') + self.assertEquals(pari.sumdedekind(int(pow(2, 64)) + 1, int(pow(2, 65))), + '56713727820156410558782357164918483627/73786976294838206464') + +"""**** Original expected results **** + +-1/18 +0 +1145846923/57826382 +56713727820156410558782357164918483627/73786976294838206464 + +""" diff --git a/tests/unittests/sumformal.py b/tests/unittests/sumformal.py new file mode 100644 index 0000000..c7cbd9a --- /dev/null +++ b/tests/unittests/sumformal.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file sumformal : +sumformal(1/n) +sumformal(0) +sumformal(1) +sumformal(n) +sumformal(n^2) +sumformal(x*y + 1) +sumformal(x*y + 1,y) +""" +import unittest +from cypari2 import Pari, PariError + +pari = Pari() + + +class TestSumformal(unittest.TestCase): + def test_sumformal(self): + with self.assertRaises(PariError) as context: + pari.sumformal('1/n') + self.assertTrue('incorrect type in sumformal [not a t_POL] (t_RFRAC)' in str(context.exception)) + self.assertEquals(pari.sumformal(0), '0') + self.assertEquals(pari.sumformal(1), 'x') + self.assertEquals(pari.sumformal('n'), '1/2*n^2 + 1/2*n') + self.assertEquals(pari.sumformal('n^2'), '1/3*n^3 + 1/2*n^2 + 1/6*n') + self.assertEquals(pari.sumformal('x*y + 1'), '1/2*y*x^2 + (1/2*y + 1)*x') + self.assertEquals(pari.sumformal('x*y + 1', 'y'), '(1/2*y^2 + 1/2*y)*x + y') + +"""**** Original expected results **** + + *** at top-level: sumformal(1/n) + *** ^-------------- + *** sumformal: incorrect type in sumformal [not a t_POL] (t_RFRAC). +0 +x +1/2*n^2 + 1/2*n +1/3*n^3 + 1/2*n^2 + 1/6*n +1/2*y*x^2 + (1/2*y + 1)*x +(1/2*y^2 + 1/2*y)*x + y + +""" diff --git a/tests/unittests/testutils.py b/tests/unittests/testutils.py new file mode 100644 index 0000000..1bc1835 --- /dev/null +++ b/tests/unittests/testutils.py @@ -0,0 +1,13 @@ +import sys + +if sys.version_info < (3, 0): + range = xrange + + +def primes(n): + """ Returns a list of primes < n """ + sieve = [True] * int(n / 2) + for i in range(3, int(n ** 0.5) + 1, 2): + if sieve[int(i / 2)]: + sieve[int(i * i / 2)::i] = [False] * int((n - i * i - 1) / (2 * i) + 1) + return [2] + [2 * i + 1 for i in range(1, int(n / 2)) if sieve[i]] diff --git a/tests/unittests/zeta.py b/tests/unittests/zeta.py new file mode 100644 index 0000000..e9dd849 --- /dev/null +++ b/tests/unittests/zeta.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# Created 09/26/2017 + +"""Original pari/GP test file zeta : +default(realprecision,38); +allocatemem(20*10^6); +zeta(3+O(5^10)) +zeta(1 + I/100) +zeta(1000.5) +zeta(1000) +zeta(100) +zeta(31) +zeta(100+100*I) +zeta(60+I) +zeta(-1000+I) +zeta(2+O(2^10)) +zeta(2^64) +zeta(-2^64) +iferr(zeta(-1-2^64),E,E) +zeta(2+1e-101*I) +zeta(1.01) +zeta(1e-32) +""" +import unittest +from cypari2 import Pari, PariError +from math import pow + +pari = Pari() + + +class TestZeta(unittest.TestCase): + def test_zeta(self): + pari.set_real_precision(38) + pari.allocatemem(2e7); + self.assertEquals(pari.zeta('3+O(5^10)'), '2*5^-1 + 2*5 + 3*5^2 + 3*5^4 + 3*5^5 + 2*5^6 + 5^7 + 4*5^8 + O(5^9)') + self.assertEquals(pari.zeta('1 + I/100', precision=128), + '0.57721614942066140874800424251188396262 - 99.999271841202858157138397118797159155*I') + self.assertEquals(pari.zeta('1000.5', precision=128), '1.0000000000000000000000000000000000000') + self.assertEquals(pari.zeta(1000, precision=128), '1.0000000000000000000000000000000000000') + self.assertEquals(str(pari.zeta(100, precision=128)), '1.0000000000000000000000000000007888609') + self.assertEquals(str(pari.zeta(31, precision=128)), '1.0000000004656629065033784072989233251') + self.assertEquals(str(pari.zeta('100+100*I', precision=128)), + '1.0000000000000000000000000000007731864 - 1.5647480679975229240431199238639049803 E-31*I') + self.assertEquals(str(pari.zeta('60+I', precision=128)), + '1.0000000000000000006672083904260744090 - 5.5421056315169138713580539141777567374 E-19*I') + self.assertEquals(str(pari.zeta('-1000+I', precision=128)), '-1.8236338315400224657144248914124703368 E1769 + ' + '6.8223788001755144705322033655798283436 E1768*I') + self.assertEquals(pari.zeta('2+O(2^10)', precision=128), '2^-1 + 1 + 2^2 + 2^3 + 2^5 + 2^6 + 2^7 + O(2^9)') + self.assertEquals(pari.zeta(pow(2, 64), precision=128), '1.0000000000000000000000000000000000000') + self.assertEquals(pari.zeta('-2^64', precision=128), '0.E-38') + + with self.assertRaises(PariError) as context: + pari.zeta('-1-2^64') + self.assertTrue('overflow in zeta [large negative argument]' in str(context.exception)) + + self.assertEquals(str(pari.zeta('2+1e-101*I', precision=128)), + '1.6449340668482264364724151666460251892 - 9.3754825431584375370257409456786497790 E-102*I') + self.assertEquals(str(pari.zeta('1.01', precision=128)), '100.57794333849687249028215428579024415') + self.assertEquals(str(pari.zeta('1e-32', precision=128)), '-0.50000000000000000000000000000000918939') + pari.set_real_precision(15) + +"""**** Original expected results **** + + *** Warning: new stack size = 20000000 (19.073 Mbytes). +2*5^-1 + 2*5 + 3*5^2 + 3*5^4 + 3*5^5 + 2*5^6 + 5^7 + 4*5^8 + O(5^9) +0.57721614942066140874800424251188396262 - 99.999271841202858157138397118797 +159155*I +1.0000000000000000000000000000000000000 +1.0000000000000000000000000000000000000 +1.0000000000000000000000000000007888609 +1.0000000004656629065033784072989233251 +1.0000000000000000000000000000007731864 - 1.56474806799752292404311992386390 +49803 E-31*I +1.0000000000000000006672083904260744090 - 5.54210563151691387135805391417775 +67374 E-19*I +-1.8236338315400224657144248914124703368 E1769 + 6.8223788001755144705322033 +655798283436 E1768*I +2^-1 + 1 + 2^2 + 2^3 + 2^5 + 2^6 + 2^7 + O(2^9) +1.0000000000000000000000000000000000000 +0.E-38 +error("overflow in zeta [large negative argument].") +1.6449340668482264364724151666460251892 - 9.37548254315843753702574094567864 +97790 E-102*I +100.57794333849687249028215428579024415 +-0.50000000000000000000000000000000918939 + +"""