Skip to content
This repository has been archived by the owner on Dec 27, 2019. It is now read-only.

Not compatible to ndarray 0.12.0 #1

Open
astrojhgu opened this issue Sep 19, 2018 · 3 comments
Open

Not compatible to ndarray 0.12.0 #1

astrojhgu opened this issue Sep 19, 2018 · 3 comments

Comments

@astrojhgu
Copy link

when using with ndarray 0.12 following error raises, and switching to 0.11 makes it work

    = note: expected type `ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>>`
               found type `ndarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::Dim<[usize; 1]>>`
@to266
Copy link
Owner

to266 commented Sep 21, 2018

Hi there!

Thanks for reporting the issue. Could you give a minimal example that exhibits the behaviour? I'm not able to reproduce.

to266 pushed a commit that referenced this issue Oct 15, 2018
@astrojhgu
Copy link
Author

Hi, I place a test code at this respository.

I compile the code with rustc 1.32.0-nightly (8b096314a 2018-11-02).

If you set the ndarray version to 0.11.0, then it compiles, if you change it to 0.12.0, following error message appears:
error[E0308]: mismatched types --> src/main.rs:21:9 | 21 | Array1::<f64>::from_vec(vec![100.0,100.0]).view() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected structndarray::ArrayBase, found a different struct ndarray::ArrayBase| = note: expected typendarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::dimension::dim::Dim<[usize; 1]>>found typendarray::ArrayBase<ndarray::ViewRepr<&f64>, ndarray::Dim<[usize; 1]>>note: Perhaps two different versions of cratendarray` are being used?
--> src/main.rs:21:9
|
21 | Array1::::from_vec(vec![100.0,100.0]).view()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0631]: type mismatch in closure arguments
--> src/main.rs:17:28
|
17 | let result = minimizer.minimize(
| ^^^^^^^^ expected signature of for<'r> fn(ndarray::ArrayBase<ndarray::ViewRepr<&'r f64>, ndarray::dimension::dim::Dim<[usize; 1]>>) -> _
18 | move |x: ArrayView1| {
| ------------------------- found signature of for<'r> fn(ndarray::ArrayBase<ndarray::ViewRepr<&'r f64>, ndarray::Dim<[usize; 1]>>) -> _

error: aborting due to 2 previous errors

Some errors occurred: E0308, E0631.
For more information about an error, try rustc --explain E0308.
error: Could not compile opt_test.

To learn more, run the command again with --verbose.
`

@astrojhgu
Copy link
Author

Actually, I find that simply change ndarray version from 0.11 to 0.12 can solve this problem.

However, I noticed the structure of this crate has been changed: Minimizer seems to be removed and Builer moved from root to vector.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants