Actual source code: fmultadd.F90

      1: !
      2: !
      3: !    Fortran kernel for sparse matrix-vector product in the AIJ format
      4: !
      5: #include <petsc/finclude/petscsys.h>
      6: !
      7: pure subroutine FortranMultAddAIJ(n, x, ii, jj, a, y, z)
      8:   use, intrinsic :: ISO_C_binding
      9:   implicit none(type, external)
     10:   PetscScalar, intent(in) :: x(0:*), a(0:*), y(*)
     11:   PetscScalar, intent(inout) :: z(*)
     12:   PetscInt, intent(in) :: n, ii(*), jj(0:*)

     14:   PetscInt :: i, jstart, jend

     16:   jend = ii(1)
     17:   do i = 1, n
     18:     jstart = jend
     19:     jend = ii(i + 1)
     20:     z(i) = y(i) + sum(a(jstart:jend - 1)*x(jj(jstart:jend - 1)))
     21:   end do
     22: end subroutine FortranMultAddAIJ