sarah-ek / faer-rs

Linear algebra foundation for the Rust programming language
https://faer-rs.github.io
MIT License
1.79k stars 58 forks source link

Add a method to `Mat` that returns a column as a `&[E]` #50

Closed DJDuque closed 11 months ago

DJDuque commented 1 year ago

This PR adds the col_as_slice method to Mat which returns a given column as a slice of elements. I think that this is a very common thing to need (given that typical function signatures from external libraries use e.g. &[f64], etc.).

Given that the matrix structure is column-major, I thought this would be a nice quality-of-life thing to have.

I am not sure if there is a better way of writing the implementation?

Feel free to close this PR if this is something that you don't want :)

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.02 :warning:

Comparison is base (91beda5) 92.71% compared to head (a4523ab) 92.70%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #50 +/- ## ========================================== - Coverage 92.71% 92.70% -0.02% ========================================== Files 49 49 Lines 51744 51763 +19 ========================================== + Hits 47976 47986 +10 - Misses 3768 3777 +9 ``` | [Impacted Files](https://app.codecov.io/gh/sarah-ek/faer-rs/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sarah) | Coverage Δ | | |---|---|---| | [faer-core/src/lib.rs](https://app.codecov.io/gh/sarah-ek/faer-rs/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sarah#diff-ZmFlci1jb3JlL3NyYy9saWIucnM=) | `75.79% <100.00%> (+0.12%)` | :arrow_up: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/sarah-ek/faer-rs/pull/50/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sarah)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

sarah-ek commented 11 months ago

closed as (re)implemented in #53