Topic: declaration of size of arrays in parameter satement

program matrix
        implicit none
        INTEGER,parameter :: i4=SELECTED_INT_KIND(9)
        INTEGER,parameter :: dp=SELECTED_REAL_KIND(15,307)
        INTEGER(KIND=I4) :: I,J
        INTEGER(KIND=i4),parameter :: m=3_I4,n=2_i4
        REAL(KIND=dp) ::  a(m,n),b(n),c(m),d(m),e(n)


With respect to the above 'code' , should I always put the 'kind' when I assign values for the 'rows' and 'columns' ?.....  I am not that certain of whether or not it is appropriate .  .

Re: declaration of size of arrays in parameter satement

You don't need to assign the KIND values necessarily.  It's usually not important in most integer cases as the default integer size is often big enough for indexing.  You can also omit it from the REAL declarations, but REAL would default to single precision.

Alternatively, you can use compiler flags to define the default sizes:

-fdefault-integer-8   <- Sets the default integer size to 8 bytes (not so common, usually)

-fdefault-real-8    <- Sets the default real size to 8 bytes (normally double precision)

I've used the latter considerably myself to quickly compile a double-precision version of my projects rather than go through and add KIND=8 everywhere.

Jeff Armstrong
Approximatrix, LLC