dimforge / dimforge/nalgebra

Matrix Views: non contiguous/regular slices

Open
#1,364 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

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` 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] :

```rust
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.