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 aGenericPowerField
of 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 E
addEle(E l, E r)
Adds two elements of the vector/matrixprotected java.lang.Boolean
andEle(E l, E r)
java.lang.Object
convertFromInt(java.lang.Integer l)
Attempt to convert argument from an integerjava.lang.Integer
convertToInt(java.lang.Object l)
Attempt to convert argument to an integerprotected E
divEle(E l, E r)
protected java.lang.Boolean
eqEle(E l, E r)
java.lang.Boolean
geEle(E l, E r)
JepComponent
getLightWeightInstance()
Returns thisE
getOne()
Get the multiplicative identity for this field.E
getZero()
Get the additive identity for this fieldjava.lang.Boolean
gtEle(E l, E r)
java.lang.Boolean
leEle(E l, E r)
java.lang.Boolean
ltEle(E l, E r)
protected E
modEle(E l, E r)
protected E
mulEle(E l, E r)
java.lang.Boolean
neEle(E l, E r)
protected E
negEle(E l)
protected java.lang.Boolean
notEle(E l)
protected java.lang.Boolean
orEle(E l, E r)
protected E
powEle(E l, E r)
protected E
subEle(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:GenericMatrixField
Adds two elements of the vector/matrix- Specified by:
addEle
in 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:
subEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
negEle
protected E negEle(E l) throws EvaluationException
- Specified by:
negEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
mulEle
protected E mulEle(E l, E r) throws EvaluationException
- Specified by:
mulEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
modEle
protected E modEle(E l, E r) throws EvaluationException
- Specified by:
modEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
divEle
protected E divEle(E l, E r) throws EvaluationException
- Specified by:
divEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
powEle
protected E powEle(E l, E r) throws EvaluationException
- Specified by:
powEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
eqEle
protected java.lang.Boolean eqEle(E l, E r) throws EvaluationException
- Specified by:
eqEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
neEle
public java.lang.Boolean neEle(E l, E r) throws EvaluationException
- Specified by:
neEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
gtEle
public java.lang.Boolean gtEle(E l, E r) throws EvaluationException
- Specified by:
gtEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
geEle
public java.lang.Boolean geEle(E l, E r) throws EvaluationException
- Specified by:
geEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
ltEle
public java.lang.Boolean ltEle(E l, E r) throws EvaluationException
- Specified by:
ltEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
leEle
public java.lang.Boolean leEle(E l, E r) throws EvaluationException
- Specified by:
leEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
andEle
protected java.lang.Boolean andEle(E l, E r) throws EvaluationException
- Specified by:
andEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
orEle
protected java.lang.Boolean orEle(E l, E r) throws EvaluationException
- Specified by:
orEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
notEle
protected java.lang.Boolean notEle(E l) throws EvaluationException
- Specified by:
notEle
in classGenericMatrixField<E>
- Throws:
EvaluationException
-
getZero
public E getZero()
Description copied from interface:FieldI
Get the additive identity for this field- Specified by:
getZero
in interfaceFieldI
- Specified by:
getZero
in classGenericMatrixField<E>
- Returns:
- object representing zero or null if undefined for this field
-
getOne
public E getOne()
Description copied from interface:FieldI
Get the multiplicative identity for this field.- Specified by:
getOne
in interfaceFieldI
- Specified by:
getOne
in classGenericMatrixField<E>
- Returns:
- object representing one or null if undefined for this field
-
convertFromInt
public java.lang.Object convertFromInt(java.lang.Integer l) throws EvaluationException
Description copied from interface:IntegerConvertor
Attempt 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 EvaluationException
Description copied from interface:IntegerConvertor
Attempt 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:
getLightWeightInstance
in interfaceJepComponent
- Overrides:
getLightWeightInstance
in classGenericMatrixField<E>
- Returns:
- either an new instance, null or 'this'.
-
-