|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsbrt.kernel.math.algebra.HashLinearSystemSolution<V>
V
- the variable type.public class HashLinearSystemSolution<V>
This class is a concrete implemenation of LinearSystemSolution. The hash codes of the provided variables are used extenstively in this implementation to provide constant-time lookup for internally stored information.
Constructor Summary | |
---|---|
HashLinearSystemSolution(java.util.Map<? extends V,? extends LinearComb<? extends V>> solutions)
Constructs a new hash code-based linear system solution. |
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> point,
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. |
|
static
|
simplify(LinearSystemSolution<V> solution,
java.util.Map<? extends V,Interval> variableBounds,
double tolerance)
Returns a simplified version of the provided linear system solution given the variable bounds. |
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HashLinearSystemSolution(java.util.Map<? extends V,? extends LinearComb<? extends V>> solutions)
solutions
- variables mapped to the linear combination of free
variables to which they equal. The set of variables in the provided
linear combinations must be a subset of the keys in the provided map.
MissingVariableException
- if at least one free variable does not
appear as a key in the provided map.Method Detail |
---|
public static <V> LinearSystemSolution<V> simplify(LinearSystemSolution<V> solution, java.util.Map<? extends V,Interval> variableBounds, double tolerance)
V
- the variable type.solution
- a solution to a system of linear equations.variableBounds
- the bounds on each variable in that solution.tolerance
- the tolerance used to simplify the provided linear
system solution. See LinearSystemSolution.simplify(Map, double).
public int variables()
variables
in interface LinearSystemSolution<V>
freeVariables()
,
fixedVariables()
public int freeVariables()
freeVariables
in interface LinearSystemSolution<V>
public int fixedVariables()
fixedVariables
in interface LinearSystemSolution<V>
public java.util.Set<V> getVariables()
getVariables
in interface LinearSystemSolution<V>
public java.util.Set<V> getFreeVariables()
getFreeVariables
in interface LinearSystemSolution<V>
public LinearComb<V> getSolution(java.lang.Object variable)
getSolution
in interface LinearSystemSolution<V>
variable
- a variable from this solution.
public java.util.Map<V,LinearComb<V>> toMap()
toMap
in interface LinearSystemSolution<V>
public java.util.Map<V,java.lang.Double> getSolutionVector(java.util.Map<?,java.lang.Double> freeVariableValues)
getSolutionVector
in interface LinearSystemSolution<V>
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.
public LinearSystemSolution<V> simplify(java.util.Map<?,java.lang.Double> variableValues, double tolerance)
simplify
in interface LinearSystemSolution<V>
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.
public boolean isVariable(java.lang.Object obj)
isVariable
in interface LinearSystemSolution<V>
obj
- the potential variable.
true
if the provided object is a variable in this
solution; false
otherwise.public boolean isSolutionVector(java.util.Map<?,java.lang.Double> point, double tolerance)
isSolutionVector
in interface LinearSystemSolution<V>
point
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |