Skip to content

solve_into method not found in Example code #259

Closed
@MrGibus

Description

@MrGibus

Trying to run the following code:

Cargo.toml

[dependencies]
ndarray = "0.14.0"
ndarray-linalg = "0.12.1"
lapack-src = { version = "0.6", features = ["intel-mkl"] }

main.rs

#[macro_use]
extern crate ndarray;
extern crate ndarray_linalg;

use ndarray::prelude::*;
use ndarray_linalg::Solve;

fn main() {
  let a: Array2<f64> = array![[3., 2., -1.], [2., -2., 4.], [-2., 1., -2.]];
  let b: Array1<f64> = array![1., -2., 0.];
  let x = a.solve_into(b).unwrap();
  assert!(x.all_close(&array![1., -2., -2.], 1e-9));
}

error:

warning: unused `#[macro_use]` import
 --> src\main.rs:1:1
  |
1 | #[macro_use]
  | ^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0599]: no method named `solve_into` found for struct `ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>` in the current scope
  --> src\main.rs:10:15
   |
10 |     let x = a.solve_into(b).unwrap();
   |               ^^^^^^^^^^ method not found in `ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>`

examples and tests:

PS C:\Users\Gibus\.git\ndarray-linalg\ndarray-linalg> cargo run --example solve --features intel-mkl
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
cargo test --features intel-mkl
...

All tests pass successfully.
Using Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions