edu.jas.structure
Class Power<C extends RingElem<C>>

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

public class Power<C extends RingElem<C>>
extends java.lang.Object

Power class to compute powers of RingElem.

Author:
Heinz Kredel

Constructor Summary
Power()
          The constructor creates a Power object.
Power(RingFactory<C> fac)
          The constructor creates a Power object.
 
Method Summary
static
<C extends RingElem<C>>
long
logarithm(C p, C a)
          Logarithm.
static
<C extends RingElem<C>>
C
modPositivePower(C a, long n, C m)
          power of a to the n-th, n positive, modulo m.
 C modPower(C a, java.math.BigInteger n, C m)
          power of a to the n-th mod m.
 C modPower(C a, long n, C m)
          power of a to the n-th mod m.
static
<C extends MonoidElem<C>>
C
modPower(MonoidFactory<C> fac, C a, java.math.BigInteger n, C m)
          power of a to the n-th modulo m.
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.
static
<C extends MonoidElem<C>>
C
multiply(MonoidFactory<C> fac, java.util.List<C> A)
          Multiply elements in list.
static
<C extends RingElem<C>>
C
multiply(RingFactory<C> fac, java.util.List<C> A)
          Multiply elements in list.
static
<C extends RingElem<C>>
C
positivePower(C a, java.math.BigInteger n)
          power of a to the n-th, n positive.
static
<C extends RingElem<C>>
C
positivePower(C a, long n)
          power of a to the n-th, n positive.
 C power(C a, long n)
          power of a to the n-th.
static
<C extends MonoidElem<C>>
C
power(MonoidFactory<C> fac, C a, long n)
          power of a to the n-th.
static
<C extends RingElem<C>>
C
power(RingFactory<C> fac, C a, long n)
          power of a to the n-th.
static
<C extends AbelianGroupElem<C>>
C
sum(AbelianGroupFactory<C> fac, java.util.List<C> A)
          Sum elements in list.
static
<C extends RingElem<C>>
C
sum(RingFactory<C> fac, java.util.List<C> A)
          Sum elements in list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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,
                                                      java.math.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.

power

public static <C extends RingElem<C>> C power(RingFactory<C> fac,
                                              C a,
                                              long n)
power of a to the n-th.

Parameters:
a - element.
n - integer exponent.
fac - ring factory.
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:
a - element.
n - integer exponent.
fac - monoid factory.
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:
a - element.
n - integer exponent.
m - modulus.
fac - monoid factory.
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,
                                                   java.math.BigInteger n,
                                                   C m)
power of a to the n-th modulo m.

Parameters:
a - element.
n - integer exponent.
m - modulus.
fac - monoid factory.
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.

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,
                  java.math.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 ≥ b.

multiply

public static <C extends RingElem<C>> C multiply(RingFactory<C> fac,
                                                 java.util.List<C> A)
Multiply elements in list.

Parameters:
A - list of elements (a_0,...,a_k).
fac - ring factory.
Returns:
prod(i=0,...k) a_i.

multiply

public static <C extends MonoidElem<C>> C multiply(MonoidFactory<C> fac,
                                                   java.util.List<C> A)
Multiply elements in list.

Parameters:
A - list of elements (a_0,...,a_k).
fac - monoid factory.
Returns:
prod(i=0,...k) a_i.

sum

public static <C extends RingElem<C>> C sum(RingFactory<C> fac,
                                            java.util.List<C> A)
Sum elements in list.

Parameters:
A - list of elements (a_0,...,a_k).
fac - ring factory.
Returns:
sum(i=0,...k) a_i.

sum

public static <C extends AbelianGroupElem<C>> C sum(AbelianGroupFactory<C> fac,
                                                    java.util.List<C> A)
Sum elements in list.

Parameters:
A - list of elements (a_0,...,a_k).
fac - monoid factory.
Returns:
sum(i=0,...k) a_i.