Package dev.nm.analysis.function
Class SubFunction<R>
- java.lang.Object
-
- dev.nm.analysis.function.SubFunction<R>
-
- Type Parameters:
R- the range of a function
- Direct Known Subclasses:
RealScalarSubFunction,RealVectorSubFunction
public abstract class SubFunction<R> extends Object implements Function<Vector,R>
A sub-function, g, is defined over a subset of the domain of another (original) function, f. g(x) = f(x) when they are both defined. This implementation constructs a sub-function by restricting/fixing the values of a subset of variables of another function.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intdimensionOfDomain()Get the number of variables the function has.intdimensionOfRange()Get the dimension of the range space of the function.static VectorgetAllParts(Vector variables, Map<Integer,Double> fixing)Combines the variable and fixed values to form an input to the original function.static double[]getVariablePart(double[] z, Map<Integer,Double> fixing)Given an input to the original function, this extracts the variable parts (excluding the fixed values).booleanisFixedIndex(int i)Checks whether a particular index corresponds a fixed variable/value.static booleanisFixedIndex(int i, Map<Integer,Double> fixing)Checks whether a particular index corresponds a fixed variable/value.
-
-
-
Method Detail
-
isFixedIndex
public static boolean isFixedIndex(int i, Map<Integer,Double> fixing)Checks whether a particular index corresponds a fixed variable/value.- Parameters:
i- an index, counting from 1fixing- fixed values- Returns:
trueif xi is fixed to some value
-
getVariablePart
public static double[] getVariablePart(double[] z, Map<Integer,Double> fixing)Given an input to the original function, this extracts the variable parts (excluding the fixed values).- Parameters:
z- an input to the original functionfixing- fixed values- Returns:
- the variable part in
z
-
getAllParts
public static Vector getAllParts(Vector variables, Map<Integer,Double> fixing)
Combines the variable and fixed values to form an input to the original function.- Parameters:
variables- the non-fixed variables/values to the restricted functionfixing- the fixed values to the original function- Returns:
- an input to the original function
-
dimensionOfDomain
public int dimensionOfDomain()
Description copied from interface:FunctionGet the number of variables the function has. For example, for a univariate function, the domain dimension is 1; for a bivariate function, the domain dimension is 2.- Specified by:
dimensionOfDomainin interfaceFunction<Vector,R>- Returns:
- the number of variables
-
dimensionOfRange
public int dimensionOfRange()
Description copied from interface:FunctionGet the dimension of the range space of the function. For example, for a Rn->Rm function, the dimension of the range is m.- Specified by:
dimensionOfRangein interfaceFunction<Vector,R>- Returns:
- the dimension of the range
-
isFixedIndex
public boolean isFixedIndex(int i)
Checks whether a particular index corresponds a fixed variable/value.- Parameters:
i- an index, counting from 1- Returns:
trueif xi is fixed to some value
-
-