Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

getting no method named `svd` found for reference `&ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>`

オープン
#289 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
data

調査の方向性

Start by comparing the issue's Cargo.toml dependency configuration with ndarray-linalg's Cargo.toml and the repository's SVD tests. Run the reported example and the mentioned cargo test --features=openblas svd command; done means the SVD method is available for the shown ndarray type under the documented dependency setup.

索引モデルが issue の本文から書いたものです。

説明

Not sure if this is the write place to ask such questions but I couldn't find anywhere else more specific. I am trying to implement the (Moore-Penrose) pseudo-inverse of a matrix[1]. My code currently looks like

use ndarray::prelude::*;
use ndarray_linalg::*;
use std::cmp::min;
use thiserror::Error;

#[non_exhaustive]
#[derive(Error, Debug)]
pub enum Error {
    #[error("svd failed")]
    SvdFailed,
}

pub fn pinv(a: &Array2<f64>) -> Result<Array2<f64>, Error> {
    //a.conjugate()
    let (n, m) = a.dim();
    let result: (Option<Array1<f64>>, Array1<f64>, Option<Array1<f64>>) =
        a.svd(true, true).map_err(Error::SvdFailed)?;

I am running into issues getting

error[E0599]: no method named `svd` found for reference `&ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>` in the current scope
  --> numrs/src/linalg.rs:16:43
   |
16 |     let (u, s, vt): (_, Array1<_>, _) = a.svd(true, true).unwrap();
   |                                           ^^^ help: there is an associated function with a similar name: `std`

the dependencies part of my Cargo.toml file is the same versions as the ndarray-linalg crate on github[2]

[dependencies]
num-complex = "0.4.0"
num-traits  = "0.2.14"
rand = "0.8.3"
thiserror = "1.0.24"

[dependencies.ndarray]
version = "0.15.1"
features = ["blas", "approx", "std"]
default-features = false

#ndarray-linalg = { version = "0.13.1", features = ["openblas-static"] }
[dependencies.ndarray-linalg]
github = "https://github.com/rust-ndarray/ndarray-linalg/ndarray-linalg"
version = "0.13.1"
features = ["openblas-static"]

[dependencies.lax]
version = "0.1.0"
github = "https://github.com/rust-ndarray/ndarray-linalg/lax"
default-features = false

Any idea's what is going on here. I downloaded the ndarray-linalg source from github and the test run fine with

$ cargo test --features=openblas svd
  1. https://github.com/numpy/numpy/blob/v1.20.0/numpy/linalg/linalg.py#L1915-L2011
  2. https://github.com/rust-ndarray/ndarray-linalg/blob/master/ndarray-linalg/Cargo.toml
主要言語
Rust
スター
452
フォーク
95
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-ndarray/ndarray-linalg のほかの issue

rust-ndarray/ndarray-linalg の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。