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

Error whilst trying the example the trait AsRef<[_]> is not implemented #3

Closed
wlwatkins opened this issue Jan 15, 2023 · 5 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@wlwatkins
Copy link

I cannot run the example, I surely did something wrong, but the &x, &y and &w are underlined basically saying the AsRef trait is not implemented?Cargo.toml:
ndarray = {version = "0.15.6", feature =["rayon"]}
ndarray-linalg = { version = "0.16.0", features = ["intel-mkl-static"] }
csaps = "0.3.0"

// some of the imports are not used
use csaps::CubicSmoothingSpline;
use ndarray::{array, Array1, Array2, Zip, Axis, ArrayView2, ArrayView1, stack, Array, Dim, ArrayViewMut};
    let x = array![1.0, 2.0, 3.0, 4.0];
    let y = array![0.5, 1.2, 3.4, 2.5];
    let w = array![1.0, 0.7, 0.5, 1.0];
    let smooth = 0.85;

    let s = CubicSmoothingSpline::new(&x, &y)
        .with_weights(&w)
        .with_smooth(smooth)
        .make().unwrap();
error[E0277]: the trait bound `ArrayBase<OwnedRepr<{float}>, Dim<[usize; 1]>>: AsRef<[_]>` is not satisfied
   --> src\wmap\apply.rs:61:39
    |
61  |     let s = CubicSmoothingSpline::new(&x, &y)
    |             ------------------------- ^^ the trait `AsRef<[_]>` is not implemented for `ArrayBase<OwnedRepr<{float}>, Dim<[usize; 1]>>`
    |             |
    |             required by a bound introduced by this call
    |
    = note: required for `ndarray::ArrayBase<ndarray::ViewRepr<&_>, ndarray::dimension::dim::Dim<[usize; 1]>>` to implement `From<&ArrayBase<OwnedRepr<{float}>, Dim<[usize; 1]>>>`
    = note: required for `&ArrayBase<OwnedRepr<{float}>, Dim<[usize; 1]>>` to implement `Into<ndarray::ArrayBase<ndarray::ViewRepr<&_>, ndarray::dimension::dim::Dim<[usize; 1]>>>`
    = note: required for `&ArrayBase<OwnedRepr<{float}>, Dim<[usize; 1]>>` to implement `ndarray::arraytraits::AsArray<'_, _>`
note: required by a bound in `CubicSmoothingSpline::<'a, T, D>::new`
@wlwatkins
Copy link
Author

Ok so apparently it is because csaps uses ndarray 0.13, and now we are at 0.15 with breaking changes.
Are there any plans of updating the crate?

@espdev espdev added the help wanted Extra attention is needed label Jan 17, 2023
@espdev
Copy link
Owner

espdev commented Jan 17, 2023

Refers to: #2

@espdev
Copy link
Owner

espdev commented Jan 17, 2023

Hi @willmendil

I'm sorry, I don't have time to deal with this package right now. Any help and PRs are welcome.

@wlwatkins
Copy link
Author

Thanks for the insight. I'll take a look, but I don't think I have the skills to fix it.

@espdev
Copy link
Owner

espdev commented Sep 29, 2024

Seems fixed in #2 and #4

@espdev espdev closed this as completed Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants