xref: /petsc/src/mat/impls/aij/seq/ftn-kernels/fmultadd.F90 (revision 7b8d1e391f5fe71e76c4f351e7ee3df2b8592cc4)
1!
2!
3!    Fortran kernel for sparse matrix-vector product in the AIJ format
4!
5#include <petsc/finclude/petscsys.h>
6!
7pure subroutine FortranMultAddAIJ(n,x,ii,jj,a,y,z)
8  implicit none (type, external)
9  PetscScalar, intent(in) :: x(0:*),a(0:*),y(*)
10  PetscScalar, intent(inout) :: z(*)
11  PetscInt, intent(in) :: n,ii(*),jj(0:*)
12
13  PetscInt :: i,jstart,jend
14
15  jend  = ii(1)
16  do i=1,n
17    jstart = jend
18    jend   = ii(i+1)
19    z(i) = y(i) + sum(a(jstart:jend-1)*x(jj(jstart:jend-1)))
20  end do
21end subroutine FortranMultAddAIJ
22