Class AbstractVectorMatrixRule
java.lang.Object
com.singularsys.extensions.rewrite.AbstractRewrite
com.singularsys.extensions.rewrite.matrix.AbstractVectorMatrixRule
- All Implemented Interfaces:
RewriteRuleI,JepComponent,Serializable
- Direct Known Subclasses:
AddVectorMatrixRule,CrossProductRule,DotProductRule,MultiplyVectorMatrixRule,ScalarDivisionRule,ScalarMultiplicationRule,SubtractVectorMatrixRule
Base class for rules which operate on vectors and matrices.
Provides methods for converting constant vectors.
- Since:
- Jep 4.1 extension 2.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DimensionVisitorA visitor for finding the dimensions of a node. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvert an object to a list.Converts a node to a list of lists.voidInitialize the component.Converts a MatrixI to an ASTOpNode with a List operator.Converts a VectorI to an ASTOpNode with a List operator.Methods inherited from class com.singularsys.extensions.rewrite.AbstractRewrite
getLightWeightInstance, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.singularsys.extensions.rewrite.RewriteRuleI
apply, test
-
Field Details
-
dv
A visitor for finding the dimensions of a node.
-
-
Constructor Details
-
AbstractVectorMatrixRule
public AbstractVectorMatrixRule()
-
-
Method Details
-
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.- Specified by:
initin interfaceJepComponent- Overrides:
initin classAbstractRewrite- Parameters:
jep- the current Jep instance
-
vectorToList
Converts a VectorI to an ASTOpNode with a List operator.- Parameters:
v-- Returns:
- Node representing the vector as a List.
- Throws:
ParseException
-
matrixToListOfLists
Converts a MatrixI to an ASTOpNode with a List operator.- Parameters:
m-- Returns:
- Node representing the matrix as a List of Lists.
- Throws:
ParseException- if the matrix cannot be converted.
-
asList
Convert an object to a list. Assumes the object is a list or vector. For a VectorI callsvectorToList(VectorI), for an ASTOpNode with a list operator returns the node, otherwise returns null.- Parameters:
n- node to convert- Returns:
- an ASTOpNode representing a list, or null if the object cannot be converted.
- Throws:
ParseException- if the object cannot be converted.
-
asListOfLists
Converts a node to a list of lists. Assumes the node is a MatrixI or an ASTOpNode with a list of lists operator. If the node is a MatrixI callsmatrixToListOfLists(MatrixI), if the node is an ASTOpNode with a list of lists operator returns the node.- Parameters:
n-- Returns:
- an ASTOpNode representing a list of lists.
- Throws:
ParseException- if the node cannot be converted.
-