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,Serializable
A MatrixField where the elements of the matrices and vectors are of type E
and the evaluation is carried out using a
GenericPowerField of type E.
Generally there is no need to provide a concrete subclass
just using
RationalField 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 RationalMatrix2Test.
- Since:
- Jep 3.5 / Extensions 2.0
- See Also:
-
Field Summary
FieldsFields inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixField
mf -
Constructor Summary
ConstructorsConstructorDescriptionGenericFieldMatrixField(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
Modifier and TypeMethodDescriptionprotected EAdds two elements of the vector/matrixprotected BooleanAttempt to convert argument from an integerAttempt to convert argument to an integerprotected Eprotected BooleanReturns thisgetOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldvoidInitialize the component.protected Eprotected Eprotected Eprotected Booleanprotected Booleanprotected Eprotected EMethods inherited from class com.singularsys.extensions.matrix.genericmat.GenericMatrixField
add, add, add, and, calcSize, cmpSize, cross, cross, det, det, div, div, div, dot, dot, elementValue, eq, eq, eq, ge, gt, 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, trans
-
Field Details
-
base
-
-
Constructor Details
-
GenericFieldMatrixField
Standard constructor.- Parameters:
mf- The factory used to generate matricesbase- base field for calculations on elements
-
GenericFieldMatrixField
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. It is 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 Details
-
addEle
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
- Specified by:
subElein classGenericMatrixField<E>- Throws:
EvaluationException
-
negEle
- Specified by:
negElein classGenericMatrixField<E>- Throws:
EvaluationException
-
mulEle
- Specified by:
mulElein classGenericMatrixField<E>- Throws:
EvaluationException
-
modEle
- Specified by:
modElein classGenericMatrixField<E>- Throws:
EvaluationException
-
divEle
- Specified by:
divElein classGenericMatrixField<E>- Throws:
EvaluationException
-
powEle
- Specified by:
powElein classGenericMatrixField<E>- Throws:
EvaluationException
-
eqEle
- Specified by:
eqElein classGenericMatrixField<E>- Throws:
EvaluationException
-
neEle
- Specified by:
neElein classGenericMatrixField<E>- Throws:
EvaluationException
-
gtEle
- Specified by:
gtElein classGenericMatrixField<E>- Throws:
EvaluationException
-
geEle
- Specified by:
geElein classGenericMatrixField<E>- Throws:
EvaluationException
-
ltEle
- Specified by:
ltElein classGenericMatrixField<E>- Throws:
EvaluationException
-
leEle
- Specified by:
leElein classGenericMatrixField<E>- Throws:
EvaluationException
-
andEle
- Specified by:
andElein classGenericMatrixField<E>- Throws:
EvaluationException
-
orEle
- Specified by:
orElein classGenericMatrixField<E>- Throws:
EvaluationException
-
notEle
- Specified by:
notElein classGenericMatrixField<E>- Throws:
EvaluationException
-
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
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
Description 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
Description 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
-
init
Description copied from interface:JepComponentInitialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
Returns this- Specified by:
getLightWeightInstancein interfaceJepComponent- Overrides:
getLightWeightInstancein classGenericMatrixField<E>- Returns:
- either a new instance, null or 'this'.
-