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

Matrix Views: non contiguous/regular slices #1364

Open
diviyank opened this issue Feb 29, 2024 · 0 comments
Open

Matrix Views: non contiguous/regular slices #1364

diviyank opened this issue Feb 29, 2024 · 0 comments

Comments

@diviyank
Copy link

Hello,

First of all, thank you for this awesome crate.

I have a question on views: I which to build a Matrix view out of an initial DMatrix M, rather large because it contains datapoints.
This view is actually non-regular and non contiguous: it depends on a vector V :Vec<usize> of indexes that contains the columns to select.

I can use the M.select_columns(V.iter()) to obtain the correct matrix, but if I understood correctly, this actually makes a copy of the selected elements, which in my use-case, could be quite large and quite expensive as well.

Is there a way to obtain a view of the data using V ?

context: This would be to compute the regression coefficients of the regression of one column w.r.t. data[V] :

    let selected_data = M.select_columns(V.iter());

    let qr = selected_data.qr();
    let (q, r) = (qr.q().transpose(), qr.r());
    let x = r.try_inverse().unwrap() * &q * &data.column(ref_node.to_owned());

Thank you,
D

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