私は Fortran を初めて使用しますが、モジュールと型について理解すれば、C や Matlab でできるほとんどのことができることに一般的に気付いています。ただし、gfortran (gcc バージョン 4.6.2) と ifort(13.0.2) のどちらを使用するかによって、この結果の違いに困惑しています。Gfortran では期待どおりの結果が得られますが、ifort では 3 行の空白行が表示されます。理由はありますか?
module define_structures
implicit none
private
public modelling_params
type modelling_params
real, dimension(:), allocatable :: freqs
real, dimension(:), allocatable :: offsets
complex, dimension(:), allocatable :: data
end type modelling_params
end module define_structures
program main
use define_structures
implicit none
type (modelling_params) :: S
S%data = [(1,1) ,(2,3), (3,1)]
S%freqs = [1, 3, 7]
S%offsets = [100, 200, 300]
print *,S%data
print *,S%freqs
print *,S%offsets
end program main
gfortran でコンパイルした結果は次のとおりです。
( 1.0000000 , 1.0000000 ) ( 2.0000000 , 3.0000000 ) ( 3.0000000 , 1.0000000 )
1.0000000 3.0000000 7.0000000
100.00000 200.00000 300.00000
ifort を使用すると、正常にコンパイルされますが、空白行が 3 行だけ表示されます。
前もって感謝します。