Make `general_mat_mul`/`general_mat_vec_mul` more discoverable

Offen
#927 5 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
30/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
rust
Bereich
data, documentation

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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?

Vorherrschende Sprache
Rust
Sterne
4.3k
Forks
391
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus rust-ndarray/ndarray

Alle Issues in rust-ndarray/ndarray

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.