Actual source code: fmaxpy.F90

      1: !
      2: !
      3: !    Fortran kernel for the MAXPY() vector routine
      4: !
      5: #include <petsc/finclude/petscsys.h>
      6: !

      8: pure subroutine FortranMAXPY4(x, a0, a1, a2, a3, y0, y1, y2, y3, n)
      9:   use, intrinsic :: ISO_C_binding
     10:   implicit none(type, external)
     11:   PetscScalar, intent(in) ::  a0, a1, a2, a3
     12:   PetscScalar, intent(inout) :: x(*)
     13:   PetscScalar, intent(in) :: y0(*), y1(*), y2(*), y3(*)
     14:   PetscInt, intent(in) :: n

     16:   PETSC_AssertAlignx(16, x(1))
     17:   PETSC_AssertAlignx(16, y0(1))
     18:   PETSC_AssertAlignx(16, y1(1))
     19:   PETSC_AssertAlignx(16, y2(1))
     20:   PETSC_AssertAlignx(16, y3(1))

     22:   x(1:n) = x(1:n) + (a0*y0(1:n) + a1*y1(1:n) + a2*y2(1:n) + a3*y3(1:n))
     23: end subroutine FortranMAXPY4

     25: pure subroutine FortranMAXPY3(x, a0, a1, a2, y0, y1, y2, n)
     26:   use, intrinsic :: ISO_C_binding
     27:   implicit none(type, external)
     28:   PetscScalar, intent(in) ::  a0, a1, a2
     29:   PetscScalar, intent(inout) :: x(*)
     30:   PetscScalar, intent(in) :: y0(*), y1(*), y2(*)
     31:   PetscInt, intent(in) :: n

     33:   PETSC_AssertAlignx(16, x(1))
     34:   PETSC_AssertAlignx(16, y0(1))
     35:   PETSC_AssertAlignx(16, y1(1))
     36:   PETSC_AssertAlignx(16, y2(1))

     38:   x(1:n) = x(1:n) + (a0*y0(1:n) + a1*y1(1:n) + a2*y2(1:n))
     39: end subroutine FortranMAXPY3

     41: pure subroutine FortranMAXPY2(x, a0, a1, y0, y1, n)
     42:   use, intrinsic :: ISO_C_binding
     43:   implicit none(type, external)
     44:   PetscScalar, intent(in) ::  a0, a1
     45:   PetscScalar, intent(inout) :: x(*)
     46:   PetscScalar, intent(in) :: y0(*), y1(*)
     47:   PetscInt, intent(in) :: n

     49:   PETSC_AssertAlignx(16, x(1))
     50:   PETSC_AssertAlignx(16, y0(1))
     51:   PETSC_AssertAlignx(16, y1(1))

     53:   x(1:n) = x(1:n) + (a0*y0(1:n) + a1*y1(1:n))
     54: end subroutine FortranMAXPY2