Inverse of interpolated model is misleading
Closed this issue · 1 comments
minnerbe commented
Currently, the implementation of InterpolatedAffineModel2D
creates its 'inverse' by inverting its constituents:
public InterpolatedAffineModel2D<A, B> createInverse() {
final InterpolatedAffineModel2D<A, B> inverse = new InterpolatedAffineModel2D<>(a.createInverse(), b.createInverse(), lambda);
inverse.cost = cost;
return inverse;
}
This leads to model.createInverse().apply(point)
not being equal to model.applyInverse(point)
, which is (correctly) implemented as applying the inverse of the internally computed interpolated AffineModel2D
.
I find this behavior to be very misleading to the point that I don't see any value in implementing createInverse()
at all.
Rather, I think it should just throw an UnsupportetOperationException
, since there is no way to guarantee that the interpolated model is invertible just by having invertible constituents.