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
DerivativeStructure
instances.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 class
DSFactory.DSField
Field 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 DerivativeStructure
build(double... derivatives)
Build aDerivativeStructure
from all its derivatives.DerivativeStructure
constant(double value)
Build aDerivativeStructure
representing a constant value.DSCompiler
getCompiler()
Get the compiler for the current dimensions.DSFactory.DSField
getDerivativeField()
Get theField
theDerivativeStructure
instances belong to.DerivativeStructure
variable(int index, double value)
Build aDerivativeStructure
representing a variable.
-
-
-
Method Detail
-
getDerivativeField
public DSFactory.DSField getDerivativeField()
Get theField
theDerivativeStructure
instances belong to.- Returns:
Field
theDerivativeStructure
instances belong to
-
constant
public DerivativeStructure constant(double value)
Build aDerivativeStructure
representing a constant value.- Parameters:
value
- value of the constant- Returns:
- a
DerivativeStructure
representing a constant value
-
variable
public DerivativeStructure variable(int index, double value) throws MathIllegalArgumentException
Build aDerivativeStructure
representing 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
DerivativeStructure
representing a variable - Throws:
MathIllegalArgumentException
- if index if greater or equal togetCompiler()
.getFreeParameters()
.
-
build
@SafeVarargs public final DerivativeStructure build(double... derivatives) throws MathIllegalArgumentException
Build aDerivativeStructure
from all its derivatives.- Parameters:
derivatives
- derivatives sorted according toDSCompiler.getPartialDerivativeIndex(int...)
- Returns:
- a
DerivativeStructure
with specified derivatives - Throws:
MathIllegalArgumentException
- if derivatives array does not match thesize
expected 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
-
-