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);
        }
Пример #2
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!");
            }
        }