001/*
002 * $Id$
003 */
004
005package edu.jas.ufd;
006
007
008import java.io.Serializable;
009import java.util.List;
010import java.util.SortedMap;
011
012import edu.jas.poly.GenPolynomial;
013import edu.jas.structure.GcdRingElem;
014
015
016/**
017 * Squarefree decomposition interface.
018 * <p>
019 * <b>Usage:</b> To create objects that implement the <code>Squarefree</code>
020 * interface use the <code>SquarefreeFactory</code>. It will select an
021 * appropriate implementation based on the types of polynomial coefficients C.
022 * To obtain an implementation use <code>getImplementation()</code>, it returns
023 * an object of a class which extends the <code>SquarefreeAbstract</code> class
024 * which implements the <code>Squarefree</code> interface.
025 * <p>
026 * 
027 * <pre>
028 * Squarefree&lt;CT&gt; engine;
029 * engine = SquarefreeFactory.&lt;CT&gt; getImplementation(cofac);
030 * c = engine.squarefreeFactors(a);
031 * </pre>
032 * 
033 * <p>
034 * For example, if the coefficient type is BigInteger, the usage looks like
035 * 
036 * <p>
037 * 
038 * <pre>
039 * BigInteger cofac = new BigInteger();
040 * Squarefree&lt;BigInteger&gt; engine;
041 * engine = SquarefreeFactory.getImplementation(cofac);
042 * Sm = engine.sqaurefreeFactors(poly);
043 * </pre>
044 * 
045 * @author Heinz Kredel
046 * @see edu.jas.ufd.SquarefreeFactory#getImplementation
047 */
048
049public interface Squarefree<C extends GcdRingElem<C>> extends Serializable {
050
051
052    /**
053     * GenPolynomial greatest squarefree divisor.
054     * @param P GenPolynomial.
055     * @return squarefree(pp(P)).
056     */
057    public GenPolynomial<C> squarefreePart(GenPolynomial<C> P);
058
059
060    /**
061     * GenPolynomial test if is squarefree.
062     * @param P GenPolynomial.
063     * @return true if P is squarefree, else false.
064     */
065    public boolean isSquarefree(GenPolynomial<C> P);
066
067
068    /**
069     * GenPolynomial list test if squarefree.
070     * @param L list of GenPolynomial.
071     * @return true if each P in L is squarefree, else false.
072     */
073    public boolean isSquarefree(List<GenPolynomial<C>> L);
074
075
076    /**
077     * GenPolynomial squarefree factorization.
078     * @param P GenPolynomial.
079     * @return [p_1 -&gt; e_1, ..., p_k -&gt; e_k] with P = prod_{i=1,...,k}
080     *         p_i^{e_i} and p_i squarefree.
081     */
082    public SortedMap<GenPolynomial<C>, Long> squarefreeFactors(GenPolynomial<C> P);
083
084
085    /**
086     * GenPolynomial is (squarefree) factorization.
087     * @param P GenPolynomial.
088     * @param F = [p_1,...,p_k].
089     * @return true if P = prod_{i=1,...,r} p_i, else false.
090     */
091    public boolean isFactorization(GenPolynomial<C> P, List<GenPolynomial<C>> F);
092
093
094    /**
095     * GenPolynomial is (squarefree) factorization.
096     * @param P GenPolynomial.
097     * @param F = [p_1 -&gt; e_1, ..., p_k -&gt; e_k].
098     * @return true if P = prod_{i=1,...,k} p_i**e_i, else false.
099     */
100    public boolean isFactorization(GenPolynomial<C> P, SortedMap<GenPolynomial<C>, Long> F);
101
102
103    /**
104     * GenPolynomial squarefree and co-prime list.
105     * @param A list of GenPolynomials.
106     * @return B with gcd(b,c) = 1 for all b != c in B and for all non-constant
107     *         a in A there exists b in B with b|a and each b in B is
108     *         squarefree. B does not contain zero or constant polynomials.
109     */
110    public List<GenPolynomial<C>> coPrimeSquarefree(List<GenPolynomial<C>> A);
111
112
113    /**
114     * GenPolynomial squarefree and co-prime list.
115     * @param a polynomial.
116     * @param P squarefree co-prime list of GenPolynomials.
117     * @return B with gcd(b,c) = 1 for all b != c in B and for non-constant a
118     *         there exists b in P with b|a. B does not contain zero or constant
119     *         polynomials.
120     */
121    public List<GenPolynomial<C>> coPrimeSquarefree(GenPolynomial<C> a, List<GenPolynomial<C>> P);
122
123
124    /**
125     * Test if list of GenPolynomials is squarefree and co-prime.
126     * @param B list of GenPolynomials.
127     * @return true, if for all b != c in B gcd(b,c) = 1 and each b in B is
128     *         squarefree, else false.
129     */
130    public boolean isCoPrimeSquarefree(List<GenPolynomial<C>> B);
131
132}