Unable to import traits implementation from ndarray

Abierto
#230 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
rust
Área
api

Línea de trabajo

Start by reproducing the imports and least_squares call from Cargo.toml and chow.rs:19 with the stated ndarray and ndarray-linalg versions. Check the trait implementations and method signatures for the shown Array types; done means identifying whether the example is incompatible or correcting the documented usage and adding a regression test if appropriate.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

question

Question

  • Hi I run in a problem related with LeastSquare: I am trying to import the ndarray_linalg:: {LeastSquaresSvd, LeastSquaresSvdInto, LeastSquaresSvdInPlace} . And calling from ndarray::Array1::least_squares class.
    • However the rust compiler unable to import it.

Cargo setup

  • The OS environment is running in WSL2 in windows 10
#Cargo.toml

...
[dependencies]
openblas-src = { version = "*", features = ["static"] }
ndarray = "0.12"
ndarray-linalg = { version = "0.12.0", features = ["openblas"] }
ndarray-stats = "0.3"
...
  • code snippets to
// mod.rs 
extern crate ndarray_linalg;
extern crate ndarray;
extern crate openblas_src;
pub mod foo.
...

// foo.rs
use ndarray
use ndarray_linalg::{LeastSquaresSvd, LeastSquaresSvdInto, LeastSquaresSvdInPlace};
let a= array![
            [1., 1., 1.],
            [2., 3., 4.],
            [3., 5., 2.],
            [4., 2., 5.],
            [5., 4., 3.]
        ];
 // solving for a single right-hand 
let b = array![-10., 12., 14., 16., 18.];
// let res = a.least_squares(&b);

// using `least_squares_in_place` which overwrites its arguments
// let mut a_3 = a.clone();
// let mut b_3 = b.clone();
let (m, n) = (a.shape()[0], a.shape()[1]);
let solution = b.slice(s![0..n]).to_owned();
let result = a.least_squares(&b); // unable to find  least_squares 
...
  • The error outputs
  --> keyboard-analyzer/src/models/structural_break_analysis/chow.rs:19:22
   |
19 | use ndarray_linalg::{LeastSquaresSvd, LeastSquaresSvdInto, LeastSquaresSvdInPlace};
 ....

method not found in `ndarray::ArrayBase<models::structural_break_analysis::ndarray::OwnedRepr<{float}>, 
   models::structural_break_analysis::ndarray::Dim<[usize; 2]>>`
Lenguaje dominante
Rust
Estrellas
452
Forks
95
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-ndarray/ndarray-linalg

Todos los issues de rust-ndarray/ndarray-linalg

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.