Class PolynomialTerm
java.lang.Object
edu.cmu.tetrad.study.gene.tetrad.gene.history.PolynomialTerm
- All Implemented Interfaces:
- TetradSerializable,- Serializable
Implements a term in a polymonial whose variables are mapped to indices in in the set {0, 1, 2, ...}. The term has a coefficient and a freely generated list of variables. For example, if "x" -> 0, "y" -> 1, "z" -> 2, then the following terms are represented as follows, where "Vi" stands for the variable mapped to index i:
- 2.5x -> 2.5*(V0)(V0)
- 1.7xyz^2 -> 1.7*(V0)(V1)(V2)(V2)
- -5.0z^3y^2 -> -5.0*(V2)(V2)(V2)(V1)(V1)
- Author:
- josephramsey
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondoubleevaluate(double[] values) Evaluates the term.doubleReturns the coefficient.intReturns the highest variable index in this term.intReturns the number of variables in this term.intgetVariable(int index) Returns the index'th variable.booleanisVariableListEqual(int[] variables) Returns true iff the given variable list is equal to the variable list of this term.static PolynomialTermGenerates a simple exemplar of this class to test serialization.voidsetCoefficient(double coefficient) Sets the coefficient.toString()Prints out a representation of the term.
- 
Constructor Details- 
PolynomialTermpublic PolynomialTerm(double coefficient, int[] variables) Constructs a term.
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.
- 
getCoefficientpublic double getCoefficient()Returns the coefficient.
- 
setCoefficientpublic void setCoefficient(double coefficient) Sets the coefficient.
- 
getNumVariablespublic int getNumVariables()Returns the number of variables in this term.
- 
getVariablepublic int getVariable(int index) Returns the index'th variable.
- 
isVariableListEqualpublic boolean isVariableListEqual(int[] variables) Returns true iff the given variable list is equal to the variable list of this term.
- 
getMaxIndexpublic int getMaxIndex()Returns the highest variable index in this term.
- 
evaluatepublic double evaluate(double[] values) Evaluates the term.
- 
toStringPrints out a representation of the term.
 
-