Class DSFactory
- java.lang.Object
-
- org.hipparchus.analysis.differentiation.DSFactory
-
- All Implemented Interfaces:
Serializable
public class DSFactory extends Object implements Serializable
Factory forDerivativeStructure.This class is a factory for
DerivativeStructureinstances.Instances of this class are guaranteed to be immutable.
- Since:
- 1.1
- See Also:
DerivativeStructure, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDSFactory.DSFieldField for {link DerivativeStructure} instances.
-
Constructor Summary
Constructors Constructor Description DSFactory(int parameters, int order)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DerivativeStructurebuild(double... derivatives)Build aDerivativeStructurefrom all its derivatives.DerivativeStructureconstant(double value)Build aDerivativeStructurerepresenting a constant value.DSCompilergetCompiler()Get the compiler for the current dimensions.DSFactory.DSFieldgetDerivativeField()Get theFieldtheDerivativeStructureinstances belong to.DerivativeStructurevariable(int index, double value)Build aDerivativeStructurerepresenting a variable.
-
-
-
Method Detail
-
getDerivativeField
public DSFactory.DSField getDerivativeField()
Get theFieldtheDerivativeStructureinstances belong to.- Returns:
FieldtheDerivativeStructureinstances belong to
-
constant
public DerivativeStructure constant(double value)
Build aDerivativeStructurerepresenting a constant value.- Parameters:
value- value of the constant- Returns:
- a
DerivativeStructurerepresenting a constant value
-
variable
public DerivativeStructure variable(int index, double value) throws MathIllegalArgumentException
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:
DerivativeStructure.getAllDerivatives()
-
getCompiler
public DSCompiler getCompiler()
Get the compiler for the current dimensions.- Returns:
- compiler for the current dimensions
-
-