pub fn complex_vec_add(
w: &mut ComplexVector,
alpha: Complex64,
u: &ComplexVector,
beta: Complex64,
v: &ComplexVector,
) -> Result<(), StrError>Expand description
Performs the addition of two vectors
w := α⋅u + β⋅v§Examples
use russell_lab::*;
fn main() -> Result<(), StrError> {
let u = ComplexVector::from(&[10.0, 20.0, 30.0, 40.0]);
let v = ComplexVector::from(&[2.0, 1.5, 1.0, 0.5]);
let mut w = ComplexVector::new(4);
let alpha = cpx!(0.1, 0.0);
let beta = cpx!(2.0, 0.0);
complex_vec_add(&mut w, alpha, &u, beta, &v)?;
let correct = "┌ ┐\n\
│ 5+0i │\n\
│ 5+0i │\n\
│ 5+0i │\n\
│ 5+0i │\n\
└ ┘";
assert_eq!(format!("{}", w), correct);
Ok(())
}