arrayComplexConjugate function Null safety

ArrayComplex arrayComplexConjugate(
  1. ArrayComplex a
)

Conjugate of all elements of the current array

Examples

var list = ArrayComplex([
  Complex(real: 1.0, imaginary: 1.0),
  Complex(real: 2.0, imaginary: 2.0) ,
  Complex(real: 3.0, imaginary: 3.0) ]);

print(arrayComplexConjugate(list));

/* expected output:
ArrayComplex([Complex(real: 1.0, imaginary: -1.0), Complex(real: 2.0, imaginary: -2.0), Complex(real: 3.0, imaginary: -3.0)])
*/

Implementation

ArrayComplex arrayComplexConjugate(ArrayComplex a) {
  var c = ArrayComplex.fixed(a.length);
  for (var i = 0; i < a.length; i++) {
    c[i] = complexConjugate(a[i]);
  }
  return c;
}