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

Add RQ decomposition

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust
領域
data

調査の方向性

Start with the existing qr API and its LAPACK bindings, then investigate how gerqf applies to row-major arrays and what the equivalent is for column-major storage. Done means a built-in RQ decomposition API handles the relevant array layouts and returns the R and Q factors described in the issue.

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

説明

Hello, and thanks for the great library. I would like to request the addition of RQ decomposition. Although it's fairly trivial to implement RQ in terms of QR (link), it still took me quite some time to figure this out even with AI help (which used extra unnecessary flips).

One thing that made this challenging for me was that qr does not accept arrays with negative strides, so any slice had to then be copied into another backing array. This is ultimately what I ended up with:

use ndarray::Data;
use ndarray::prelude::*;
use ndarray_linalg::error::Result;
use ndarray_linalg::{Lapack, QRInto, Scalar};

pub trait RQ {
    type R;
    type Q;
    fn rq(&self) -> Result<(Self::R, Self::Q)>;
}

impl<A, S> RQ for ArrayBase<S, Ix2>
where
    A: Scalar + Lapack,
    S: Data<Elem = A>,
{
    type R = Array2<A>;
    type Q = Array2<A>;

    fn rq(&self) -> Result<(Self::R, Self::Q)> {
        let a = Array::from_shape_vec(
            self.raw_dim(),
            self.slice(s![..;-1,..]).t().iter().cloned().collect(),
        )?;

        let (q, r) = a.qr_into()?;

        let q = Array::from_shape_vec(
            q.raw_dim(),
            q.t().slice(s![..;-1,..]).iter().cloned().collect(),
        )?;
        let r = Array::from_shape_vec(
            r.raw_dim(),
            r.t().slice(s![..;-1,..;-1]).iter().cloned().collect(),
        )?;
        Ok((r, q))
    }
}

A built-in RQ would ideally use gerqf for row major arrays. Not sure what the equivalent would be for column major.

主要言語
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 を短くまとめたダイジェスト。