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
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of variables the function has.int
Get the dimension of the range space of the function.static Vector
getAllParts
(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).boolean
isFixedIndex
(int i) Checks whether a particular index corresponds a fixed variable/value.static boolean
isFixedIndex
(int i, Map<Integer, Double> fixing) Checks whether a particular index corresponds a fixed variable/value.
-
Field Details
-
f
the original, unrestricted function -
fixing
the restrictions or fixed values
-
-
Constructor Details
-
SubFunction
Constructs a sub-function.- Parameters:
f
- the original, unrestricted functionfixing
- the values held fixed for a subset of variables
-
-
Method Details
-
isFixedIndex
Checks whether a particular index corresponds a fixed variable/value.- Parameters:
i
- an index, counting from 1fixing
- fixed values- Returns:
true
if xi is fixed to some value
-
getVariablePart
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
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:Function
Get 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:
dimensionOfDomain
in interfaceFunction<Vector,
R> - Returns:
- the number of variables
-
dimensionOfRange
public int dimensionOfRange()Description copied from interface:Function
Get 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:
dimensionOfRange
in 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:
true
if xi is fixed to some value
-