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