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