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

use VectorView and VectorViewMut instead of &Vector and &mut Vector #47

Open
martinjrobins opened this issue May 7, 2024 · 3 comments

Comments

@martinjrobins
Copy link
Owner

martinjrobins commented May 7, 2024

atm the main call function for NonLinearOp is:

pub trait NonLinearOp: Op {
    /// Compute the operator at a given state and time.
    fn call_inplace(&self, x: &Self::V, t: Self::T, y: &mut Self::V);
    ...

To make this more flexible, we should use VectorView and VectorViewMut instead, ie:

pub trait NonLinearOp: Op {
    /// Compute the operator at a given state and time.
    fn call_inplace(&self, x: Self::VView, t: Self::T, y: Self::VViewMut);
    ...

This allows algorithms to call these functions with views rather than references to owned vectors. One usecase for this is to concatentate solves with varying parameters into a larger statevector

@martinjrobins
Copy link
Owner Author

needs to be done to all the callable functions, but perhaps start with call_inplace and see if there is any unexpected problems

@martinjrobins
Copy link
Owner Author

I'm a bit unsure doing this is worth the increased complexity. Could just use diffsl for concatenating solves.....

@martinjrobins
Copy link
Owner Author

however, it would allow me to reduce the amount of allocated memory for the solvers. Bdf solver stores diff as well as y and dy, even tho these overlap somewhat, simply because we need a separate vector for the state, and the op calls

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

1 participant