faer-rs icon indicating copy to clipboard operation
faer-rs copied to clipboard

Issues with complex support

Open liss-h opened this issue 5 months ago • 5 comments

Describe the bug Hi :), I was fiddling around with faer and found the support around complex numbers really confusing & slightly buggy.

  1. Stack overflow on windows. The following code causes a stack overflow on windows (only in dev builds, release works)

    use num_complex::Complex;
    
    let m = Mat::<Complex<f64>>::zeros(4, 3);
    let v = Mat::<Complex<f64>>::zeros(3, 1);
    let r = m * v;
    
    println!("{r:?}");
    
  2. Additionally, for an unknown (to me) reason there is apparently no way to index a Mat<Complex<f64>>. The following code does not compile:

    let m = Mat::<Complex<f64>>::zeros(4, 3);
    let x = m[(0, 0)]; // trait error here
    

    At least to me it is not at all apparent why this doesn't work. I haven't found anything in the documentation about it.

  3. It took me a very long time to figure out that you are supposed to use c64 instead of Complex<f64>. Adding an example or some more documentation how to use complex numbers would be appreciated.

Thx :)

liss-h avatar Sep 06 '24 12:09 liss-h