Class DSFactory
java.lang.Object
org.hipparchus.analysis.differentiation.DSFactory
- All Implemented Interfaces:
Serializable
Factory for
DerivativeStructure.
This class is a factory for DerivativeStructure instances.
Instances of this class are guaranteed to be immutable.
- Since:
- 1.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classField for {link DerivativeStructure} instances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal DerivativeStructurebuild(double... derivatives) Build aDerivativeStructurefrom all its derivatives.constant(double value) Build aDerivativeStructurerepresenting a constant value.Get the compiler for the current dimensions.Get theFieldtheDerivativeStructureinstances belong to.variable(int index, double value) Build aDerivativeStructurerepresenting a variable.
-
Constructor Details
-
DSFactory
public DSFactory(int parameters, int order) Simple constructor.- Parameters:
parameters- number of free parametersorder- derivation order
-
-
Method Details
-
getDerivativeField
Get theFieldtheDerivativeStructureinstances belong to.- Returns:
FieldtheDerivativeStructureinstances belong to
-
constant
Build aDerivativeStructurerepresenting a constant value.- Parameters:
value- value of the constant- Returns:
- a
DerivativeStructurerepresenting a constant value
-
variable
Build aDerivativeStructurerepresenting a variable.Instances built using this method are considered to be the free variables with respect to which differentials are computed. As such, their differential with respect to themselves is +1.
- Parameters:
index- index of the variable (from 0 togetCompiler().getFreeParameters()- 1)value- value of the variable- Returns:
- a
DerivativeStructurerepresenting a variable - Throws:
MathIllegalArgumentException- if index if greater or equal togetCompiler().getFreeParameters().
-
build
@SafeVarargs public final DerivativeStructure build(double... derivatives) throws MathIllegalArgumentException Build aDerivativeStructurefrom all its derivatives.- Parameters:
derivatives- derivatives sorted according toDSCompiler.getPartialDerivativeIndex(int...)- Returns:
- a
DerivativeStructurewith specified derivatives - Throws:
MathIllegalArgumentException- if derivatives array does not match thesizeexpected by the compilerMathIllegalArgumentException- if order is too large- See Also:
-
getCompiler
Get the compiler for the current dimensions.- Returns:
- compiler for the current dimensions
-