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

Better in-place LU factorization #316

Open
SoAsEr opened this issue Jul 25, 2022 · 1 comment
Open

Better in-place LU factorization #316

SoAsEr opened this issue Jul 25, 2022 · 1 comment

Comments

@SoAsEr
Copy link

SoAsEr commented Jul 25, 2022

Currently the method factorize_into still allocates a vector for the pivots. This seems normal, but I would like an api where there is no allocation at all. Here is one possibility

impl LuFactorized {
    //updates factorization. Will resize (and therefore allocate) if neccessary.
    fn factorize(&mut self, array: &ArrayBase)
}

The other (in my opinion even more useful) api is something like this:

fn factorize(array: ArrayBase, pivot_buffer: Option<Pivot>)  -> LuFactorized


impl LuFactorized {
    fn release(self) -> (ArrayBase, Pivot)
} 

The second api is useful for the following use case

{
    let mut repeatedly_used_view = get_mut_view();
    let mut pivot_buffer : Option<Pivot> = None;
    loop {
        fill_with_info(&mut repeatedly_used_view)
        let lu_factorization=factorize(repeatedly_used_view, pivot_buffer)

        // use lu_factorization to solve stuff
        //...

        if converged {
            break;
        }

        let pair = lu_factorization.release();
        repeatedly_used_view = pair.0;
        pivot_buffer  = Some(pair.1);
    }
}
@SoAsEr
Copy link
Author

SoAsEr commented Jul 25, 2022

related: #300

Basically a factorize_inplace that also takes in a Pivot

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