zdscal function

void zdscal(
  1. int N,
  2. double DA,
  3. Array<Complex> ZX_,
  4. int INCX,
)

Implementation

void zdscal(
  final int N,
  final double DA,
  final Array<Complex> ZX_,
  final int INCX,
) {
  final ZX = ZX_.having();
  const ONE = 1.0;

  if (N <= 0 || INCX <= 0 || DA == ONE) return;

  if (INCX == 1) {
    // code for increment equal to 1

    for (var I = 1; I <= N; I++) {
      ZX[I] = Complex(DA * ZX[I].real, DA * ZX[I].imaginary);
    }
  } else {
    // code for increment not equal to 1

    final NINCX = N * INCX;
    for (var I = 1; I <= NINCX; I += INCX) {
      ZX[I] = Complex(DA * ZX[I].real, DA * ZX[I].imaginary);
    }
  }
}