Package org.apfloat.jscience
Class ModuloApintField
- All Implemented Interfaces:
Serializable,Comparable<ModuloApintField>,Immutable,Realtime,ValueType,XMLSerializable,Field<ModuloApintField>,GroupAdditive<ModuloApintField>,GroupMultiplicative<ModuloApintField>,Ring<ModuloApintField>,Structure<ModuloApintField>
This class represents an arbitrary precision modulo integer.
The modulus must be set with
setModulus(Apint); otherwise
the modulo reduction is not done.- Since:
- 1.8.0
- Version:
- 1.8.0
- Author:
- Mikko Tommila
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionModuloApintField(Apint value) Constructs a new integer field object with the specified value. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of this object.static ApintReturns the modulus ornullif modulo reduction is not done.inverse()Returns the multiplicative inverse of this object.opposite()Returns the additive inverse of this object.plus(ModuloApintField that) Returns the sum of this object with the one specified.static ApintReduce the value with the current modulus.static voidsetModulus(Apint modulus) Sets the modulus.times(ModuloApintField that) Returns the product of this object with the one specified.Methods inherited from class org.apfloat.jscience.AbstractField
compareTo, doubleValue, equals, hashCode, isLargerThan, longValue, toText, valueMethods inherited from class org.jscience.mathematics.number.Number
byteValue, floatValue, intValue, isGreaterThan, isLessThan, minus, pow, shortValue, toString
-
Constructor Details
-
ModuloApintField
Constructs a new integer field object with the specified value.- Parameters:
value- The value.
-
-
Method Details
-
getModulus
Returns the modulus ornullif modulo reduction is not done. The modulus can be set in a thread-specific way usingLocalContext.- Returns:
- The local modulus or
nullif modulo reduction is not done. - See Also:
-
setModulus
Sets the modulus. The modulus can be set in a thread-specific way usingLocalContext.- Parameters:
modulus- The modulus ornullif modulo reduction is not done.- Throws:
IllegalArgumentException- Ifmodulusis not positive.
-
reduce
-
plus
Description copied from class:AbstractFieldReturns the sum of this object with the one specified.- Specified by:
plusin interfaceGroupAdditive<ModuloApintField>- Specified by:
plusin classAbstractField<ModuloApintField,Apint> - Parameters:
that- The addend.- Returns:
this + that
-
opposite
Description copied from class:AbstractFieldReturns the additive inverse of this object.- Specified by:
oppositein interfaceGroupAdditive<ModuloApintField>- Specified by:
oppositein classAbstractField<ModuloApintField,Apint> - Returns:
-this
-
times
Description copied from class:AbstractFieldReturns the product of this object with the one specified.- Specified by:
timesin interfaceGroupMultiplicative<ModuloApintField>- Specified by:
timesin interfaceRing<ModuloApintField>- Specified by:
timesin classAbstractField<ModuloApintField,Apint> - Parameters:
that- The multiplicand.- Returns:
this * that
-
inverse
Description copied from class:AbstractFieldReturns the multiplicative inverse of this object.- Specified by:
inversein interfaceGroupMultiplicative<ModuloApintField>- Specified by:
inversein classAbstractField<ModuloApintField,Apint> - Returns:
1 / this- Throws:
ArithmeticException- If the divisor is zero.
-
copy
Description copied from class:AbstractFieldReturns a copy of this object.- Specified by:
copyin interfaceValueType- Specified by:
copyin classAbstractField<ModuloApintField,Apint> - Returns:
- A copy of this object.
-