Skip to main content

c

Function c 

Source
pub fn c(re: f64, im: f64) -> Complex64
Expand description

Shorthand for Complex64::new(re, im).

Most real constants (1.0, 5.0, etc.) work directly in arithmetic with Complex64 values — use c only when you need a genuinely complex constant.

use vecfit::c;
use num_complex::Complex64;

let s = Complex64::new(0.0, 10.0);
// With c():
let h = 0.05 + c(0.8, -0.5) / (s + c(5.0, -50.0));
// Without:
let h2 = 0.05 + Complex64::new(0.8, -0.5) / (s + Complex64::new(5.0, -50.0));
assert_eq!(h, h2);