-
Notifications
You must be signed in to change notification settings - Fork 3
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
Avoid LAPACK dependency for Savitzky Golay filter #11
Comments
Happy to help use it, if I can. The command line driver is pretty fancy. To just get estimated coefs you should be able to just set up the SVD and do the discard svdx(u, s, v, n, m) # SVD LHS of X.b=y design eq
for k in 0 ..< m: # Calc best fit coefs `b`
b[k] = sum0(j,m, sum0(i,n, v[k + m*j]*s[j]*u[i + n*j]*y[i])) (EDIT: update a per c-blake/fitl@268d3b4 and c-blake/fitl@8f03e5c) I was leaving that not some separate API call a) partially due to not having any users and b) to remind myself to maybe do a double-sum/triple-sum/.. More debatable in terms of clarity balance might be index calculations vs This code has a legacy in C dating back to circa y2k. If you think LAPACK/BLAS integration is a pain now...oh boy. Lol. Well, maybe diversity breeds complexity and it's even worse today. If "integration pain" were easy to quantify then a lot of things would be different. ;-) |
Thanks for your input! I had a look a few days ago, but couldn't fully get it to work. I tried on a simple example with a few points and got the correct result. But once I tried to use it for one of the examples used in the ggplotnim repo, I only got a bunch of NaNs. Didn't have time to fully investigate that yet. Essentially I need to compute the SVD of a big Vandermonde matrix (in the example O(6 x ~2400). I'll get back to you once I've done some more testing. |
In
ggplotnim
we've seen multiple times already that users have issues with the added LAPACK dependency introduced fromgeom_smooth
(the fact that it shouldn't end up as a dep. in the first place if the user doesn't usegeom_smooth
is a different issue of course).Ideally, we would use an alternative implementation to solve the least squares problem here:
https://github.com/SciNim/scinim/blob/main/scinim/signals/filters.nim#L29
(If performance allows, then fully replace it, otherwise fall back if LAPACK is not specified)
Investigate if we can use @c-blake's
fitl
:https://github.com/c-blake/fitl
for this purpose.
The text was updated successfully, but these errors were encountered: