|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- the variable type.public interface LinearSystemSolution<V>
This interface is used to represent a general solution to a system of linear equations. It is primarily intended for underdetermined systems, whose solutions consist of both free and fixed variables. In this representation, the variables contained in the solution are the same as those contained in the original system of equations. So in the solution, each variable from the original system is equal to a linear combination of those same variables. Take, for instance, the system
x + y = 1 |
2x + 2y = 2. |
x = x |
y = 1 - x, |
x = 1 - y |
y = y, |
Method Summary | |
---|---|
int |
fixedVariables()
Returns the number of fixed variables in this solution. |
int |
freeVariables()
Returns the number of free variables in this solution. |
java.util.Set<V> |
getFreeVariables()
Returns the set of free variables contained in this solution. |
LinearComb<V> |
getSolution(java.lang.Object variable)
Returns the linear combination of free variables to which the provided variable is equal. |
java.util.Map<V,java.lang.Double> |
getSolutionVector(java.util.Map<?,java.lang.Double> freeVariableValues)
Computes and returns a solution vector by plugging in the provided values for the free variables in this solution. |
java.util.Set<V> |
getVariables()
Returns the set of variables contained in this solution. |
boolean |
isSolutionVector(java.util.Map<?,java.lang.Double> variableValues,
double tolerance)
Indicates if the provided solution vector is consistent with this solution. |
boolean |
isVariable(java.lang.Object obj)
Indicates if the provided object is a variable in this solution. |
LinearSystemSolution<V> |
simplify(java.util.Map<?,java.lang.Double> variableValues,
double tolerance)
Computes and returns a simplified solution by plugging in the provided values. |
java.util.Map<V,LinearComb<V>> |
toMap()
Returns this solution as a map. |
int |
variables()
Returns the total number of variables in this solution. |
Method Detail |
---|
java.util.Set<V> getVariables()
java.util.Set<V> getFreeVariables()
boolean isVariable(java.lang.Object obj)
obj
- the potential variable.
true
if the provided object is a variable
in this solution; false
otherwise.LinearComb<V> getSolution(java.lang.Object variable)
variable
- a variable from this solution.
java.util.Map<V,LinearComb<V>> toMap()
LinearSystemSolution<V> simplify(java.util.Map<?,java.lang.Double> variableValues, double tolerance)
variableValues
- variables mapped to their
corresponding double precision value. Every key in the map must be a
variable in this solution.tolerance
- the amount by which a provided or computed value is
allowed to differ from any previously existing value. This should be
a small positive number, like 1E-9 for example.
java.util.Map<V,java.lang.Double> getSolutionVector(java.util.Map<?,java.lang.Double> freeVariableValues)
freeVariableValues
- free variables mapped to their
corresponding double precision value. Every key in the map must be a free variable
in this solution and all free variables must be present.
boolean isSolutionVector(java.util.Map<?,java.lang.Double> variableValues, double tolerance)
variableValues
- the variables of this solution mapped to their
values. Every key in the map must be a variable
in this solution and all variables must be present.tolerance
- the amount by which a provided value is
allowed to differ from any computed or previously existing value.
This should be a small positive number, like 1E-9 for example.
true
if the provided vector is consistent with this
solution; false
otherwise.int variables()
freeVariables()
,
fixedVariables()
int freeVariables()
int fixedVariables()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |