! TO MOVE SOMEWHERE ELSE !! (Amaury - 07/2024)
! Move with other vector/math functions
! Those are old legacy CRAY replacement functions, that are now used in several parts of the code.

SUBROUTINE scopy(n, sx, incx, sy, incy)

  IMPLICIT NONE

  integer n, incx, incy, ix, iy, i
  real sx((n - 1) * incx + 1), sy((n - 1) * incy + 1)

  iy = 1
  ix = 1
  DO i = 1, n
    sy(iy) = sx(ix)
    ix = ix + incx
    iy = iy + incy
  END DO

end

function ssum(n, sx, incx)

  IMPLICIT NONE

  integer n, incx, i, ix
  real ssum, sx((n - 1) * incx + 1)

  ssum = 0.
  ix = 1
  do i = 1, n
    ssum = ssum + sx(ix)
    ix = ix + incx
  END DO

end

