Skip to content

Commit

Permalink
Shortcut method for polyPowMod with BigInteger exponent.
Browse files Browse the repository at this point in the history
  • Loading branch information
PoslavskySV committed Nov 20, 2017
1 parent 827328e commit d7b4c89
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,22 @@ public static <T extends IUnivariatePolynomial<T>> T polyPowMod(final T base, Bi
}
}

/**
* Returns {@code base} in a power of non-negative {@code exponent} modulo {@code polyModulus}
*
* @param base the base
* @param exponent the non-negative exponent
* @param polyModulus the modulus
* @param copy whether to clone {@code base}; if not the data of {@code base} will be lost
* @return {@code base} in a power of {@code e} modulo {@code polyModulus}
* @see UnivariateDivision#fastDivisionPreConditioning(IUnivariatePolynomial)
*/
public static <T extends IUnivariatePolynomial<T>> T polyPowMod(final T base, BigInteger exponent,
T polyModulus,
boolean copy) {
return polyPowMod(base, exponent, polyModulus, UnivariateDivision.fastDivisionPreConditioning(polyModulus), copy);
}

/** switch between plain and log2 algorithms */
private static final long MONOMIAL_MOD_EXPONENT_THRESHOLD = 64;

Expand Down

0 comments on commit d7b4c89

Please sign in to comment.