public void testToIntegerPolynomial()
        {
            int[]           coeffs = new int[] { 2, 0, 3, 1, 1, 5, 1, 4 };
            LongPolynomial5 p      = new LongPolynomial5(new IntegerPolynomial(coeffs));

            Assert.True(coeffs.SequenceEqual(p.ToIntegerPolynomial().coeffs));
        }
Example #2
0
        private void ToIntegerPolynomial()
        {
            int[]           coeffs = new int[] { 2, 0, 3, 1, 1, 5, 1, 4 };
            LongPolynomial5 p      = new LongPolynomial5(new IntegerPolynomial(coeffs));

            if (!Compare.AreEqual(coeffs, p.ToIntegerPolynomial().Coeffs))
            {
                throw new Exception("LongPolynomial5 multiply test failed!");
            }
        }
        private void testMult(int[] coeffs1, int[] coeffs2)
        {
            IntegerPolynomial i1 = new IntegerPolynomial(coeffs1);
            IntegerPolynomial i2 = new IntegerPolynomial(coeffs2);

            LongPolynomial5        a  = new LongPolynomial5(i1);
            DenseTernaryPolynomial b  = new DenseTernaryPolynomial(i2);
            IntegerPolynomial      c1 = i1.Multiply(i2, 2048);
            IntegerPolynomial      c2 = a.Multiply(b).ToIntegerPolynomial();

            assertEqualsMod(c1.coeffs, c2.coeffs, 2048);
        }
Example #4
0
        private void MultTest(int[] coeffs1, int[] coeffs2)
        {
            IntegerPolynomial      i1 = new IntegerPolynomial(coeffs1);
            IntegerPolynomial      i2 = new IntegerPolynomial(coeffs2);
            LongPolynomial5        a  = new LongPolynomial5(i1);
            DenseTernaryPolynomial b  = new DenseTernaryPolynomial(i2);
            IntegerPolynomial      c1 = i1.Multiply(i2, 2048);
            IntegerPolynomial      c2 = a.Multiply(b).ToIntegerPolynomial();

            if (!EqualsMod(c1.Coeffs, c2.Coeffs, 2048))
            {
                throw new Exception("LongPolynomial5 multiply test failed!");
            }
        }