dimforge / dimforge/nalgebra

Converting between View and Storage is not behaving as expected

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

Description

This may be an error on my part that I just can't "see through", but nonetheless, it seems possible that there are "gaps" in trait implementations that allow for the expected casting.

When I call `&xs.into()`, I get the following error

```rust
the trait
`From, Dyn, ViewStorage<'_, f64, Const<1>, Dyn, Const<1>, Dyn>>>` is not implemented for
`Matrix>

```

when trying to invoke this function

```rust
fn dot(ws: &DVector, xs: &DMatrix) -> f64 { .. }
```

where
* xs: is an item from the row iterator for `&'a DMatrix`

All in all, I'm sending a `Const` structure (from the iterator) to a function (`dot`) that expects `Dyn`. That seems like a safe cast...

Thank you in advance for clarifying how I should get View to behave like Storage in this scenario. A likely answer is an explanation for why it's unsafe to perform this cast.

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.