2009-06-23

配列の下限と上限を返す lbound, ubound

http://www.nag-j.co.jp/fortran/FI_12.html#AUTOTOC_12_7

書式は、
  lbound(配列名, 次元)

便利だわ。

  write(*,"('p_box(',i2,':',i2,', ',i2,':',i2,', ',i2,':',i2,', ',i2,':',i2,')')") &
        lbound(p_box,1), ubound(p_box,1) &
    & , lbound(p_box,2), ubound(p_box,2) &
    & , lbound(p_box,3), ubound(p_box,3) &
    & , lbound(p_box,4), ubound(p_box,4)

みたいな。


No comments: