Package edu.jas.root
Class ComplexAlgebraicRing<C extends GcdRingElem<C> & Rational>
- java.lang.Object
-
- edu.jas.root.ComplexAlgebraicRing<C>
-
- All Implemented Interfaces:
AbelianGroupFactory<ComplexAlgebraicNumber<C>>,ElemFactory<ComplexAlgebraicNumber<C>>,MonoidFactory<ComplexAlgebraicNumber<C>>,RingFactory<ComplexAlgebraicNumber<C>>,java.io.Serializable
public class ComplexAlgebraicRing<C extends GcdRingElem<C> & Rational> extends java.lang.Object implements RingFactory<ComplexAlgebraicNumber<C>>
Complex algebraic number factory class based on AlgebraicNumberRing with RingFactory interface. Objects of this class are immutable with the exception of the isolating intervals.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description AlgebraicNumberRing<Complex<C>>algebraicRepresenting AlgebraicNumberRing.protected ComplexRootsSturm<C>engineComplex root computation engine.protected BigRationalepsEpsilon of the isolating rectangle for a complex root.static intPRECISIONPrecision of the isolating rectangle for a complex root.
-
Constructor Summary
Constructors Constructor Description ComplexAlgebraicRing(GenPolynomial<Complex<C>> m, Rectangle<C> root)The constructor creates a ComplexAlgebraicNumber factory object from a GenPolynomial objects module.ComplexAlgebraicRing(GenPolynomial<Complex<C>> m, Rectangle<C> root, boolean isField)The constructor creates a ComplexAlgebraicNumber factory object from a GenPolynomial objects module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigIntegercharacteristic()Characteristic of this ring.ComplexAlgebraicNumber<C>copy(ComplexAlgebraicNumber<C> c)Copy ComplexAlgebraicNumber element c.voidensureEngine()Ensure engine is initialized.booleanequals(java.lang.Object b)Comparison with any other object.ComplexAlgebraicNumber<C>fromInteger(long a)Get a ComplexAlgebraicNumber element from a long value.ComplexAlgebraicNumber<C>fromInteger(java.math.BigInteger a)Get a ComplexAlgebraicNumber element from a BigInteger value.java.util.List<ComplexAlgebraicNumber<C>>generators()Get a list of the generating elements.BigRationalgetEps()Get epsilon.ComplexAlgebraicNumber<C>getGenerator()Get the generating element.ComplexAlgebraicNumber<C>getIMAG()Get the i element.ComplexAlgebraicNumber<C>getONE()Get the one element.Rectangle<C>getRoot()Get rectangle for the complex root.ComplexAlgebraicNumber<C>getZERO()Get the zero element.inthashCode()Hash code for this ComplexAlgebraicNumber.booleanisAssociative()Query if this ring is associative.booleanisCommutative()Query if this ring is commutative.booleanisField()Query if this ring is a field.booleanisFinite()Is this structure finite or infinite.ComplexAlgebraicNumber<C>parse(java.io.Reader r)Parse ComplexAlgebraicNumber from Reader.ComplexAlgebraicNumber<C>parse(java.lang.String s)Parse ComplexAlgebraicNumber from String.ComplexAlgebraicNumber<C>random(int n)ComplexAlgebraicNumber random.ComplexAlgebraicNumber<C>random(int n, java.util.Random rnd)ComplexAlgebraicNumber random.voidrefineRoot()Refine root.voidrefineRoot(BigRational e)Refine root.voidsetEps(C e)Set a new epsilon.voidsetEps(BigRational e)Set a new epsilon.voidsetField(boolean isField)Assert that this ring is a field.voidsetRoot(Rectangle<C> v)Set a refined rectangle for the complex root.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoString()Get the String representation as RingFactory.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
-
-
-
-
Field Detail
-
algebraic
public final AlgebraicNumberRing<Complex<C extends GcdRingElem<C> & Rational>> algebraic
Representing AlgebraicNumberRing.
-
eps
protected BigRational eps
Epsilon of the isolating rectangle for a complex root.
-
PRECISION
public static final int PRECISION
Precision of the isolating rectangle for a complex root.
-
engine
protected ComplexRootsSturm<C extends GcdRingElem<C> & Rational> engine
Complex root computation engine.
-
-
Constructor Detail
-
ComplexAlgebraicRing
public ComplexAlgebraicRing(GenPolynomial<Complex<C>> m, Rectangle<C> root)
The constructor creates a ComplexAlgebraicNumber factory object from a GenPolynomial objects module.- Parameters:
m- module GenPolynomial<C>.root- isolating rectangle for a complex root.
-
ComplexAlgebraicRing
public ComplexAlgebraicRing(GenPolynomial<Complex<C>> m, Rectangle<C> root, boolean isField)
The constructor creates a ComplexAlgebraicNumber factory object from a GenPolynomial objects module.- Parameters:
m- module GenPolynomial<C>.root- isolating rectangle for a complex root.isField- indicator if m is prime.
-
-
Method Detail
-
setRoot
public void setRoot(Rectangle<C> v)
Set a refined rectangle for the complex root. Note: rectangle may shrink eventually.- Parameters:
v- rectangle.
-
getEps
public BigRational getEps()
Get epsilon.- Returns:
- epsilon.
-
setEps
public void setEps(BigRational e)
Set a new epsilon.- Parameters:
e- epsilon.
-
refineRoot
public void refineRoot()
Refine root.
-
ensureEngine
public void ensureEngine()
Ensure engine is initialized.
-
refineRoot
public void refineRoot(BigRational e)
Refine root.- Parameters:
e- epsilon.
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinitein interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
copy
public ComplexAlgebraicNumber<C> copy(ComplexAlgebraicNumber<C> c)
Copy ComplexAlgebraicNumber element c.- Specified by:
copyin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
c-- Returns:
- a copy of c.
-
getZERO
public ComplexAlgebraicNumber<C> getZERO()
Get the zero element.- Specified by:
getZEROin interfaceAbelianGroupFactory<C extends GcdRingElem<C> & Rational>- Returns:
- 0 as ComplexAlgebraicNumber.
-
getONE
public ComplexAlgebraicNumber<C> getONE()
Get the one element.- Specified by:
getONEin interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>- Returns:
- 1 as ComplexAlgebraicNumber.
-
getIMAG
public ComplexAlgebraicNumber<C> getIMAG()
Get the i element.- Returns:
- i as ComplexAlgebraicNumber.
-
getGenerator
public ComplexAlgebraicNumber<C> getGenerator()
Get the generating element.- Returns:
- alpha as ComplexAlgebraicNumber.
-
generators
public java.util.List<ComplexAlgebraicNumber<C>> generators()
Get a list of the generating elements.- Specified by:
generatorsin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutativein interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>- Returns:
- true if this ring is commutative, else false.
-
isAssociative
public boolean isAssociative()
Query if this ring is associative.- Specified by:
isAssociativein interfaceMonoidFactory<C extends GcdRingElem<C> & Rational>- Returns:
- true if this ring is associative, else false.
-
isField
public boolean isField()
Query if this ring is a field.- Specified by:
isFieldin interfaceRingFactory<C extends GcdRingElem<C> & Rational>- Returns:
- true if algebraic is prime, else false.
-
setField
public void setField(boolean isField)
Assert that this ring is a field.- Parameters:
isField- true if this ring is a field, else false.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristicin interfaceRingFactory<C extends GcdRingElem<C> & Rational>- Returns:
- characteristic of this ring.
-
fromInteger
public ComplexAlgebraicNumber<C> fromInteger(java.math.BigInteger a)
Get a ComplexAlgebraicNumber element from a BigInteger value.- Specified by:
fromIntegerin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
a- BigInteger.- Returns:
- a ComplexAlgebraicNumber.
-
fromInteger
public ComplexAlgebraicNumber<C> fromInteger(long a)
Get a ComplexAlgebraicNumber element from a long value.- Specified by:
fromIntegerin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
a- long.- Returns:
- a ComplexAlgebraicNumber.
-
toString
public java.lang.String toString()
Get the String representation as RingFactory.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
ElemFactory.toScript()
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this ComplexAlgebraicNumber.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
random
public ComplexAlgebraicNumber<C> random(int n)
ComplexAlgebraicNumber random.- Specified by:
randomin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
n- such that 0 ≤ v ≤ (2n-1).- Returns:
- a random integer mod modul.
-
random
public ComplexAlgebraicNumber<C> random(int n, java.util.Random rnd)
ComplexAlgebraicNumber random.- Specified by:
randomin interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
n- such that 0 ≤ v ≤ (2n-1).rnd- is a source for random bits.- Returns:
- a random integer mod modul.
-
parse
public ComplexAlgebraicNumber<C> parse(java.lang.String s)
Parse ComplexAlgebraicNumber from String.- Specified by:
parsein interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
s- String.- Returns:
- ComplexAlgebraicNumber from s.
-
parse
public ComplexAlgebraicNumber<C> parse(java.io.Reader r)
Parse ComplexAlgebraicNumber from Reader.- Specified by:
parsein interfaceElemFactory<C extends GcdRingElem<C> & Rational>- Parameters:
r- Reader.- Returns:
- next ComplexAlgebraicNumber from r.
-
-