! Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved.
! This software is distributed under the MIT License
!
program SAXPY_COMPLEX
INTEGER,PARAMETER :: n=10
integer :: i
complex :: a
complex,  dimension(n) :: x
complex, dimension(n) :: y

a=(0, 2)
write (*,'("("f12.8,f12.8")")') a
do i =1,n
    x(i) = CMPLX(i,i)
end do
y=0.0d0


call saxpy(a, x, y, n)

do i =1,n
    write (*,'(f12.8,f12.8)') x(i),y(i)
end do


end program


subroutine saxpy(a, x, y, n)
IMPLICIT NONE
integer :: n, i
complex :: a
complex, dimension(n) :: x
complex, dimension(n) :: y
!$omp target
do i=1,n
y(i) = x(i)/a + y(i)
end do
!$omp end target
end subroutine
