-
Notifications
You must be signed in to change notification settings - Fork 47
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
Implement BiCGSTAB #340
Implement BiCGSTAB #340
Conversation
72649d2
to
85431b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some fantastic work and it's great to see a proper general solver. This will be immensely useful to users.
Making everything generic has many drawbacks, the ergonomics can get much worse and it takes a lot longer to write for dubious benefit, the macro is great for implementing the two most useful impls and we can deal with Complex
if anybody asks for it.
I only have some minor nits on this PR, I consider it good for a merge in the current state
@mulimoen I like the approx usage for testing, but had to roll it back because we don't keep approx as a default feature so it crashes the tests. I'd be happy to bring it back if we want to update either default features to include approx, or to include the approx feature for testing |
945c159
to
00d4c1e
Compare
I don't feel strongly about approx, bit of a pain to enable it for doctests. A bit of resolver history: The resolver previously merged features across build types, so having approx on during tests would enable it also for regular builds. Since we are using resolver v2 we can now use it for tests only |
Some thoughts about this implementation -
Pros
Cons
I spent a solid 8 hours attempting to make a version that is generic over the value type. This did not go well.
Some of the implementations of the underlying matrix-vector and vector-scalar operations are not fully generic, so the trait bounds on the impl end up being more than 10 lines long and incredibly unclear as to which types will and will not be compatible, and the type system ultimately fails on overflow due to inferring generic outputs across iterations in the solver loop.
This could all be fixed to some extent, but would require quite a bit of work to go back into the core of the crate and make a single definition of what trait bounds constitute a mathematical field over which we can do linear algebra, then propagate that definition to every struct and impl in the crate, which I believe is out of scope for this PR.