-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
BFGS with nalgebra Vector2 #337
Comments
Hi, apologies for the late reply! Thanks for the kind words, I am always happy to hear when people find argmin useful :) Admittedly, I'm not an expert on nalgebra. Most work on the nalgebra backend was done by collaborators, but from a first glance most traits were implemented for the seemingly most general The error message you get does seem a bit strange though. I'm not sure if this is related, but there are some inconsistencies regarding the use of type Param = Vector2<f64>;
type Output = f64; and let init_hess = Matrix2::<f32>::identity(); It would be interesting to see if changing the latter to EDIT: .inv_hess(init_hess) |
Thanks for that, hadn't spotted those mistakes from messing around trying some different things. Unfortunately, the issue arises before the hessian is even checked for trait bounds. I can comment out the lines defining let res = Executor::new(cost, solver); |
I did some detective work but just ended up being confused. The type of the Hessian is inferred by whatever one passes into Interestingly, I don't even get it to work with I will have to do a more in-depth investigation of this, but I'm afraid that this may take a while because my time currently is pretty limited. I will do my best though. If you or someone else wants to have a go at this, feel free to do so. Thanks for reporting this issue! :) |
It did feel like something was fundamentally off. Thanks for looking into it! My problem is actually just least squares fitting, so I'll probably end up going with a Gauss-Newton like method. Although I have an awful lot of spots to fit, so I might start looking into implementing one of the algorithms on a GPU with wgpu instead. Once again thanks for the very readable source files :)) |
To possibly add to the confusion (sorry!) I am using Typically, when I've had trait bound issues with nalgebra, its due to conflicting versions. You need to be sure to match the For example, I have:
Hope this help! |
I am running into the same problem with P: /* ... */ + ArgminDot<G, H> + ArgminDot<P, H>, In the nalgebra case, and The latter is the one that should be used, but if both vectors are either row- or column-vectors, it resorts to the former. In the ndarray impl, it just assumes that the first is a row- and the second a column-vector when a matrix is requested as output. I'm surprised it works for I'm not that familiar with nalgebra unfortunately. Could anyone with nalgebra experience help? |
is this right? The signature is: impl<...> ArgminDot<N, OMatrix<...>> for Matrix<...> so doesn't this implement |
Oh yes that's correct, I must have meant this part: argmin/crates/argmin-math/src/nalgebra_m/dot.rs Lines 23 to 39 in e9bebb2
|
Hi, amazing crate! As someone looking to get further into numerical optimization, just the fact that all of these algorithms are gathered in one place, with trait bounds explaining what each algorithm needs is just amazing, so thanks for that :)
I've been trying to get the BFGS example to work on my system and have rewritten it in an attempt to have it work on nalgebra's Vector2 (importantly not DVector, as I would like the performance benefits of stack allocating my params). This is my current code
However, I'm getting the following compiler error
It's unclear to me why ArgminEye should be required for f64 in this case? What can I do to get BFGS to work with the statically sized types of ndalgebra for that sweet, sweet stack allocation?
Once again, thanks for the amazing work and the time to help me with my issue :)
The text was updated successfully, but these errors were encountered: