multiplyInPlace method

void multiplyInPlace(
  1. ComplexArraySimd other
)

Multiplies this array by another array element-wise, in-place. (a + bi)(c + di) = (ac - bd) + i(ad + bc)

Throws ArgumentError if arrays have different lengths.

Implementation

void multiplyInPlace(ComplexArraySimd other) {
  if (length != other.length) {
    throw ArgumentError('Arrays must have the same length');
  }
  for (int i = 0; i < length; i++) {
    final z1 = _data[i];
    final z2 = other._data[i];
    final a = z1.x, b = z1.y;
    final c = z2.x, d = z2.y;
    // (a+bi)(c+di) = (ac-bd) + (ad+bc)i
    _data[i] = Float64x2(a * c - b * d, a * d + b * c);
  }
}