001 /* 002 * $Id: IdealWithUniv.java 3637 2011-05-15 18:54:15Z kredel $ 003 */ 004 005 package edu.jas.application; 006 007 008 import java.io.Serializable; 009 import java.util.List; 010 011 import edu.jas.poly.GenPolynomial; 012 import edu.jas.structure.GcdRingElem; 013 014 015 /** 016 * Container for Ideals together with univariate polynomials. 017 * @author Heinz Kredel 018 */ 019 public class IdealWithUniv<C extends GcdRingElem<C>> implements Serializable { 020 021 022 /** 023 * The ideal. 024 */ 025 public final Ideal<C> ideal; 026 027 028 /** 029 * The list of univariate polynomials. 030 * Contains polynomials from serveral rings, depending on the stage of the decomposition. 031 * 1) polynomials in a ring of one variable, 032 * 2) polynomials depending on only one variable but in a ring with multiple variables, 033 * 3) after contraction to a non-zero dimensional ring multivariate polynomials depending on 034 * one significant variable and multiple variables from the quotient coefficients. 035 */ 036 public final List<GenPolynomial<C>> upolys; 037 038 039 /** 040 * A list of other useful polynomials. 041 * 1) field extension polynomials, 042 * 2) generators for infinite quotients. 043 */ 044 public final List<GenPolynomial<C>> others; 045 046 047 /** 048 * Constructor not for use. 049 */ 050 protected IdealWithUniv() { 051 throw new IllegalArgumentException("do not use this constructor"); 052 } 053 054 055 /** 056 * Constructor. 057 * @param id the ideal 058 * @param up the list of univariate polynomials 059 */ 060 protected IdealWithUniv(Ideal<C> id, List<GenPolynomial<C>> up) { 061 this(id, up, null); 062 } 063 064 065 /** 066 * Constructor. 067 * @param id the ideal 068 * @param up the list of univariate polynomials 069 * @param og the list of other polynomials 070 */ 071 protected IdealWithUniv(Ideal<C> id, List<GenPolynomial<C>> up, List<GenPolynomial<C>> og) { 072 ideal = id; 073 upolys = up; 074 others = og; 075 } 076 077 078 /** 079 * String representation of the ideal. 080 * @see java.lang.Object#toString() 081 */ 082 @Override 083 public String toString() { 084 String s = ideal.toString(); 085 if ( upolys != null ) { 086 s += "\nunivariate polynomials:\n" + upolys.toString(); 087 } 088 if (others == null) { 089 return s; 090 } else { 091 return s + "\nother polynomials:\n" + others.toString(); 092 } 093 } 094 095 096 /** 097 * Get a scripting compatible string representation. 098 * @return script compatible representation for this Element. 099 * @see edu.jas.structure.Element#toScript() 100 */ 101 public String toScript() { 102 // Python case 103 String s = ideal.toScript(); 104 if ( upolys != null ) { 105 s += ", upolys=" + upolys.toString(); 106 } 107 if (others == null) { 108 return s; 109 } else { 110 return s + ", others=" + others.toString(); 111 } 112 } 113 114 }