Date: 2013-07-02T14:40:01+00:00

Actual source code: fnorm.F
petsc-3.4.2 2013-07-02

      1: !
      2: !
      3: !    Fortran kernel for the Norm() vector routine
      4: !
      5: #include <finclude/petscsysdef.h>
      6: !
      7:       subroutine FortranNormSqr(x,n,sum1)
      8:       implicit none
      9:       PetscScalar x(*)
     10:       PetscReal   sum1
     11:       PetscInt n

     13:       PetscInt i

     15:       PETSC_AssertAlignx(16,x(1))

     17:       do 10,i=1,n
     18:         sum1 = sum1 + PetscRealPart(x(i)*PetscConj(x(i)))
     19:  10   continue

     21:       return
     22:       end

     25:       subroutine FortranNormSqrUnroll(x,n,sum1)
     26:       implicit none
     27:       PetscScalar x(*)
     28:       PetscReal   sum1
     29:       PetscInt n

     31:       PetscInt i

     33:       PETSC_AssertAlignx(16,x(1))

     35:       do 10,i=1,n,4
     36:         sum1 = sum1 + PetscRealPart(x(i)*PetscConj(x(i)))                                         &
     37:      &              + PetscRealPart(x(i+1)*PetscConj(x(i+1)))                                     &
     38:      &              + PetscRealPart(x(i+2)*PetscConj(x(i+2)))                                     &
     39:      &              + PetscRealPart(x(i+3)*PetscConj(x(i+3)))
     40:  10   continue

     42:       return
     43:       end