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

Can't compile svm example #361

Open
wormtql opened this issue Oct 13, 2024 · 1 comment
Open

Can't compile svm example #361

wormtql opened this issue Oct 13, 2024 · 1 comment

Comments

@wormtql
Copy link

wormtql commented Oct 13, 2024

I'm executing exactly the same code as the winequality_svm example, with my Cargo.toml as close as possible to the example Cargo.toml

[package]
name = "svm_example"
version = "0.1.0"
edition = "2021"

[dependencies]
linfa-svm = "0.7.0"
linfa = "0.7.0"
linfa-datasets = { version = "0.7.0", features = ["winequality", "diabetes"] }
ndarray = "0.15"
num-traits = "0.2"
linfa-kernel = "0.7.0"

My rust toolchain is nightly 1.83.0
And got the compiler error:

error[E0277]: cannot multiply `&CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>` by `&ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>`
  --> C:\Users\admin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\linfa-kernel-0.7.0\src\inner.rs:64:18
   |
64 |         self.mul(rhs)
   |              --- ^^^ no implementation for `&CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>> * &ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>`
   |              |
   |              required by a bound introduced by this call
   |
   = help: the trait `Mul<&ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>>` is not implemented for `&CsMatBase<F, usize, Vec<usize>, Vec<usize>, Vec<F>>`
   = help: the following other types implement trait `Mul<Rhs>`:
             `&CsMatBase<N, I, IpS, IS, DS, Iptr>` implements `Mul<&ndarray::ArrayBase<DS2, ndarray::dimension::dim::Dim<[usize; 1]>>>`
             `&CsMatBase<N, I, IpS, IS, DS, Iptr>` implements `Mul<&ndarray::ArrayBase<DS2, ndarray::dimension::dim::Dim<[usize; 2]>>>`
             `&CsMatBase<N, I, IpS1, IS1, DS1, Iptr>` implements `Mul<&CsMatBase<N, I, IpS2, IS2, DS2, Iptr>>`
             `&CsMatBase<N, I, IpS1, IS1, DS1, Iptr>` implements `Mul<&CsVecBase<IS2, DS2, N, I>>`
             `&CsMatBase<f32, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<f32>`
             `&CsMatBase<f64, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<f64>`
             `&CsMatBase<i16, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<i16>`
             `&CsMatBase<i32, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<i32>`
           and 8 others

error[E0277]: cannot multiply `&CsMatBase<F, usize, &[usize], &[usize], &[F]>` by `&ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>`
   --> C:\Users\admin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\linfa-kernel-0.7.0\src\inner.rs:109:18
    |
109 |         self.mul(rhs)
    |              --- ^^^ no implementation for `&CsMatBase<F, usize, &[usize], &[usize], &[F]> * &ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the trait `Mul<&ndarray::ArrayBase<ViewRepr<&F>, Dim<[usize; 2]>>>` is not implemented for `&CsMatBase<F, usize, &[usize], &[usize], &[F]>`
    = help: the following other types implement trait `Mul<Rhs>`:
              `&CsMatBase<N, I, IpS, IS, DS, Iptr>` implements `Mul<&ndarray::ArrayBase<DS2, ndarray::dimension::dim::Dim<[usize; 1]>>>`
              `&CsMatBase<N, I, IpS, IS, DS, Iptr>` implements `Mul<&ndarray::ArrayBase<DS2, ndarray::dimension::dim::Dim<[usize; 2]>>>`
              `&CsMatBase<N, I, IpS1, IS1, DS1, Iptr>` implements `Mul<&CsMatBase<N, I, IpS2, IS2, DS2, Iptr>>`
              `&CsMatBase<N, I, IpS1, IS1, DS1, Iptr>` implements `Mul<&CsVecBase<IS2, DS2, N, I>>`
              `&CsMatBase<f32, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<f32>`
              `&CsMatBase<f64, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<f64>`
              `&CsMatBase<i16, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<i16>`
              `&CsMatBase<i32, I, IpStorage, IStorage, DStorage, Iptr>` implements `Mul<i32>`
            and 8 others

For more information about this error, try `rustc --explain E0277`.
error: could not compile `linfa-kernel` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
@Sean-WangXin
Copy link

same error for me with rustc 1.80.0 (051478957 2024-07-21)

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

No branches or pull requests

2 participants