cc.redberry.rings

## Class Integers

• ### Field Summary

Fields
Modifier and Type Field and Description
`static Integers` `Integers`
The ring of integers (Z)
• ### Method Summary

All Methods
Modifier and Type Method and Description
`BigInteger` `abs(BigInteger el)`
Returns the abs value of element (no copy)
`BigInteger` ```add(BigInteger a, BigInteger b)```
`BigInteger` ```binomial(long n, long k)```
Gives a binomial coefficient C(n, k)
`BigInteger` `cardinality()`
Returns the number of elements in this ring (cardinality) or null if ring is infinite
`BigInteger` `characteristic()`
Returns characteristic of this ring
`int` ```compare(BigInteger o1, BigInteger o2)```
`BigInteger` `copy(BigInteger element)`
Makes a deep copy of the specified element (for immutable instances the same reference returned).
`BigInteger[]` `createArray(int length)`
Creates generic array of ring elements of specified length
`BigInteger[][]` `createArray2d(int length)`
Creates 2d array of ring elements of specified length
`BigInteger[][]` ```createArray2d(int m, int n)```
Creates 2d array of ring elements of specified shape
`BigInteger[]` ```divideAndRemainder(BigInteger a, BigInteger b)```
Returns quotient and remainder of `dividend / divider`
`FactorDecomposition<BigInteger>` `factor(BigInteger element)`
Factor specified element
`FactorDecomposition<BigInteger>` `factorSquareFree(BigInteger element)`
Square-free factorization of specified element
`BigInteger` ```gcd(BigInteger a, BigInteger b)```
Returns the greatest common divisor of two elements
`BigInteger` `getNegativeOne()`
Returns negative unit element of this ring (minus one)
`BigInteger` `getOne()`
Returns unit element of this ring (one)
`BigInteger` `getZero()`
Returns zero element of this ring
`boolean` `isEuclideanRing()`
Returns whether this ring is a Euclidean ring
`boolean` `isField()`
Returns whether this ring is a field
`boolean` `isMinusOne(BigInteger bigInteger)`
Tests whether specified element is minus one
`boolean` `isOne(BigInteger element)`
Tests whether specified element is one (exactly)
`boolean` `isUnit(BigInteger element)`
Tests whether specified element is a ring unit
`boolean` `isZero(BigInteger element)`
Tests whether specified element is zero
`Iterator<BigInteger>` `iterator()`
Returns iterator over ring elements (for finite rings, otherwise throws exception)
`BigInteger` ```multiply(BigInteger a, BigInteger b)```
Multiplies two elements
`BigInteger` `negate(BigInteger element)`
Negates the given element
`BigInteger` `parse(String string)`
Parse string into ring element
`BigInteger` ```pow(BigInteger base, BigInteger exponent)```
Returns `base` in a power of `exponent` (non negative)
`BigInteger` ```pow(BigInteger base, int exponent)```
Returns `base` in a power of `exponent` (non negative)
`BigInteger` ```pow(BigInteger base, long exponent)```
Returns `base` in a power of `exponent` (non negative)
`BigInteger` `reciprocal(BigInteger element)`
Gives the inverse element `element ^ (-1) `
`BigInteger` ```remainder(BigInteger a, BigInteger b)```
Returns the remainder of `dividend / divider`
`int` `signum(BigInteger element)`
Returns -1 if `element < 0`, 0 if `element == 0` and 1 if `element > 0`, where comparison is specified by `Comparator.compare(Object, Object)`
`BigInteger` ```subtract(BigInteger a, BigInteger b)```
Subtracts `b` from `a`
`String` `toString()`
`BigInteger` `valueOf(BigInteger val)`
Converts a value from other ring to this ring.
`BigInteger` `valueOf(long val)`
Returns ring element associated with specified `long`
`BigInteger` `valueOfBigInteger(BigInteger val)`
Returns ring element associated with specified integer
• ### Methods inherited from class cc.redberry.rings.ARing

`isPerfectPower, perfectPowerBase, perfectPowerExponent`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface cc.redberry.rings.Ring

`add, addMutable, createArray, createArray, createArray, createZeroesArray, createZeroesArray2d, decrement, divideExact, divideExactMutable, divideOrNull, extendedGCD, factorial, fillZeros, firstBezoutCoefficient, gcd, gcd, increment, isFinite, isFiniteField, isUnitOrZero, lcm, lcm, lcm, max, min, multiply, multiply, multiply, multiplyMutable, negateMutable, quotient, randomElement, randomElement, randomElementTree, randomElementTree, randomNonZeroElement, setToValueOf, subtractMutable, valueOf`
• ### Methods inherited from interface java.util.Comparator

`comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`
• ### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`
• ### Methods inherited from interface cc.redberry.rings.io.Stringifiable

`toString`
• ### Field Detail

• #### Integers

`public static final Integers Integers`
The ring of integers (Z)
• ### Method Detail

• #### isField

`public boolean isField()`
Description copied from interface: `Ring`
Returns whether this ring is a field
Returns:
whether this ring is a field
• #### isEuclideanRing

`public boolean isEuclideanRing()`
Description copied from interface: `Ring`
Returns whether this ring is a Euclidean ring
Returns:
whether this ring is a Euclidean ring
• #### cardinality

`public BigInteger cardinality()`
Description copied from interface: `Ring`
Returns the number of elements in this ring (cardinality) or null if ring is infinite
Returns:
the number of elements in this ring (cardinality) or null if ring is infinite
• #### characteristic

`public BigInteger characteristic()`
Description copied from interface: `Ring`
Returns characteristic of this ring
Returns:
characteristic of this ring
• #### isUnit

`public boolean isUnit(BigInteger element)`
Description copied from interface: `Ring`
Tests whether specified element is a ring unit
Parameters:
`element` - the ring element
Returns:
whether specified element is a ring unit
`Ring.isOne(Object)`

```public BigInteger add(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Parameters:
`a` - the first element
`b` - the second element
Returns:
a + b
• #### subtract

```public BigInteger subtract(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Subtracts `b` from `a`
Parameters:
`a` - the first element
`b` - the second element
Returns:
a - b
• #### negate

`public BigInteger negate(BigInteger element)`
Description copied from interface: `Ring`
Negates the given element
Parameters:
`element` - the ring element
Returns:
-val
• #### multiply

```public BigInteger multiply(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Multiplies two elements
Parameters:
`a` - the first element
`b` - the second element
Returns:
a * b
• #### divideAndRemainder

```public BigInteger[] divideAndRemainder(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Returns quotient and remainder of `dividend / divider`
Parameters:
`a` - the dividend
`b` - the divider
Returns:
`{quotient, remainder}`
• #### remainder

```public BigInteger remainder(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Returns the remainder of `dividend / divider`
Parameters:
`a` - the dividend
`b` - the divider
Returns:
the remainder of `dividend / divider`
• #### reciprocal

`public BigInteger reciprocal(BigInteger element)`
Description copied from interface: `Ring`
Gives the inverse element `element ^ (-1) `
Parameters:
`element` - the element
Returns:
`element ^ (-1)`
• #### pow

```public BigInteger pow(BigInteger base,
int exponent)```
Description copied from interface: `Ring`
Returns `base` in a power of `exponent` (non negative)
Parameters:
`base` - base
`exponent` - exponent (non negative)
Returns:
`base` in a power of `exponent`
• #### pow

```public BigInteger pow(BigInteger base,
long exponent)```
Description copied from interface: `Ring`
Returns `base` in a power of `exponent` (non negative)
Parameters:
`base` - base
`exponent` - exponent (non negative)
Returns:
`base` in a power of `exponent`
• #### pow

```public BigInteger pow(BigInteger base,
BigInteger exponent)```
Description copied from interface: `Ring`
Returns `base` in a power of `exponent` (non negative)
Parameters:
`base` - base
`exponent` - exponent (non negative)
Returns:
`base` in a power of `exponent`
• #### gcd

```public final BigInteger gcd(BigInteger a,
BigInteger b)```
Description copied from interface: `Ring`
Returns the greatest common divisor of two elements
Parameters:
`a` - the first element
`b` - the second element
Returns:
gcd
• #### factorSquareFree

`public FactorDecomposition<BigInteger> factorSquareFree(BigInteger element)`
Description copied from interface: `Ring`
Square-free factorization of specified element
• #### factor

`public FactorDecomposition<BigInteger> factor(BigInteger element)`
Description copied from interface: `Ring`
Factor specified element
• #### valueOf

`public BigInteger valueOf(BigInteger val)`
Description copied from interface: `Ring`
Converts a value from other ring to this ring. The result is not guarantied to be a new instance (i.e. ```val == valueOf(val)``` is possible).
Parameters:
`val` - some element from any ring
Returns:
this ring element associated with specified `val`
• #### valueOf

`public BigInteger valueOf(long val)`
Description copied from interface: `Ring`
Returns ring element associated with specified `long`
Parameters:
`val` - machine integer
Returns:
ring element associated with specified `long`
• #### getNegativeOne

`public BigInteger getNegativeOne()`
Description copied from interface: `Ring`
Returns negative unit element of this ring (minus one)
Returns:
-1
• #### isMinusOne

`public boolean isMinusOne(BigInteger bigInteger)`
Description copied from interface: `Ring`
Tests whether specified element is minus one
Parameters:
`bigInteger` - the ring element
Returns:
whether specified element is minus one
• #### signum

`public final int signum(BigInteger element)`
Description copied from interface: `Ring`
Returns -1 if `element < 0`, 0 if `element == 0` and 1 if `element > 0`, where comparison is specified by `Comparator.compare(Object, Object)`
Parameters:
`element` - the element
Returns:
-1 if `element < 0`, 0 if `element == 0` and 1 otherwise
• #### abs

`public BigInteger abs(BigInteger el)`
Description copied from interface: `Ring`
Returns the abs value of element (no copy)
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`
• #### iterator

`public Iterator<BigInteger> iterator()`
Description copied from interface: `Ring`
Returns iterator over ring elements (for finite rings, otherwise throws exception)
• #### binomial

```public BigInteger binomial(long n,
long k)```
Gives a binomial coefficient C(n, k)
• #### getZero

`public final BigInteger getZero()`
Description copied from interface: `Ring`
Returns zero element of this ring
Returns:
0
• #### getOne

`public final BigInteger getOne()`
Description copied from interface: `Ring`
Returns unit element of this ring (one)
Returns:
1
• #### isZero

`public final boolean isZero(BigInteger element)`
Description copied from interface: `Ring`
Tests whether specified element is zero
Parameters:
`element` - the ring element
Returns:
whether specified element is zero
• #### isOne

`public final boolean isOne(BigInteger element)`
Description copied from interface: `Ring`
Tests whether specified element is one (exactly)
Parameters:
`element` - the ring element
Returns:
whether specified element is exactly one
`Ring.isUnit(Object)`
• #### parse

`public final BigInteger parse(String string)`
Description copied from interface: `Ring`
Parse string into ring element
Parameters:
`string` - string
Returns:
ring element
`Coder`
• #### compare

```public final int compare(BigInteger o1,
BigInteger o2)```
• #### createArray

`public final BigInteger[] createArray(int length)`
Description copied from interface: `Ring`
Creates generic array of ring elements of specified length
Parameters:
`length` - array length
Returns:
array of ring elements of specified `length`
• #### createArray2d

`public final BigInteger[][] createArray2d(int length)`
Description copied from interface: `Ring`
Creates 2d array of ring elements of specified length
Parameters:
`length` - array length
Returns:
2d array of ring elements of specified `length`
• #### createArray2d

```public final BigInteger[][] createArray2d(int m,
int n)```
Description copied from interface: `Ring`
Creates 2d array of ring elements of specified shape
Parameters:
`m` - result length
`n` - length of each array in the result
Returns:
2d array E[m][n]
• #### valueOfBigInteger

`public final BigInteger valueOfBigInteger(BigInteger val)`
Description copied from interface: `Ring`
Returns ring element associated with specified integer
Parameters:
`val` - integer
Returns:
ring element associated with specified integer
• #### copy

`public BigInteger copy(BigInteger element)`
Description copied from interface: `Ring`
Makes a deep copy of the specified element (for immutable instances the same reference returned).
Parameters:
`element` - the element
Returns:
deep copy of specified element