Allow to use custom jacobian implementation.
lassepe opened this issue · 4 comments
For prototyping, ForwardDiff.jacobian
is very good but it still allocates significantly more memory than a hand-written Jacobian.
Line 26 in bc24efe
Line 73 in bc24efe
I think the user should be allowed to overload these functions by implementing something like GaussianFilters.linear_obsmodel
and GaussianFilters.linear_dynamics
. You can provide a default implementation based in ForwardDiff.jacobian
of these methods and for the linear cases, you can provide a simple identity. By this means, you can avoid the manual type checking and let dispatch do the magic.
@lassepe just out of curiosity, can the performance problems of ForwardDiff be avoided by the user by them implementing a method of jacobian? or does that not work because of the mu -> filter.d.f(mu, u)
anonymous function?
The latter is the case.
Also, this would not be very desirable because the user might want to use another AD tool like Zygote. It would be very weird for the user to write a version of ForwardDiff.jacobian
that just calls another AD.
right - that makes a lot of sense