zaxpy function

void zaxpy(
  1. int N,
  2. Complex ZA,
  3. Array<Complex> ZX_,
  4. int INCX,
  5. Array<Complex> ZY_,
  6. int INCY,
)

Implementation

void zaxpy(
  final int N,
  final Complex ZA,
  final Array<Complex> ZX_,
  final int INCX,
  final Array<Complex> ZY_,
  final int INCY,
) {
  final ZX = ZX_.having();
  final ZY = ZY_.having();

  if (N <= 0) return;

  if (dcabs1(ZA) == 0.0) return;

  if (INCX == 1 && INCY == 1) {
    // code for both increments equal to 1

    for (var I = 1; I <= N; I++) {
      ZY[I] += ZA * ZX[I];
    }
  } else {
    // code for unequal increments or equal increments
    // not equal to 1

    var IX = INCX < 0 ? (-N + 1) * INCX + 1 : 1;
    var IY = INCY < 0 ? (-N + 1) * INCY + 1 : 1;
    for (var I = 1; I <= N; I++) {
      ZY[IY] += ZA * ZX[IX];
      IX += INCX;
      IY += INCY;
    }
  }
}