fortran90 - What does `A(::2,3) = -1.0` do in Fortran? -


i have matrix a declared real :: a(7,8) , intialised entries 0.0.

the following command not provide compiling errors.

a(::2,3) = -1.0 

i realise columns affected column 3. rows? ::2 mean rows 1 , 2? or else?

i printed out matrix, couldn't understand pattern produced.

here (for completeness):

do, i=1,7     write(*, "(f5.2)") ( a(i,j), j=1,8 ) enddo   0.00 = 1  0.00 -1.00  0.00  0.00  0.00  0.00  0.00 ----  0.00 = 2  0.00  0.00  0.00  0.00  0.00  0.00  0.00 ----  0.00 = 3  0.00  -1.00  0.00  0.00  0.00  0.00  0.00 ----  0.00 = 4  0.00   0.00  0.00  0.00  0.00  0.00  0.00 ----  0.00 = 5  0.00 -1.00  0.00  0.00  0.00  0.00  0.00 ----  0.00 = 6  0.00  0.00   0.00  0.00  0.00  0.00  0.00 ----  0.00 = 7  0.00 -1.00  0.00  0.00  0.00  0.00  0.00 

looking @ now, looks starts @ i=1 , adds 2 i until reaches bounds of matrix. correct?

does mean ::2 equivalent 1:7:2 ("from 1 7 step of 2)?

looking @ documentation, see:

print array-expression [first-expression : last-expression : stride-expression] 

where:

array-expression expression should evaluate array type.

first-expression first element in range, first element printed. defaults lower bound.

last-expression last element in range, might not last element printed if stride not equal 1. defaults upper bound.

stride-expression length of stride. defaults 1.

so if first-expression , last-expression omitted, default lower bound , upper bound respectively.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -