Package edu.jas.poly

Class AlgebraicNumberRing<C extends RingElem<C>>

    • Field Detail

      • isField

        protected int isField
        Indicator if this ring is a field
      • logger

        private static final org.apache.logging.log4j.Logger logger
    • Constructor Detail

      • AlgebraicNumberRing

        public AlgebraicNumberRing​(GenPolynomial<C> m)
        The constructor creates a AlgebraicNumber factory object from a GenPolynomial objects module.
        Parameters:
        m - module GenPolynomial.
      • AlgebraicNumberRing

        public AlgebraicNumberRing​(GenPolynomial<C> m,
                                   boolean isField)
        The constructor creates a AlgebraicNumber factory object from a GenPolynomial objects module.
        Parameters:
        m - module GenPolynomial.
        isField - indicator if m is prime.
    • Method Detail

      • getModul

        public GenPolynomial<C> getModul()
        Get the module part.
        Returns:
        modul.
      • getGenerator

        public AlgebraicNumber<C> getGenerator()
        Get the generating element.
        Returns:
        alpha as AlgebraicNumber.
      • isCommutative

        public boolean isCommutative()
        Query if this ring is commutative.
        Specified by:
        isCommutative in interface MonoidFactory<C extends RingElem<C>>
        Returns:
        true if this ring is commutative, else false.
      • isAssociative

        public boolean isAssociative()
        Query if this ring is associative.
        Specified by:
        isAssociative in interface MonoidFactory<C extends RingElem<C>>
        Returns:
        true if this ring is associative, else false.
      • isField

        public boolean isField()
        Query if this ring is a field.
        Specified by:
        isField in interface RingFactory<C extends RingElem<C>>
        Returns:
        true if modul is prime, else false.
      • setField

        public void setField​(boolean field)
        Set field property of this ring.
        Parameters:
        field - true, if this ring is determined to be a field, false, if it is determined that it is not a field.
      • getField

        public int getField()
        Get the internal field indicator.
        Returns:
        internal field indicator.
      • characteristic

        public java.math.BigInteger characteristic()
        Characteristic of this ring.
        Specified by:
        characteristic in interface RingFactory<C extends RingElem<C>>
        Returns:
        characteristic of this ring.
      • fillFromInteger

        public AlgebraicNumber<C> fillFromInteger​(java.math.BigInteger a)
        Get an AlgebraicNumber element from a BigInteger value. If a = a_k p^k + ... + a_0 p^0 then b = a_k x^k + ... + a_0 x^0, where p = characteristic( this ).
        Parameters:
        a - BigInteger.
        Returns:
        b an AlgebraicNumber.
      • fillFromInteger

        public AlgebraicNumber<C> fillFromInteger​(long a)
        Get a AlgebraicNumber element from a long value.
        Parameters:
        a - long.
        Returns:
        a AlgebraicNumber.
      • fromInteger

        public AlgebraicNumber<C> fromInteger​(java.math.BigInteger a)
        Get a AlgebraicNumber element from a BigInteger value.
        Specified by:
        fromInteger in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        a - BigInteger.
        Returns:
        a AlgebraicNumber.
      • fromInteger

        public AlgebraicNumber<C> fromInteger​(long a)
        Get a AlgebraicNumber element from a long value.
        Specified by:
        fromInteger in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        a - long.
        Returns:
        a AlgebraicNumber.
      • toString

        public java.lang.String toString()
        Get the String representation as RingFactory.
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • toScript

        public java.lang.String toScript()
        Get a scripting compatible string representation.
        Specified by:
        toScript in interface ElemFactory<C extends RingElem<C>>
        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:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Hash code for this AlgebraicNumber.
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • random

        public AlgebraicNumber<C> random​(int n)
        AlgebraicNumber random.
        Specified by:
        random in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        n - such that 0 ≤ v ≤ (2n-1).
        Returns:
        a random integer mod modul.
      • random

        public AlgebraicNumber<C> random​(int n,
                                         java.util.Random rnd)
        AlgebraicNumber random.
        Specified by:
        random in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        n - such that 0 ≤ v ≤ (2n-1).
        rnd - is a source for random bits.
        Returns:
        a random integer mod modul.
      • parse

        public AlgebraicNumber<C> parse​(java.lang.String s)
        Parse AlgebraicNumber from String.
        Specified by:
        parse in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        s - String.
        Returns:
        AlgebraicNumber from s.
      • parse

        public AlgebraicNumber<C> parse​(java.io.Reader r)
        Parse AlgebraicNumber from Reader.
        Specified by:
        parse in interface ElemFactory<C extends RingElem<C>>
        Parameters:
        r - Reader.
        Returns:
        next AlgebraicNumber from r.
      • chineseRemainder

        public AlgebraicNumber<C> chineseRemainder​(AlgebraicNumber<C> c,
                                                   AlgebraicNumber<C> ci,
                                                   AlgebraicNumber<C> a)
        AlgebraicNumber chinese remainder algorithm. Assert deg(c.modul) ≥ deg(a.modul) and c.modul * a.modul = this.modul.
        Parameters:
        c - AlgebraicNumber.
        ci - inverse of c.modul in ring of a.
        a - other AlgebraicNumber.
        Returns:
        S, with S mod c.modul == c and S mod a.modul == a.
      • interpolate

        public AlgebraicNumber<C> interpolate​(AlgebraicNumber<C> c,
                                              C ci,
                                              C am,
                                              C a)
        AlgebraicNumber interpolation algorithm. Assert deg(c.modul) ≥ deg(A.modul) and c.modul * A.modul = this.modul. Special case with deg(A.modul) == 1. Similar algorithm as chinese remainder algorithm.
        Parameters:
        c - AlgebraicNumber.
        ci - inverse of (c.modul)(a) in ring of A.
        am - trailing base coefficient of modul of other AlgebraicNumber A.
        a - value of other AlgebraicNumber A.
        Returns:
        S, with S(c) == c and S(A) == a.
      • depth

        public int depth()
        Depth of extension field tower.
        Returns:
        number of nested algebraic extension fields
      • extensionDegree

        public long extensionDegree()
        Degree of extension field.
        Returns:
        degree of this algebraic extension field
      • totalExtensionDegree

        public long totalExtensionDegree()
        Total degree of nested extension fields.
        Returns:
        degree of tower of algebraic extension fields
      • iterator

        public java.util.Iterator<AlgebraicNumber<C>> iterator()
        Get a AlgebraicNumber iterator. Note: Only for finite field coefficients or fields which are iterable.
        Specified by:
        iterator in interface java.lang.Iterable<C extends RingElem<C>>
        Returns:
        a iterator over all algebraic numbers in this ring.