Scalar operations with complex array and complex scalars

Offen
#781 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
rust
Bereich
data

Rechercherichtung

The issue provides a Rust reproduction using ndarray arrays and num_complex::Complex64; start by tracing ndarray's scalar operator implementations and existing multiplication tests. Check the trait constraints for combinations of Complex64 and f64. Done means the reported operations have regression coverage and work as requested, or their unsupported status is clearly explained.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi there,

thanks a lot for the nice library! I hope this is the right place to ask questions! Please feel free to close if it's not.

I am having problems understanding why the following is not working.

use num_complex::Complex64;
use ndarray::arr1;

fn main() {
    let complex_array = arr1(&[Complex64::from(1.0), Complex64::from(2.0)]);
    let complex_scalar = Complex64::from(1.0);
    let f_scalar = 1.0;
    let f_array = arr1(&[1.0, 2.0]);
    println!("{}", &complex_array * f_scalar);
    println!("{}", &complex_array * complex_scalar);
    println!("{}", complex_scalar * &complex_array);
    // println!("{}", complex_scalar * &f_array); // <- not working
    // println!("{}", f_scalar * complex_array); // <- not working
}

I could circumvent these problems by manually iterating through arrays but it makes the code less readable and less ergonomic. Maybe someone could help me understand why these operations are a problem.

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.