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

Can't use TrustRegion with nalgebra types due to Default trait bound #187

Closed
cfunky opened this issue Feb 10, 2022 · 3 comments
Closed

Can't use TrustRegion with nalgebra types due to Default trait bound #187

cfunky opened this issue Feb 10, 2022 · 3 comments

Comments

@cfunky
Copy link
Contributor

cfunky commented Feb 10, 2022

Hello, I'm currently trying to use the TrustRegion optimizer with the Steihaug subproblem solver and nalgebra's DVector<f64> as underlying ArgminOp::Param type. Unfortunately, this doesn't seem to be possible, as both the Solver impl for TrustRegion and the Steihaug impl require the Default trait to be implemented on the ArgminOp::Param type, which is not the case for the dynamically sized nalgebra types. This is very inconvenient. Interestingly, the only place Default is actually used is to initialize the Steihaug struct which then, as far as I can tell, never uses the initialized default value. A potential fix would be to replace the affected struct fields by Option<ArgminOp::Param> and remove the Default trait bound. What are your thoughts on this?

@stefan-k
Copy link
Member

Apologies for the inconvenience and thanks for digging into this. I'm not a huge fan of unwrapping Options but in this case I think it is the only sensible option. I'm always happy to remove unnecessary trait bounds. Would you be willing to provide a PR to fix this? If not I will fix this in the next couple of days.

@cfunky
Copy link
Contributor Author

cfunky commented Feb 10, 2022

Thanks for the quick response. I've created the pull request and referenced this issue.

@stefan-k
Copy link
Member

Thanks again! :) Fixed by #192.

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