|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.jas.ufd.GCDFactory
public class GCDFactory
Greatest common divisor algorithms factory. Select appropriate GCD engine based on the coefficient types.
GreatestCommonDivisor.gcd(edu.jas.poly.GenPolynomial P,
edu.jas.poly.GenPolynomial S)
GreatestCommonDivisor
interface use the
GCDFactory
. It will select an appropriate implementation
based on the types of polynomial coefficients C. There are two methods
to obtain an implementation: getProxy()
and
getImplementation()
. getImplementation()
returns an object of a class which implements the
GreatestCommonDivisor
interface. getProxy()
returns a proxy object of a class which implements the
GreatestCommonDivisor
r interface. The proxy will run two
implementations in parallel, return the first computed result and
cancel the second running task. On systems with one CPU the computing
time will be two times the time of the fastest algorithm
implmentation. On systems with more than two CPUs the computing time
will be the time of the fastest algorithm implmentation.
GreatestCommonDivisor<CT> engine; engine = GCDFactory.<CT> getImplementation(cofac); or engine = GCDFactory.<CT> getProxy(cofac); c = engine.gcd(a, b);For example, if the coefficient type is BigInteger, the usage looks like
BigInteger cofac = new BigInteger(); GreatestCommonDivisor<BigInteger> engine; engine = GCDFactory.getImplementation(cofac); or engine = GCDFactory.getProxy(cofac); c = engine.gcd(a, b);
Constructor Summary | |
---|---|
protected |
GCDFactory()
Protected factory constructor. |
Method Summary | ||
---|---|---|
static GreatestCommonDivisorAbstract<BigInteger> |
getImplementation(BigInteger fac)
Determine suitable implementation of gcd algorithms, case BigInteger. |
|
static GreatestCommonDivisorAbstract<BigRational> |
getImplementation(BigRational fac)
Determine suitable implementation of gcd algorithms, case BigRational. |
|
static GreatestCommonDivisorAbstract<ModInteger> |
getImplementation(ModIntegerRing fac)
Determine suitable implementation of gcd algorithms, case ModInteger. |
|
static GreatestCommonDivisorAbstract<ModLong> |
getImplementation(ModLongRing fac)
Determine suitable implementation of gcd algorithms, case ModLong. |
|
static
|
getImplementation(RingFactory<C> fac)
Determine suitable implementation of gcd algorithms, other cases. |
|
static GreatestCommonDivisorAbstract<BigInteger> |
getProxy(BigInteger fac)
Determine suitable procy for gcd algorithms, case BigInteger. |
|
static GreatestCommonDivisorAbstract<BigRational> |
getProxy(BigRational fac)
Determine suitable proxy for gcd algorithms, case BigRational. |
|
static GreatestCommonDivisorAbstract<ModInteger> |
getProxy(ModIntegerRing fac)
Determine suitable proxy for gcd algorithms, case ModInteger. |
|
static GreatestCommonDivisorAbstract<ModLong> |
getProxy(ModLongRing fac)
Determine suitable proxy for gcd algorithms, case ModLong. |
|
static
|
getProxy(RingFactory<C> fac)
Determine suitable proxy for gcd algorithms, other cases. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected GCDFactory()
Method Detail |
---|
public static GreatestCommonDivisorAbstract<ModLong> getImplementation(ModLongRing fac)
fac
- ModLongRing.
public static GreatestCommonDivisorAbstract<ModLong> getProxy(ModLongRing fac)
fac
- ModLongRing.
public static GreatestCommonDivisorAbstract<ModInteger> getImplementation(ModIntegerRing fac)
fac
- ModIntegerRing.
public static GreatestCommonDivisorAbstract<ModInteger> getProxy(ModIntegerRing fac)
fac
- ModIntegerRing.
public static GreatestCommonDivisorAbstract<BigInteger> getImplementation(BigInteger fac)
fac
- BigInteger.
public static GreatestCommonDivisorAbstract<BigInteger> getProxy(BigInteger fac)
fac
- BigInteger.
public static GreatestCommonDivisorAbstract<BigRational> getImplementation(BigRational fac)
fac
- BigRational.
public static GreatestCommonDivisorAbstract<BigRational> getProxy(BigRational fac)
fac
- BigRational.
public static <C extends GcdRingElem<C>> GreatestCommonDivisorAbstract<C> getImplementation(RingFactory<C> fac)
fac
- RingFactory<C>.
public static <C extends GcdRingElem<C>> GreatestCommonDivisorAbstract<C> getProxy(RingFactory<C> fac)
fac
- RingFactory<C>.
ComputerThreads.NO_THREADS
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |