示例#1
0
        /// <summary>
        /// Multiplies the polynomial with another, taking the values mod modulus and the indices mod N
        /// </summary>
        ///
        /// <param name="Factor">The polynomial factor</param>
        /// <param name="Modulus">The Modulus</param>
        ///
        /// <returns>Multiplied polynomial</returns>
        public IntegerPolynomial Multiply(IntegerPolynomial Factor, int Modulus)
        {
            // even on 32-bit systems, LongPolynomial5 multiplies faster than IntegerPolynomial
            if (Modulus == 2048)
            {
                IntegerPolynomial poly2Pos = Factor.Clone();
                poly2Pos.ModPositive(2048);
                LongPolynomial5 poly5 = new LongPolynomial5(poly2Pos);

                return(poly5.Multiply(this).ToIntegerPolynomial());
            }
            else
            {
                return(base.Multiply(Factor, Modulus));
            }
        }
示例#2
0
        /// <summary>
        /// Multiplies the polynomial with another, taking the values mod modulus and the indices mod N
        /// </summary>
        /// 
        /// <param name="Factor">The polynomial factor</param>
        /// <param name="Modulus">The Modulus</param>
        /// 
        /// <returns>Multiplied polynomial</returns>
        public IntegerPolynomial Multiply(IntegerPolynomial Factor, int Modulus)
        {
            // even on 32-bit systems, LongPolynomial5 multiplies faster than IntegerPolynomial
            if (Modulus == 2048)
            {
                IntegerPolynomial poly2Pos = Factor.Clone();
                poly2Pos.ModPositive(2048);
                LongPolynomial5 poly5 = new LongPolynomial5(poly2Pos);

                return poly5.Multiply(this).ToIntegerPolynomial();
            }
            else
            {
                return base.Multiply(Factor, Modulus);
            }
        }