public abstract class PartialDerivativesEvaluator extends DynamicMatrixEvaluator
JulianDate
, order, and list of
inputs and returns the partial derivatives of itself with respect to those inputs.Modifier | Constructor and Description |
---|---|
protected |
PartialDerivativesEvaluator(EvaluatorGroup group,
List<IPartialDifferentiable> independentVariables,
IPartialDifferentiable partialsOf,
List<IPartialDifferentiable> withRespectTo)
Initializes a new instance that will evaluate the partial derivatives of the given
partialsOf
IPartialDifferentiable with respect to the given withRespectTo list of IPartialDifferentiable . |
protected |
PartialDerivativesEvaluator(PartialDerivativesEvaluator existingInstance,
CopyContext context)
Initializes a new instance as a copy of an existing instance.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
evaluate(JulianDate date)
Calls
PartialDerivativesEvaluator.evaluatePartialsOfChildren(agi.foundation.time.JulianDate) to calculate the partials derivatives of DependentVariable (get )
with respect to all variables in IndependentVariables (get ) except for DependentVariable (get ), and then adds
on the terms for the partial derivatives of DependentVariable (get ) with respect to itself, if necessary. |
Motion1<Matrix> |
evaluate(JulianDate date,
int order)
PartialDerivativeEvaluators only calculate zeroth order values,
this method returns a Motion1 of order zero regardless of the requested order. |
abstract Matrix |
evaluatePartialsOfChildren(JulianDate date)
Evaluates the partials derivatives of
DependentVariable (get )
with respect to all variables in IndependentVariables (get ) except for DependentVariable (get ),
as that is taken care of by PartialDerivativesEvaluator.evaluate(JulianDate) . |
IEvaluator |
getCachingWrapper()
Gets a version of this evaluator that caches the previously computed value so that if it is evaluated
twice at the same date the computation is done only once.
|
IPartialDifferentiable |
getDependentVariable()
Gets the
IPartialDifferentiable identifying the object that the partial derivatives calculated
during evaluation are of. |
List<IPartialDifferentiable> |
getIndependentVariables()
Gets the list of
IPartialDifferentiables identifying the objects
that the partial derivatives calculated during evaluation are with respect to. |
getColumnDimension, getRowDimension
evaluate, evaluate, evaluate, evaluate, getAvailabilityIntervals, getAvailabilityIntervals, getGroup, getIsTimeVarying, isAvailable, updateEvaluatorReferences
clone, dispose, dispose, getIsThreadSafe, getNextSampleSuggestion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIsThreadSafe
clone
close, dispose
protected PartialDerivativesEvaluator(@Nonnull EvaluatorGroup group, @Nonnull List<IPartialDifferentiable> independentVariables, @Nonnull IPartialDifferentiable partialsOf, @Nonnull List<IPartialDifferentiable> withRespectTo)
Initializes a new instance that will evaluate the partial derivatives of the given partialsOf
IPartialDifferentiable
with respect to the given withRespectTo
list of IPartialDifferentiable
.
The RowDimension
(get
) of this instance will be equal to the Dimension
(get
)
of partialsOf
. The ColumnDimension
(get
) of this instance will be equal to the summation of the
Dimension
(get
) of objects in the withRespectTo
list.
group
- The group that contains this evaluator.independentVariables
- The list of IPartialDifferentiable
representing the independent variables of the partial derivative calculation.partialsOf
- The IPartialDifferentiable
that the evaluated matrix will represent partials of.withRespectTo
- The list of IPartialDifferentiables
from the independentVariables
that partialsOf
has non-zero partials with respect to.
This could be an empty list, a subset of the independentVariables list, or the entire independentVariable list.
Do not include partialsOf
in this list. If partialsOf is an independentVariable this base class constructor will perform the
necessary adjustments to account for the partial derivatives of the subject with respect to itself.protected PartialDerivativesEvaluator(@Nonnull PartialDerivativesEvaluator existingInstance, @Nonnull CopyContext context)
See ICloneWithContext.clone(CopyContext)
for more information about how to implement this constructor
in a derived class.
existingInstance
- The existing instance to copy.context
- A CopyContext
that controls the depth of the copy.ArgumentNullException
- Thrown when existingInstance
or context
is null
.public IEvaluator getCachingWrapper()
This method is called by EvaluatorGroup
to create a caching version of an evaluator
that is shared between multiple computations.
To implement this method in your own evaluator, construct and return a caching version of the evaluator's base class.
For example, if your evaluator implements IEvaluator1
directly, return an instance of
CachingEvaluator
. In many cases, such as when implementing a PointEvaluator
this method does not need to be overridden because the default implementation returns an appropriate
caching wrapper already. If you do not want the last value computed by your evaluator to ever be cached, or
if your evaluator does its own caching internally, this method can return this
.
Shows an example implementation in an evaluator that implements IEvaluator1
directly, where T is double.
@Override
public IEvaluator getCachingWrapper() {
return new CachingEvaluator<Double>(this);
}
getCachingWrapper
in interface IEvaluator
getCachingWrapper
in class DynamicMatrixEvaluator
this
should be returned by this method.public final IPartialDifferentiable getDependentVariable()
IPartialDifferentiable
identifying the object that the partial derivatives calculated
during evaluation are of.public final List<IPartialDifferentiable> getIndependentVariables()
Gets the list of IPartialDifferentiables
identifying the objects
that the partial derivatives calculated during evaluation are with respect to.
As an optimization this is typically only the subset of the independentVariables provided to
IPartialDifferentiable.getPartialDerivativesEvaluator(java.util.List<agi.foundation.numericalmethods.advanced.IPartialDifferentiable>, agi.foundation.EvaluatorGroup)
for which the DependentVariable
(get
)
has non-zero partials, however a user-implemented PartialDerivativesEvaluator
does not have to follow that pattern.
This list of variables corresponds to the columns of the Matrix
produced by PartialDerivativesEvaluator.evaluate(JulianDate)
.
Each IPartialDifferentiable
in this list has a number of columns equal to its
Dimension
(get
), and those column groupings follow the same order as this list.
In addition, this list, while possible a subset of the independent variables specified by the user, will always be in the same
order as that original list.
@Nonnull public Motion1<Matrix> evaluate(@Nonnull JulianDate date, int order)
PartialDerivativeEvaluators
only calculate zeroth order values,
this method returns a Motion1
of order zero regardless of the requested order.evaluate
in class MotionEvaluator1<Matrix>
date
- The date at which to calculate the partial derivatives.order
- This requested order is disregarded.Matrix
representing the partial derivatives
of the DependentVariable
(get
) object with respect to the objects in IndependentVariables
(get
).public Matrix evaluate(@Nonnull JulianDate date)
PartialDerivativesEvaluator.evaluatePartialsOfChildren(agi.foundation.time.JulianDate)
to calculate the partials derivatives of DependentVariable
(get
)
with respect to all variables in IndependentVariables
(get
) except for DependentVariable
(get
), and then adds
on the terms for the partial derivatives of DependentVariable
(get
) with respect to itself, if necessary.evaluate
in interface IEvaluator1<Matrix>
evaluate
in class MotionEvaluator1<Matrix>
date
- The date at which to calculate the partial derivatives.Matrix
representing the partial derivatives
of the DependentVariable
(get
) object with respect to the objects in IndependentVariables
(get
).public abstract Matrix evaluatePartialsOfChildren(@Nonnull JulianDate date)
DependentVariable
(get
)
with respect to all variables in IndependentVariables
(get
) except for DependentVariable
(get
),
as that is taken care of by PartialDerivativesEvaluator.evaluate(JulianDate)
.date
- The date at which to calculate the partial derivatives.Matrix
representing the partial derivatives
of the DependentVariable
(get
) object with respect to any of the objects
(with the exception of DependentVariable
(get
)) in IndependentVariables
(get
).