Class Power<C extends RingElem<C>>

java.lang.Object
edu.jas.structure.Power<C>

public class Power<C extends RingElem<C>> extends Object
Power class to compute powers of RingElem.
  • Field Details

    • logger

      private static final org.apache.logging.log4j.Logger logger
    • debug

      private static final boolean debug
    • fac

      private final RingFactory<C extends RingElem<C>> fac
  • Constructor Details

    • Power

      public Power()
      The constructor creates a Power object.
    • Power

      public Power(RingFactory<C> fac)
      The constructor creates a Power object.
      Parameters:
      fac - ring factory
  • Method Details

    • positivePower

      public static <C extends RingElem<C>> C positivePower(C a, long n)
      power of a to the n-th, n positive.
      Parameters:
      a - element.
      n - integer exponent ≥ 0.
      Returns:
      a^n.
    • positivePower

      public static <C extends RingElem<C>> C positivePower(C a, BigInteger n)
      power of a to the n-th, n positive.
      Parameters:
      a - element.
      n - java.math.BigInteger exponent ≥ 0.
      Returns:
      a^n.
    • modPositivePower

      public static <C extends RingElem<C>> C modPositivePower(C a, long n, C m)
      power of a to the n-th, n positive, modulo m.
      Parameters:
      a - element.
      n - integer exponent ≥ 0.
      m - modulus.
      Returns:
      a^n mod m.
    • modPositivePower

      public static <C extends RingElem<C>> C modPositivePower(C a, BigInteger n, C m)
      power of a to the n-th, n positive, modulo m.
      Parameters:
      a - element.
      n - big integer exponent ≥ 0.
      m - modulus.
      Returns:
      a^n mod m.
    • power

      public static <C extends RingElem<C>> C power(RingFactory<C> fac, C a, long n)
      power of a to the n-th.
      Parameters:
      fac - ring factory.
      a - element.
      n - integer exponent.
      Returns:
      a^n, with 0^0 = 0 and a^{-n} = {1/a}^n.
    • power

      public static <C extends MonoidElem<C>> C power(MonoidFactory<C> fac, C a, long n)
      power of a to the n-th.
      Parameters:
      fac - monoid factory.
      a - element.
      n - integer exponent.
      Returns:
      a^n, with a^{-n} = {1/a}^n.
    • modPower

      public static <C extends MonoidElem<C>> C modPower(MonoidFactory<C> fac, C a, long n, C m)
      power of a to the n-th modulo m.
      Parameters:
      fac - monoid factory.
      a - element.
      n - integer exponent.
      m - modulus.
      Returns:
      a^n mod m, with a^{-n} = {1/a}^n.
    • modPower

      public static <C extends MonoidElem<C>> C modPower(MonoidFactory<C> fac, C a, BigInteger n, C m)
      power of a to the n-th modulo m.
      Parameters:
      fac - monoid factory.
      a - element.
      n - integer exponent.
      m - modulus.
      Returns:
      a^n mod m, with a^{-n} = {1/a}^n.
    • power

      public C power(C a, long n)
      power of a to the n-th.
      Parameters:
      a - element.
      n - integer exponent.
      Returns:
      a^n, with 0^0 = 0.
    • power

      public static long power(long a, long n)
      power of a to the n-th.
      Parameters:
      a - long.
      n - integer exponent.
      Returns:
      a^n, with a^0 = 1.
    • modPower

      public C modPower(C a, long n, C m)
      power of a to the n-th mod m.
      Parameters:
      a - element.
      n - integer exponent.
      m - modulus.
      Returns:
      a^n mod m, with 0^0 = 0.
    • modPower

      public C modPower(C a, BigInteger n, C m)
      power of a to the n-th mod m.
      Parameters:
      a - element.
      n - integer exponent.
      m - modulus.
      Returns:
      a^n mod m, with 0^0 = 0.
    • logarithm

      public static <C extends RingElem<C>> long logarithm(C p, C a)
      Logarithm.
      Parameters:
      p - logarithm base.
      a - element.
      Returns:
      k ≥ 1 minimal with p^k ≥ a.
    • logarithm

      public static <C extends RingElem<C>> long logarithm(long p, long a)
      Logarithm.
      Parameters:
      p - logarithm base.
      a - element.
      Returns:
      k ≥ 1 minimal with p^k ≥ a.
    • multiply

      public static <C extends RingElem<C>> C multiply(RingFactory<C> fac, List<C> A)
      Multiply elements in list.
      Parameters:
      fac - ring factory.
      A - list of elements (a_0,...,a_k).
      Returns:
      prod(i=0,...k) a_i.
    • multiply

      public static <C extends MonoidElem<C>> C multiply(MonoidFactory<C> fac, List<C> A)
      Multiply elements in list.
      Parameters:
      fac - monoid factory.
      A - list of elements (a_0,...,a_k).
      Returns:
      prod(i=0,...k) a_i.
    • sum

      public static <C extends RingElem<C>> C sum(RingFactory<C> fac, List<C> A)
      Sum elements in list.
      Parameters:
      fac - ring factory.
      A - list of elements (a_0,...,a_k).
      Returns:
      sum(i=0,...k) a_i.
    • sum

      public static <C extends AbelianGroupElem<C>> C sum(AbelianGroupFactory<C> fac, List<C> A)
      Sum elements in list.
      Parameters:
      fac - monoid factory.
      A - list of elements (a_0,...,a_k).
      Returns:
      sum(i=0,...k) a_i.