Class MatrixFieldCollection
- java.lang.Object
-
- com.singularsys.extensions.field.FieldCollection
-
- com.singularsys.extensions.matrix.MatrixFieldCollection
-
- All Implemented Interfaces:
FieldI,IntegerConvertor,MatrixFieldI,JepComponent,java.io.Serializable
public class MatrixFieldCollection extends FieldCollection implements MatrixFieldI
A collection of fields including one matrix. It is not currently possible to use two different types of matrices together. You can combine a matrix type with other field implementations such as theBooleanFieldto add logical capability.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.extensions.field.FieldCollection
fields
-
-
Constructor Summary
Constructors Constructor Description MatrixFieldCollection(FieldI... fields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 integerjava.lang.Objectcross(java.lang.Object l, java.lang.Object r)The cross product of two vectorsjava.lang.Objectdet(java.lang.Object mat)The determinant of a matrixjava.lang.Objectdot(java.lang.Object l, java.lang.Object r)The dot product of two vectorsJepComponentgetLightWeightInstance()Returns thisvoidinit(Jep jep)Initialize the component.java.lang.Objectinv(java.lang.Object mat)Returns the inverse of a square matrix.java.lang.Objectsolve(java.lang.Object l, java.lang.Object r)Solve equation A * X = Bjava.lang.Objecttrace(java.lang.Object mat)Returns the trace of a matrix.java.lang.Objecttrans(java.lang.Object mat)Transpose of a matrix-
Methods inherited from class com.singularsys.extensions.field.FieldCollection
add, addField, and, clearFields, div, eq, ge, getFields, getOne, getZero, gt, le, lt, mod, mul, ne, neg, not, or, pow, removeField, sub
-
-
-
-
Constructor Detail
-
MatrixFieldCollection
public MatrixFieldCollection(FieldI... fields)
-
-
Method Detail
-
det
public java.lang.Object det(java.lang.Object mat) throws EvaluationExceptionDescription copied from interface:MatrixFieldIThe determinant of a matrix- Specified by:
detin interfaceMatrixFieldI- Returns:
- the determinant of mat if it is a matrix
- Throws:
EvaluationException
-
trans
public java.lang.Object trans(java.lang.Object mat) throws EvaluationExceptionDescription copied from interface:MatrixFieldITranspose of a matrix- Specified by:
transin interfaceMatrixFieldI- Parameters:
mat- the matrix- Returns:
- a matrix containing the transpose
- Throws:
EvaluationException
-
dot
public java.lang.Object dot(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:MatrixFieldIThe dot product of two vectors- Specified by:
dotin interfaceMatrixFieldI- Returns:
- the dot product if both arguments are vectors, null otherwise.
- Throws:
EvaluationException
-
cross
public java.lang.Object cross(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:MatrixFieldIThe cross product of two vectors- Specified by:
crossin interfaceMatrixFieldI- Returns:
- a vector with the cross product
- Throws:
EvaluationException- if either vectors not of length 3
-
trace
public java.lang.Object trace(java.lang.Object mat) throws EvaluationExceptionDescription copied from interface:MatrixFieldIReturns the trace of a matrix.- Specified by:
tracein interfaceMatrixFieldI- Parameters:
mat- the matrix- Returns:
- the trace
- Throws:
EvaluationException
-
inv
public java.lang.Object inv(java.lang.Object mat) throws EvaluationExceptionDescription copied from interface:MatrixFieldIReturns the inverse of a square matrix.- Specified by:
invin interfaceMatrixFieldI- Parameters:
mat- the matrix- Returns:
- the trace
- Throws:
EvaluationException- if matrix is not square or is singular
-
solve
public java.lang.Object solve(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:MatrixFieldISolve equation A * X = B- Specified by:
solvein interfaceMatrixFieldI- Parameters:
l- a square matrixr- either a vector or matrix with same number of rows as A- Returns:
- a vector or matrix solving equations
- Throws:
EvaluationException- if matrix is not square or is singular
-
convertToInt
public java.lang.Integer convertToInt(java.lang.Object l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument to an integer- Specified by:
convertToIntin interfaceIntegerConvertor- Overrides:
convertToIntin classFieldCollection- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
- Throws:
EvaluationException- on error
-
convertFromInt
public java.lang.Object convertFromInt(java.lang.Integer l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Overrides:
convertFromIntin classFieldCollection- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-
init
public void init(Jep jep)
Description copied from interface:JepComponentInitialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.- Specified by:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Returns this- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- either an new instance, null or 'this'.
-
-