Make `general_mat_mul`/`general_mat_vec_mul` more discoverable

Aperta
#927 5 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
30/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust

Direzione di ricerca

Start with the linked general_mat_mul and general_mat_vec_mul documentation in the linalg module, then read the docs for the dot methods and Dot trait. Clarify whether the change should only improve documentation or also add the proposed GeneralDot trait and ArrayBase methods; done means the agreed functionality is discoverable and documented.

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

Descrizione

The general_mat_mul and general_mat_vec_mul functions are not easy to find, since they're in the linalg module while most other functionality is available either at the top level of the crate or as methods on the array types.

At a minimum, we should mention them in the docs for the dot methods and Dot trait.

However, I think it would also be useful to expose the functionality as methods on ArrayBase. I'd suggest adding a trait like this:

/// General matrix multiplication.
pub trait GeneralDot<A, Rhs1, Rhs2> {
    /// Perform general matrix-matrix multiplication, modifying `self` in-place.
    ///
    /// Compute C ← α A B + β C, where `self` is C.
    ///
    /// The array shapes must agree in the way that if `a` is *M* × *N*, then
    /// `b` is *N* × *K* and `self` is *M* × *K*.
    ///
    /// ***Panics*** if array shapes are not compatible<br>
    /// *Note:* If enabled, uses blas `gemm` for elements of `f32, f64` when memory
    /// layout allows.  The default matrixmultiply backend is otherwise used for
    /// `f32, f64` for all memory layouts.
    fn mul_add_scaled_dot_inplace(
        &mut self,
        beta: A,
        alpha: A,
        a: &Rhs1,
        b: &Rhs2,
    );
}

and then add mul_add_scaled_dot_inplace methods which use this trait to ArrayBase<S, Ix1> and ArrayBase<S, Ix2>. What do you think?

Lingua principale
Rust
Stelle
4.3k
Fork
391
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

Tutte le issue di rust-ndarray/ndarray

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.