Closed BryanCazabonne closed 4 years ago
If you agree with that proposal, I can perform the change.
I thought about it this afternoon, but we cannot do it for 1.7. This is a public interface and we can neither add methods to it nor generalize existing methods in a compatible way. to be more precise, I thought about replacing DerivativeStructure
with the new Derivative
top level interface added this afternoon. This change would imply all users that implemented it in their own code would need to update their code. It has to wait for 2.0.
I made this proposal because I want to be able to use this new method with the HermiteInterpolator
(and afterwards in Orekit). I agree that the simplest and cleanest way is to wait for version 2.0.
To make this change for a minor version, there is a working but a bit ugly way. Indeed, it is possible to add a new interface that would extend UnivariateDifferentiableVectorFunction
. Something like ExtendedUnivariateDifferentiableVectorFunction
(even the name is a bit ugly). This new interface would have the method signature with Gradient
. Finally, this new interface would be implemented by the HermiteInterpolator
.
/**
* Extension of {@link UnivariateDifferentiableVectorFunction} for {@link Gradient}.
*
*/
public interface ExtendedUnivariateDifferentiableVectorFunction
extends UnivariateDifferentiableVectorFunction {
/**
* Compute the value for the function.
* @param x the point for which the function value should be computed
* @return the value
* @exception MathIllegalArgumentException if {@code x} does not
* satisfy the function's constraints (argument out of bound, or unsupported
* derivative order for example)
*/
Gradient[] value(Gradient x) throws MathIllegalArgumentException;
}
And
public class HermiteInterpolator implements ExtendedUnivariateDifferentiableVectorFunction {
// All the methods
}
To be consistent with the other interfaces, we can also add ExtentedUnivariateDifferentiableMatrixFunction
and ExtendedUnivariateDifferentiableFunction
classes
Then let the interface have signature:
<T extends Derivative> T[] value(T x)
Do you intend to implement ExtendedUnivariateDifferentiableVectorFunction
for 1.7?
I would like. I will do that this morning and provide a pull request at the beginning of the afternoon.
UnivariateDifferentiableVectorFunction
interface represents an univariate differentiable vectorial function. Currently it contains only one method.It can be a good enhancement to also add a new method signature using Gradient:
That's just an idea but it can be interesting to also add method signatures using
UnivariateDerivative1
andUnivariateDerivative2
classes.