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 theBooleanField
to 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.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 integerjava.lang.Object
cross(java.lang.Object l, java.lang.Object r)
The cross product of two vectorsjava.lang.Object
det(java.lang.Object mat)
The determinant of a matrixjava.lang.Object
dot(java.lang.Object l, java.lang.Object r)
The dot product of two vectorsJepComponent
getLightWeightInstance()
Returns thisvoid
init(Jep jep)
Initialize the component.java.lang.Object
inv(java.lang.Object mat)
Returns the inverse of a square matrix.java.lang.Object
solve(java.lang.Object l, java.lang.Object r)
Solve equation A * X = Bjava.lang.Object
trace(java.lang.Object mat)
Returns the trace of a matrix.java.lang.Object
trans(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 EvaluationException
Description copied from interface:MatrixFieldI
The determinant of a matrix- Specified by:
det
in interfaceMatrixFieldI
- Returns:
- the determinant of mat if it is a matrix
- Throws:
EvaluationException
-
trans
public java.lang.Object trans(java.lang.Object mat) throws EvaluationException
Description copied from interface:MatrixFieldI
Transpose of a matrix- Specified by:
trans
in 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 EvaluationException
Description copied from interface:MatrixFieldI
The dot product of two vectors- Specified by:
dot
in 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 EvaluationException
Description copied from interface:MatrixFieldI
The cross product of two vectors- Specified by:
cross
in 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 EvaluationException
Description copied from interface:MatrixFieldI
Returns the trace of a matrix.- Specified by:
trace
in interfaceMatrixFieldI
- Parameters:
mat
- the matrix- Returns:
- the trace
- Throws:
EvaluationException
-
inv
public java.lang.Object inv(java.lang.Object mat) throws EvaluationException
Description copied from interface:MatrixFieldI
Returns the inverse of a square matrix.- Specified by:
inv
in 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 EvaluationException
Description copied from interface:MatrixFieldI
Solve equation A * X = B- Specified by:
solve
in 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 EvaluationException
Description copied from interface:IntegerConvertor
Attempt to convert argument to an integer- Specified by:
convertToInt
in interfaceIntegerConvertor
- Overrides:
convertToInt
in 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 EvaluationException
Description copied from interface:IntegerConvertor
Attempt to convert argument from an integer- Specified by:
convertFromInt
in interfaceIntegerConvertor
- Overrides:
convertFromInt
in 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:JepComponent
Initialize 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:
init
in interfaceJepComponent
- Parameters:
jep
- the current Jep instance
-
getLightWeightInstance
public JepComponent getLightWeightInstance()
Returns this- Specified by:
getLightWeightInstance
in interfaceJepComponent
- Returns:
- either an new instance, null or 'this'.
-
-