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

assertion at VectorView3::<T>::from(&view3_from_owned3).clone_owned() #1326

Open
Lishen1 opened this issue Nov 27, 2023 · 0 comments
Open

assertion at VectorView3::<T>::from(&view3_from_owned3).clone_owned() #1326

Lishen1 opened this issue Nov 27, 2023 · 0 comments
Labels

Comments

@Lishen1
Copy link

Lishen1 commented Nov 27, 2023

nalgebra=0.32.3
minimal example that reproduces the issue:

    let owned_vec_10 = DVector::<f64>::zeros(10);
    let segment_view_from_owned_10: DVectorView<f64> = owned_vec_10.rows(3, 3);
    assert_eq!(segment_view_from_owned_10.len(), 3); // OK
    assert_eq!(segment_view_from_owned_10.ncols(), 1); // OK
    assert_eq!(segment_view_from_owned_10.nrows(), 3); // OK

    let owned3_from_segment_view: DVector<f64> = segment_view_from_owned_10.clone_owned();
    assert_eq!(owned3_from_segment_view.len(), 3); // OK
    assert_eq!(owned3_from_segment_view.ncols(), 1); // OK
    assert_eq!(owned3_from_segment_view.nrows(), 3); // OK

    let view3_from_owned3: DMatrixView<f64> = owned3_from_segment_view.as_view();
    assert_eq!(view3_from_owned3.len(), 3); // OK
    assert_eq!(view3_from_owned3.ncols(), 1); // OK
    assert_eq!(view3_from_owned3.nrows(), 3); // OK

    let vt = VectorView3::<T>::from(&view3_from_owned3); //OK

    let t: Vector3<T> = VectorView3::<T>::from(&view3_from_owned3).clone_owned(); //OK
    let t: Vector3<T> = VectorView3::<T>::from(&segment_view_from_owned_10).clone_owned(); //PANIC!
thread 'main' panicked at nalgebra-0.32.3/src/base/dimension.rs:275:9:
assertion `left == right` failed
  left: 10
 right: 3

expected that let t: Vector3<T> = VectorView3::<T>::from(...).clone_owned() can be constructed from any view of suitable shape

@Andlon Andlon added the bug label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants