Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use custom jacobian implementation. #21

Open
lassepe opened this issue Sep 24, 2019 · 4 comments
Open

Allow to use custom jacobian implementation. #21

lassepe opened this issue Sep 24, 2019 · 4 comments

Comments

@lassepe
Copy link
Collaborator

lassepe commented Sep 24, 2019

For prototyping, ForwardDiff.jacobian is very good but it still allocates significantly more memory than a hand-written Jacobian.

F = ForwardDiff.jacobian-> filter.d.f(μ, u), b0.μ)

H = ForwardDiff.jacobian-> filter.o.h(μ, u), bp.μ)

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.

@zsunberg
Copy link
Member

@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?

@lassepe
Copy link
Collaborator Author

lassepe commented Sep 25, 2019

The latter is the case.

@lassepe
Copy link
Collaborator Author

lassepe commented Sep 25, 2019

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.

@zsunberg
Copy link
Member

right - that makes a lot of sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants