mat_flop Function

public function mat_flop(x)

!GFORTRAN BUG in 8.3 !real,save :: mas(2,14)=reshape([ & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’fff0ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’ff00ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z’f000ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000ffff’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000fff0’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000ff00’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘0000f000’,kind=kind(0.0)), & ! & real(Z’ffffffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’fff0ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’ff00ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z’f000ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000ffff’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000fff0’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0)), & ! & real(Z‘0000ff80’,kind=kind(0.0)),real(Z‘00000000’,kind=kind(0.0))],shape(mas))

Arguments

Type IntentOptional Attributes Name
doubleprecision, intent(in) :: x

NAME

mat_flop(3fp) - [M_LA] count and possibly chop each floating point operation
LICENSE(MIT)

SYNOPSIS

DESCRIPTION

Count and possibly chop each floating point operation.

this is a system-dependent function

OPTIONS

NOTES

FLP(1)  is flop counter
FLP(2)  is number of places to be chopped

Return Value doubleprecision


Source Code

doubleprecision function mat_flop(x)
!>
!!##NAME
!!    mat_flop(3fp) - [M_LA] count and possibly chop each floating point operation
!!    LICENSE(MIT)
!!
!!##SYNOPSIS
!!
!!
!!##DESCRIPTION
!!    Count and possibly chop each floating point operation.
!!
!!    this is a system-dependent function
!!##OPTIONS
!!
!!##NOTES
!!    FLP(1)  is flop counter
!!    FLP(2)  is number of places to be chopped
doubleprecision,intent(in) :: x
doubleprecision            :: mask(14),xx,mm
integer                    :: k
logical                    :: lx(2),lm(2)
equivalence (lx(1),xx),(lm(1),mm)
equivalence (mask(1),mas(1,1))
!>>>>>>>>>>>>>>>>>>
!*!GFORTRAN BUG in 8.3
!*!real,save                  :: mas(2,14)=reshape([ &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'fff0ffff',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'ff00ffff',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'f000ffff',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'0000ffff',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'0000fff0',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'0000ff00',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'0000f000',kind=kind(0.0)),     &
!*!   & real(Z'ffffffff',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'fff0ffff',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'ff00ffff',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'f000ffff',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'0000ffff',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'0000fff0',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0)),     &
!*!   & real(Z'0000ff80',kind=kind(0.0)),real(Z'00000000',kind=kind(0.0))],shape(mas))
integer :: i,j
logical,save :: setup=.false.
real,save                  :: mas(2,14)
character(len=8),save      :: setmas(2,14)=reshape([ &
   & 'ffffffff','fff0ffff', &
   & 'ffffffff','ff00ffff', &
   & 'ffffffff','f000ffff', &
   & 'ffffffff','0000ffff', &
   & 'ffffffff','0000fff0', &
   & 'ffffffff','0000ff00', &
   & 'ffffffff','0000f000', &
   & 'ffffffff','00000000', &
   & 'fff0ffff','00000000', &
   & 'ff00ffff','00000000', &
   & 'f000ffff','00000000', &
   & '0000ffff','00000000', &
   & '0000fff0','00000000', &
   & '0000ff80','00000000'],shape(mas))
   if(.not.setup)then
      do i=1,2
         do j=1,14
            read(setmas(i,j),'(z8)')mas(i,j)
         enddo
      enddo
      setup=.true.
   endif
!<<<<<<<<<<<<<<<<<<

   la_flop_counter(1) = la_flop_counter(1) + 1
   k = la_flop_counter(2)

   select case(k)
   case(:0)
      mat_flop = x
   case(1:15)
      mat_flop = 0.0d0
   case default
      xx = x
      mm = mask(k)
      lx(1) = lx(1) .and. lm(1)
      lx(2) = lx(2) .and. lm(2)
      mat_flop = xx
   end select

end function mat_flop