Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

InverseHInto returns incorrect results for row major arrays

Aperta
#285 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
data

Direzione di ricerca

Reproduce the provided Rust example and inspect the invh_into entry point, especially its handling after the LAPACK routine and the triangular portion copied for row-major arrays. Done means the row-major example returns the expected matrix while the reversed-axes case continues to pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

This example

use approx::assert_abs_diff_eq;
use ndarray::*;
use ndarray_linalg::*;

fn main() {
    let arr = array![[1., 3.], [3., 1.]];
    assert_abs_diff_eq!(
        arr.invh_into().unwrap(),
        array![[-0.125, 0.375], [0.375, -0.125]],
        epsilon = 1e-9,
    );
}

fails with the following message

thread 'main' panicked at 'assert_abs_diff_eq!(arr.invh_into().unwrap(), array![[- 0.125, 0.375], [0.375, - 0.125]], epsilon = 1e-9)

    left  = [[-0.125, 3.0],
 [3.0, -0.125]], shape=[2, 2], strides=[2, 1], layout=Cc (0x5), const ndim=2
    right = [[-0.125, 0.375],
 [0.375, -0.125]], shape=[2, 2], strides=[2, 1], layout=Cc (0x5), const ndim=2

It seems that invh_into is copying the incorrect triangular portion to overwrite the other triangular portion of the matrix after calling the LAPACK routine. This bug is layout-dependent. Changing arr in the example to array![[1., 3.], [3., 1.]].reversed_axes() causes the assertion to pass.

Lingua principale
Rust
Stelle
452
Fork
95
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-ndarray/ndarray-linalg

Tutte le issue di rust-ndarray/ndarray-linalg

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.