Class GenericFieldMatrixField<E>
- java.lang.Object
-
- com.singularsys.extensions.matrix.genericmat.GenericMatrixField<E>
-
- com.singularsys.extensions.matrix.genericmat.GenericFieldMatrixField<E>
-
- Type Parameters:
E- base type for elements
- All Implemented Interfaces:
FieldI,IntegerConvertor,MatrixFieldI,JepComponent,java.io.Serializable
public class GenericFieldMatrixField<E> extends GenericMatrixField<E>
A MatrixField where the elements of the matrices and vectors are of type E and the evaluation is carried out using aGenericPowerFieldof type E. Generally there is no need to provide a concrete subclass just usingRationalField rf = new RationalField(); MatrixFactoryI mfact = new GenericMatrixFactory<>(rf); MatrixFieldI mfield = new GenericFieldMatrixField<>(mfact,rf);A concrete implementation would just need to provide a constructor. An example use is at
RationalMatrixTest2.- Since:
- Jep 3.5 / Extensions 2.0
- See Also:
GenericMatrixFactory, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected GenericField<E>base-
Fields inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixField
mf
-
-
Constructor Summary
Constructors Constructor Description GenericFieldMatrixField(GenericMatrixFactory<E> mf, GenericField<E> base)Standard constructor.GenericFieldMatrixField(GenericMatrixFactory<E> mf, GenericPowerField<E> base, boolean skipElements)Constructor where operations on the base field can be switched off.GenericFieldMatrixField(MatrixFactoryI mf, GenericField<E> base)Constructor which is easier to use, but has an unchecked cast.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected EaddEle(E l, E r)Adds two elements of the vector/matrixprotected java.lang.BooleanandEle(E l, E r)java.lang.ObjectconvertFromInt(java.lang.Integer l)Attempt to convert argument from an integerjava.lang.IntegerconvertToInt(java.lang.Object l)Attempt to convert argument to an integerprotected EdivEle(E l, E r)protected java.lang.BooleaneqEle(E l, E r)java.lang.BooleangeEle(E l, E r)JepComponentgetLightWeightInstance()Returns thisEgetOne()Get the multiplicative identity for this field.EgetZero()Get the additive identity for this fieldjava.lang.BooleangtEle(E l, E r)java.lang.BooleanleEle(E l, E r)java.lang.BooleanltEle(E l, E r)protected EmodEle(E l, E r)protected EmulEle(E l, E r)java.lang.BooleanneEle(E l, E r)protected EnegEle(E l)protected java.lang.BooleannotEle(E l)protected java.lang.BooleanorEle(E l, E r)protected EpowEle(E l, E r)protected EsubEle(E l, E r)-
Methods inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixField
add, add, add, and, calcSize, cmpSize, cross, cross, det, det, div, div, div, dot, dot, eq, eq, eq, ge, gt, init, inv, invMat, le, lt, minor, mod, mul, mul, mul, mul, mul, mul, mul, ne, neg, neg, neg, not, or, pow, solve, solveMM, solveMV, sub, sub, sub, subtractMul, swapRows, trace, trace, trans, trans
-
-
-
-
Field Detail
-
base
protected GenericField<E> base
-
-
Constructor Detail
-
GenericFieldMatrixField
public GenericFieldMatrixField(GenericMatrixFactory<E> mf, GenericField<E> base)
Standard constructor.- Parameters:
mf- The factory used to generate matricesbase- base field for calculations on elements
-
GenericFieldMatrixField
public GenericFieldMatrixField(MatrixFactoryI mf, GenericField<E> base)
Constructor which is easier to use, but has an unchecked cast. Use theGenericFieldMatrixField(GenericMatrixFactory, GenericPowerField, boolean)constructor to ensure type safety.- Parameters:
mf-base-
-
GenericFieldMatrixField
public GenericFieldMatrixField(GenericMatrixFactory<E> mf, GenericPowerField<E> base, boolean skipElements)
Constructor where operations on the base field can be switched off. By default the add operator will add vectors/matrices over a base field and also add elements in that field. So it will calculate (2,3)+(4,5) but also 6+7. Setting skipElements to true means that it will calculate (2,3)+(4,5) but return null if given 6+7. This will need to be specified by some other field. Its not intended to use this constructor but left here for case where it is needed.- Parameters:
mf- The factory used to generate matricesbase- base field for calculations on elementsskipElements- whether to skip operations on the base elements
-
-
Method Detail
-
addEle
protected E addEle(E l, E r) throws EvaluationException
Description copied from class:GenericMatrixFieldAdds two elements of the vector/matrix- Specified by:
addElein classGenericMatrixField<E>- Parameters:
l- lhs elementr- rhs element- Returns:
- their sum
- Throws:
EvaluationException
-
subEle
protected E subEle(E l, E r) throws EvaluationException
- Specified by:
subElein classGenericMatrixField<E>- Throws:
EvaluationException
-
negEle
protected E negEle(E l) throws EvaluationException
- Specified by:
negElein classGenericMatrixField<E>- Throws:
EvaluationException
-
mulEle
protected E mulEle(E l, E r) throws EvaluationException
- Specified by:
mulElein classGenericMatrixField<E>- Throws:
EvaluationException
-
modEle
protected E modEle(E l, E r) throws EvaluationException
- Specified by:
modElein classGenericMatrixField<E>- Throws:
EvaluationException
-
divEle
protected E divEle(E l, E r) throws EvaluationException
- Specified by:
divElein classGenericMatrixField<E>- Throws:
EvaluationException
-
powEle
protected E powEle(E l, E r) throws EvaluationException
- Specified by:
powElein classGenericMatrixField<E>- Throws:
EvaluationException
-
eqEle
protected java.lang.Boolean eqEle(E l, E r) throws EvaluationException
- Specified by:
eqElein classGenericMatrixField<E>- Throws:
EvaluationException
-
neEle
public java.lang.Boolean neEle(E l, E r) throws EvaluationException
- Specified by:
neElein classGenericMatrixField<E>- Throws:
EvaluationException
-
gtEle
public java.lang.Boolean gtEle(E l, E r) throws EvaluationException
- Specified by:
gtElein classGenericMatrixField<E>- Throws:
EvaluationException
-
geEle
public java.lang.Boolean geEle(E l, E r) throws EvaluationException
- Specified by:
geElein classGenericMatrixField<E>- Throws:
EvaluationException
-
ltEle
public java.lang.Boolean ltEle(E l, E r) throws EvaluationException
- Specified by:
ltElein classGenericMatrixField<E>- Throws:
EvaluationException
-
leEle
public java.lang.Boolean leEle(E l, E r) throws EvaluationException
- Specified by:
leElein classGenericMatrixField<E>- Throws:
EvaluationException
-
andEle
protected java.lang.Boolean andEle(E l, E r) throws EvaluationException
- Specified by:
andElein classGenericMatrixField<E>- Throws:
EvaluationException
-
orEle
protected java.lang.Boolean orEle(E l, E r) throws EvaluationException
- Specified by:
orElein classGenericMatrixField<E>- Throws:
EvaluationException
-
notEle
protected java.lang.Boolean notEle(E l) throws EvaluationException
- Specified by:
notElein classGenericMatrixField<E>- Throws:
EvaluationException
-
getZero
public E getZero()
Description copied from interface:FieldIGet the additive identity for this field- Specified by:
getZeroin interfaceFieldI- Specified by:
getZeroin classGenericMatrixField<E>- Returns:
- object representing zero or null if undefined for this field
-
getOne
public E getOne()
Description copied from interface:FieldIGet the multiplicative identity for this field.- Specified by:
getOnein interfaceFieldI- Specified by:
getOnein classGenericMatrixField<E>- Returns:
- object representing one or null if undefined for this field
-
convertFromInt
public java.lang.Object convertFromInt(java.lang.Integer l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument from an integer- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-
convertToInt
public java.lang.Integer convertToInt(java.lang.Object l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument to an integer- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException- on error
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Returns this- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classGenericMatrixField<E>- Returns:
- either an new instance, null or 'this'.
-
-