Package com.singularsys.extensions.field.implementations

Standard FieldI implementations, and utility classes for construction implementations.

Basic types

Rational
Unlimited precision rational numbers.
com.singularsys.jep.standard.Complex
Complex numbers

Standard Implementations

DoubleField
Implemented using Doubles.
IntegerField
Implemented using Integers,
ExactIntegerField
Implemented using Integers and the new addExact(int,int) etc. of java.lang.Math methods of Java 1.8. These throw ArithmeticException if results overflow. The Jep implementation wrap these exceptions in EvaluationExceptions.
BigIntegerField
Unlimited precision integers, implemented using BigIntegers
BigDecimalField
Implemented using BigDecimals. Can be set to use a specific NumberContext to set the level of accuracy required.
RationalField
Rational numbers represented as a quotient of two BigIntegers, and implemented using the Rational data-type.
ComplexField
Complex numbers implemented using the Complex data type.
ModulusField
Integers modulo a given base, i.e. Z(n). The modulus is specified in the constructor and can use with modulus upto 46,341.
BigModulusField
Performs integer calculations modulus a value specified in the constructor. This class can use very large values of the modulus.
BooleanField
Implements the standard logical operations. Generally used to add logical capabilities to other fields.
StringField
Allows addition and comparison of strings.

NumberFactories

Classes which implement NumberFactory used to parse string representations of numbers.

IntegerNumberFactory
Parse numeric string as Integers.
com.singularsys.jep.standard.DoubleNumberFactory
Parse numeric string as Doubles.
IntDoubleNumberFactory
Parse numeric strings as Integers or Doubles depending on the string.
LongDoubleNumberFactory
Parse numeric strings as Longs or Doubles depending on the string.
RationalNumberFactory
Parse numeric string as Rationals.
ComplexNumberFactory
Parse numeric string as Complexs.
BigIntegerNumberFactory
Parse numeric string as BigIntegers.
com.singularsys.jep.bigdecimal.BigDecNumberFactory
Parse numeric string as BigDecimalss.

Decorators

Classes which perform type conversion. These extend the abstract base class FieldDecorator.

NumberToDoubleDecorator
Converts all number types to Doubles. A flag can be set so that on output Doubles can be converted to Integers when there is no loss of precision.
NumberToComplexDecorator
Converts all number types to Complex. A flag can be set so that if the complex number represents a real number the output is converted to a Double.
IntegerToBigIntegerDecorator
Converts Integer, Short and Long to to BigInteger. A flag can be set so that on output BigIntegers can be converted to Integers when there is no loss of precision.
BigIntegerToRationalDecorator
Converts Integer, Short, Long and BigInteger to Rationals. A flag can be set so that if the Rational number can be converted to BigIntegers when there is no loss of precision.

Base classes

Used to make the construction of Fields easier.

AbstractComparativeField
The comparative operators eq(l,r), ne(l,r), gt(l,r), ge(l,r), lt(l,r), ge(l,r) are replaced by a single method Integer cmp(l,r) which compare two numbers.
GenericField<E>
Simplifies type conversions. Subclass just need to provide a method E cast(Object l) to convert input to the desired type and methods E addG(E,E) etc. which just use the specified type. There is node need to implement the Object add(Object,Object) methods.
GenericPowerField<E>
Provides an efficient method for calculating integer powers of elements in the field.

The PowerImplementations class provides static methods for calculating integer powers of integers, longs and doubles.