Fortran

出典: フリー百科事典『ウィキペディア(Wikipedia)』
Fortran
Fortran
パラダイム 構造化プログラミングオブジェクト指向プログラミング手続き型プログラミングジェネリックプログラミング命令型プログラミング、配列プログラミング ウィキデータを編集
登場時期 1954年 (70年前) (1954)
開発者 IBMジョン・バッカス ウィキデータを編集
最新リリース Fortran 2018
型付け 強い静的型付け
主な処理系 Absoft, Cray, CUDA, Fortran Builder, GFortran, G95, Intel, Lahey/Fujitsu, Open Watcom, Pathscale, PGI, Silverfrost, Sun, XL Fortran, Visual Fortran ほか
影響を受けた言語 Speedcoding ウィキデータを編集
影響を与えた言語 ALGOL 58, BASIC, PL/I, C
プラットフォーム z/OS, z/VM, z/VSE, MCP, VOS3, ACOS, GCOS, VMS, OS/400, UNIX, Linux, Windows, Mac OS, CP/M, MS-DOS ほか
ライセンス MIT License ウィキデータを編集
ウェブサイト
拡張子 f、for、f90 ウィキデータを編集
テンプレートを表示
1956年に発行された最初のFortran解説書『The Fortran Automatic Coding System for the IBM 704

Fortran1954IBM使

[]


19561957IBM 704 Fortran  formula translationFORTRAN 77  Fortran 90 

Fortran [1]使[2]

CC++Fortran 90/Fortran 95 FORTRAN 77 6Fortran 77 Fortran 90 Fortran 95 High Performance FortranFortran 2003 Fortran 2008 

 FORTRAN  Fortran 1990ISO[3]  FORTRAN  FORTRAN 77  FORTRAN Fortran Fortran 90 

Fortran[]

Fortran 90/95[]


Fortran 90/95[4]





便

使


FORTRAN 77[]


使FORTRAN 77 

便





FORMATC



COMMONBLOCK DATASAVE




Fortran[]

FORTRAN1567380

1953IBM 704IBMFORTRANRichard GoldbergSheldon F. BestHarlan HerrickPeter SheridanRoy Nutt Robert NelsonIrving ZillerLois HaibtDavid Sayre[5]

The IBM Mathematical Formula Translating System 1954195610Fortran19574

1/20IBMThink1979IBM 701[6]

Fortran

1960FORTRANIBM 709IBM 650IBM 1620IBM 7090FORTRANFORTRAN196340FORTRANFORTRAN

FortranFortran

FORTRAN[]

IBM 704 

IBM 704FORTRAN32

IBM 1401FORTRAN[]


IBM 1401658kUCSD PascalP20

FORTRAN II[]


IBMFORTRAN II1958

FORTRAN IIDOUBLE PRECISIONCOMPLEX

FORTRAN III[]


IBM1958FORTRAN III704 FORTRANFORTRAN IIFORTRAN IIIFORTRAN

FORTRAN IV[]


IBM1961FORTRAN IVREAD INPUT TAPEFORTRAN IILOGICALIFIF36235227254FORTRAN IV1962IBM 7030IBM 7090IBM 7094

1965ANSI X3.4.3 FORTRAN

FORTRAN 66[]


American Standards AssociationANSIFortranFortran19662FORTRAN IVFORTRANFORTRAN IIBasic FORTRANFORTRANFORTRAN 66

FORTRAN 77[]


FORTRAN 66 "Fortran"1966ANSI197719784FORTRANFORTRAN 77FORTRAN 66:

 IFEND IF ELSEELSE IF 

DOFORTRANDO1

I/OOPEN, CLOSE,  INQUIRE

-  I/O

IMPLICIT 

CHARACTER 

PARAMETER 

SAVE 



ASCII (LGE, LGT, LLE, LLT)

X3J3 ""ANSI24Appendix A2 of X3.9-1978使



 GREET = 12HHELLO THERE! 

FORMAT HHFORMAT使使



DIMENSION A(10,5)

Y= A(11,1)

DO""DO

(CHARACTER)Fortran77

Fortran 90[]


Fortran 90 FORTRAN 771991ISO1992ANSI1978FORTRAN 77
  • フリーフォームソース入力と小文字のFortranキーワード。プログラム本文を7桁目から書かなくても良く、80桁の制限も無い。
if (x<0) then
x=0
end if
  • 最長31文字までの識別子。
abcdefghijklmnopqrstuvwxyz12345=0.0e0
  • インラインコメント。
! これは"!"を用いたコメントです
  • 配列演算(あるいは部分配列演算)。これは数学とエンジニアリングの計算を大幅に簡素化する。
  • 全部または部分マスクされた、配列の指定と配列の表現、例えば、
x(1:n)=r(1:n)*cos(a(1:n))
  • 選択的配列のアサインのためのwhere文。
integer :: a(10)
real(8) :: b(10)
a = f(x)
where (a > 0)
  b = -1.0
elsewhere
  b = 1.0
end where
  • 配列の定数と式による初期化。
  • ユーザ定義の配列を返す関数と配列コンストラクタ。
function sample(x) result(y) !配列yを返す
  integer, parameter :: nn = 4
  real :: y(nn) = (/ 1, 2, 3, 4 /) !配列のコンストラクタと定数による初期化
  !...
end function sample
  • 再帰手続き。
  • モジュラープログラム、すなわち関係するサブルーチンとデータのグループ化と、他のプログラムユニットで使用、モジュールの内の指定した部分だけの使用を含む。
  • interface文を使用してコンパイル時に型がチェックされる大幅に改善された引数渡しメカニズム。
module my_lib !モジュール
interface
  function sample(x)
    real, intent(in) :: x(:) !コンパイル時に変数の型の整合性とデータの入出力方向がチェックされる。
    !...
  end function sample
end interface
end module
  • ユーザー定義総称関数(同じ関数名で、引数の数とタイプを自動的に識別して異なる内部関数を呼び出す)のインターフェース。
  • 演算子('+'、'-'、など)のオーバーローディング(多重定義)。
  • 派生型データタイプ。
  • 変数のデータタイプと他の属性を指定するための新たなデータタイプの宣言シンタックス、
  • allocatable属性と allocateとdeallocate文を用いたダイナミックメモリアロケーション。
real, allocatable :: temp(:)
allocate(temp(nn))
deallocate(temp)
  • ポインター属性とポインターアサイン、nullify文によるダイナミックデータ構造の扱い。
  • do 文の end do による終端。
  • do while 文
  • exit文によるdo文からの脱出と、cycle文によるdo文の次の繰り返しへの移行。
do i = 1, nn
  if (b(i) /= 0) then
    a(i) = 1.0 / b(i)
  else
    exit
  end if
end do
  • select文。
select case (sw)
case ('++')
  a = a + 1
case ('--')
  a = a - 1
case default
  a = 0
end select
  • ユーザがコントロールできる数値精度の移植性の良い指定方法。
a = 1.0e0_kind(1.0d0)
  • 新しく導入された内部関数。それに伴い従来の文関数(statement function)は廃止予定に。

削除または時代遅れとされた機能の一覧[編集]


Fortran 90Appendix B.1FORTRAN 77Fortran 90使Fortran 95
削除または時代遅れとされた機能の一覧
時代遅れの機能 状態 / Fortran 95での予定
算術 IF 文
      IF (X) 10, 20, 30
非-整数型の DO パラメータ あるいは制御変数
      DO 9 X= 1.7, 1.6, -0.1
削除
DOループの末端の共有 もしくは
END DO あるいはCONTINUE以外の末端
 
      DO 9 J= 1, 10
         DO 9 K= 1, 10
9           L= J + K
ブロック外部からの

END IFへのブランチ

66    GO TO 77 ; . . . 
      IF (E) THEN ;      . . . 
77    END IF
削除
Alternate return
      CALL SUBR( X, Y *100, *200 )
PAUSE文
      PAUSE 600
削除
ASSIGN statement
  と assigned GO TO statement
100   . . .
      ASSIGN 100 TO H
      . . .
      GO TO H . . .
削除
Assigned FORMAT specifiers
      ASSIGN F TO 606
削除
H 編集子
606   FORMAT ( 9H1GOODBYE. )
削除
計算 GO TO 文
      GO TO (10, 20, 30, 40), index
(時代遅れ)
文関数
      FOIL( X, Y )= X**2 + 2*X*Y + Y**2
(時代遅れ)
DATA 文
  among executable statements
      X= 27.3

      DATA A, B, C / 5.0, 12.0. 13.0 /. . .
(時代遅れ)
CHARACTER* の形式による文字型宣言
      CHARACTER*8 STRING  ! Use CHARACTER(8)
(時代遅れ)
Assumed character length functions
      CHARACTER*(*) STRING
固定長形式のソースコード * 第1カラムが * あるいは ! あるいは C である行は注釈行.
C   第6カラムが空白でなければ継続行.文番号は先頭から5桁目までに書く。

"Hello world"の例[編集]

program helloworld
  print *, "Hello, world."
end program helloworld

Fortran 95[編集]

地球シミュレータスーパーコンピュータ

Fortran 95Fortran 90Fortran 95FortranHPFHigh Performance FortranFortranHPF使[2]

forallwhere

 pure  elemental 



使

allocatable deallocate

maxloc dim

Fortran 90Fortran 95

REALDOUBLE PRECISION使DO 

END IF

PAUSE 

ASSIGNASSIGNGOTO ASSIGN

H edit descriptoren:Hollerith constant

Fortran 95Allocatable TRISO technical reportTR-15581: Enhanced Data Type FacilitiesFortran 2003Fortran ALLOCATABLE ALLOCATABLEALLOCATABLEPOINTER-ALLOCATABLE Fortran 95deallocate

arrayFortran-

Fortran 95ISO technical report TR-15580: IEEE TRIEEE 

[]


ISO/IEC 1539-1:1997Fortran 952

ISO/IEC 1539-2 : 2000

ISO/IEC 1539-3 : 1998

ISO/IEC 1539FortranFortran

Fortran 2003[]


Fortran 2003 Fortran2003Fortran Working Group (WG5)Web[7]



使

-

allocatable  (TR 15581)-

FLUSH 



IEEE (TR 15580)

C

ISO 106464(.)(,)



Fortran 2003 ISO technical report TR-19767

FortransubmodulesFortranModula-2Ada

Fortran 2008[]


Fortran 2008ISO/IEC 1539-1:201020109[8]Fortran 95Fortran 2003

ISO/IEC TR 19767:2005

Co-array Fortran

do concurrentDO

CONTIGUOUS





FDISN1830[9]

Fortran 2008ISO(TS) 29113FortranC[10][11]20125ISOCFortran

Fortran 2018[]


Fortran 2018Fortran 2015[12]20181128[13]

Fortran 20182

ISO/IEC TS 29113:2012 Further Interoperability with C[14]

ISO/IEC TS 18508:2015 Additional Parallel Features in Fortran[15]

ISO/IEC/IEEE 60559:20112019IEEE16IMPLICIT NONE[16][17][18][19]

Fortran 2023[]


Fortran 2023 (ISO/IEC 1539-1:2023) 202311[20]JISFortran 2023Fortran 2018Fortran 2018Metcalf (2023) [21]

Fortran[]


Fortran 202Y  Fortran 2028ISO/IEC JTC 1/SC 22/WG 5 [22] 調 SC 22/Fortran WGWG 5 [23]

科学分野と工学分野での利用[編集]


1968BASICold-fashioned[24]Fortran使Fortran[25]1984FORTRANFORTRANPascalModula-2[26]1993Cecil E. LeithFORTRAN[27]

[]


FORTRAN 66ISOANSIJISFortran

FORTRAN 66FORTRAN 77FORTRAN 77

Fortran 90Fortran

 (FORTRAN 66)[]


1966ANSI X3.9-1966JIS19673JIS FORTRAN

JIS C 62017000


DATABLOCK DATA

FORMATD,G,A

6

JIS C 62025000
6

JIS C 62033000
5

IF使



EXTERNAL

3

COMMON

4

COMMON使



19711976

FORTRAN 77[]


ISOANSI X3J3  FORTRAN  X3.9-1978  ISO 1539-1980 subset languagefull language22 JIS C 6201-1982 1987JIS JIS X 3001-1982 

Fortran 90[]


FORTRAN 771991 ISO/IEC 1539:1991JISJIS X 3001:1994

Fortran 90 Fortan[28]

Fortran 95時代[編集]

JIS X 3001:1998では,Fortran 95と通称される規格が引用されている。該規格は一部例外を除きJIS X 3001 1-1994の上位互換拡張である。

Fortran 2003時代[編集]

JIS X 3001:2009では,Fortran 2003と通称される規格が引用されている。当該規格は一部の例外を除いてJIS X 3001-1:1998の上位互換拡張である[29]

Fortran 2008時代[編集]

対応するJISは制定されなかった。

Fortran 2018時代[編集]

JIS X 3001-1:2023(2023年現在の最新改正版)では,Fortran 2018と通称される規格が引用されている[30]

Fortran と教育[編集]

教育向けコンパイラ[編集]


Fortran使WaterlooWATFORWATFIV使

Fortran[]


FortranC/C++Fortran

CFortran使C

FortranFortran使使使1使FortranDODODO
DO I = 1, N
  A(I) = B(I) * C(I)
END DO

のようなDO構文は、ほとんどの場合、1から数個のベクトル演算命令にコンパイルされる。そのほかにもDOループの中にIF文を含むような例、たとえば、

DO I = 1, N
  IF (A(I) <= LIMIT) THEN
    B(I) = A(I) * Z
  END IF
END DO

ALIMITA=ZDO


Fortran[]


FORTRANJEIDA1985JEIDA-42FORTRAN

FORTRAN使FORMAT

Fortran[]


FORTRAN 77Fortran使FORTRAN6

FLECSiftranMORTRANSFtranS-FortranRatforRatfivRatforRatfivCFORTRAN 66

LRLTRANLTSSFortran 953 CoCo SIMSCRIPTFortran

FORTRANC Fortran使

FFortranEQUIVALENCEFortran 95FFortran 90使FORTRAN 77Fortran 90F  [31]FFortran

HPFHigh Performance Fortran)Fortran

主な処理系[編集]

Windows[編集]

フリーソフト
商用ソフト
  • Absoft Pro Fortran
  • Intel Visual Fortran
  • NAG Fortran
  • Lahey Fortran

Linux[編集]

無償で利用できるコンパイラ
  • GNU Fortran (GFortran)- 自由なソフトウェア(Free Software)のGNU コンパイラ・コレクションの1つ。現在 Fortran 95 に2003や2008の仕様の一部を追加。
  • G95
  • Open Watcom Open Watcom
  • Intel Fortran Composer XE 2011 for Linux - 非商用利用に限り無償で使用可
  • Oracle developer studio - 開発向けに無期限の無償ライセンス
  • NVIDIA HPC SDK - ライセンス契約への同意が必要
有償の商用コンパイラ
  • Absoft Pro Fortran
  • Intel Visual Fortran
  • NAG Fortran
  • Open64
  • PGI Fortran
  • un Studio

その他[編集]

出典[編集]



(一)^ Fortran90/95Fortran90/95

(二)^ abHPF (HPFPC)

(三)^ ISO/IEC JTC1/SC22/WG5-N489 (2 March 1990). Resolutions. London WG5 Meeting, February 26 - March 2, 1990. wg5-fortran.org. ISO/IEC JTC 1/SC 22/WG 5. 202436

(四)^  2020, .

(五)^ History of FORTRAN and FORTRAN II  Software Preservation Group

(六)^ Fortran - Gadgets - MSNBC.com

(七)^ Fortran Working Group (WG5).It may also be downloaded as a PDF fileorgzipped PostScript file, FTP.nag.co.uk

(八)^ N1836, Summary of Voting/Table of Replies on ISO/IEC FDIS 1539-1, Information technology - Programming languages - Fortran - Part 1: Base language ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1836.pdf (PDF, 101 KiB) 

(九)^ N1830, Information technology, Programming languages, Fortran, Part 1: Base language ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1830.pdf (PDF, 7.9 MiB) 

(十)^ ISO page to ISO/IEC DTS 29113, Further Interoperability of Fortran with C

(11)^ Draft of the Technical Specification (TS) 29113 ftp://ftp.nag.co.uk/sc22wg5/N1901-N1950/N1917.pdf (PDF, 312 kiB) 

(12)^ Doctor Fortran in "Eighteen is the new Fifteen".  Software.intel.com. 20171120

(13)^ Fortran 2018.  ISO. 20181130

(14)^ Further Interoperability with C.  ISO. 20171120

(15)^ Additional Parallel Features in Fortran.  ISO. 20171120

(16)^ The New Features of Fortran 2015.  ISO. 2017623

(17)^ Doctor Fortran in "One Door Closes".  Software.intel.com. 2015921

(18)^ Doctor Fortran Goes Dutch: Fortran 2015.  Software.intel.com. 20141119

(19)^ PL22.3; WG5 (2018109). Fortran 2018 Interpretation Document (pdf).  J3. 2024228

(20)^ Fortran 2023. JTC1/SC22/WG5.  ISO. 2024228

(21)^ Metcalf, Michael; Reid, John; Cohen, Malcolm; Bader, Reinhold (2023). Modern Fortran explained : incorporating Fortran 2023 (Sixth ed.). Oxford. ISBN 978-0-19-887657-1. OCLC 2023946356. https://global.oup.com/academic/product/modern-fortran-explained-9780198876588?prevNumResPerPage=20&prevSortField=9&q=metcalf&start=20&lang=en&cc=de 

(22)^ Documents. JTC1/SC22/WG5.  ISO. 2024228

(23)^  調 SC 22/Fortran WG (2024124). Fortran 202Y. GitHub. 2024228

(24)^ Kemeny, John G.; Kurtz, Thomas E. (11 October 1968). Dartmouth Time-Sharing. Science 162 (3850): 223228. doi:10.1126/science.162.3850.223. http://dtss.dartmouth.edu/sciencearticle/index.html. 

(25)^ Phillips, Lee. Scientific computing's future: Can any coding language top a 1950s behemoth?.  Ars Technica. 201458

(26)^ Pasachoff, Jay M. (19844). Scientists: FORTRAN vs. Modula-2. BYTE: pp. 404. https://archive.org/stream/byte-magazine-1984-04/1984_04_BYTE_09-04_Real-World_Interfacing#page/n403/mode/2up 201526 

(27)^ Galperin, Boris (1993). 26. Large Eddy Simulation of Complex Engineering and Geophysical Flows. London: Cambridgey. p. 573. ISBN 978-0-521-43009-8 

(28)^  ISO/IEC 1539 : 1991 (E) Fortran, ISO/IEC, (1991-07-01), https://wg5-fortran.org/N001-N1100/N692.pdf 

(29)^ JIS X 3001-1:2009Fortran1: 調

(30)^ JIS X 3001-1:2023Fortran1: 調

(31)^ F Programming Language Homepage

参考文献[編集]


FORTRAN : JIS1990ISBN 978-4501515300

Fortran90 : 1998ISBN 978-4627839816

Fortran 90/952007ISBN 978-4-627-84721-7 - 2 2020

Fortran90/9522020ISBN 978-4627847224 

Fortran90/95(2) : 2022ISBN 978-4867538098 - 

FORTRAN 1966 (1972,1980,1983)

FORTRAN 771982

Fortran90/95

CFortran 2022ISBN 978-4-320-12484-4

Fortran 2015ISBN 978-4774175065

Fortran I 22000ISBN 4-320-02977-1 -  1995

Fortran II 1997ISBN 4-320-02868-6

Fortran III 1999ISBN 4-320-02937-2

, Fortran95 : g95, gnuplot32008

Fortran90/951999 -  2011

Fortran90/952011ISBN 978-4-563-01587-9

西FORTRAN 771978 

西FORTRAN1986ISBN 978-4000098816 - Fortran77

FortranNAG

Fortran2003NAG

JTC1/SC22/WG5 The official home of Fortran Standards NAG

Fortran 20082016ISBN 978-4-87783-399-2

Fortran90/95 : 2014ISBN 978-4621087848

Fortran : 2022ISBN 978-4-8158-1087-0 

FORTRAN771987

JIS FORTRAN31984ISBN 978-4130620307

Fortran90/952014ISBN 978-4872594737

Jeanne C. Adams, Walter S. Brainerd, Jeanne T. Martin "Fortran 95 Handbook: Complete Iso/Ansi Reference", MIT Press, 1997ISBN 978-0262510967

Jeanne C. Adams, Walter S. Brainerd, Richard A. Hendrickson, Richard E. Maine, Jeanne T. Martin, Brian T. Smith: "The Fortran 2003 Handbook : The Complete Syntax, Features and Procedures", Springer, 2009. ISBN 978-1-84628-378-9

Ed Akin: "Object-Oriented Programming via Fortran 90/95", Cambridge Univ Press, 2003. ISBN 978-0-521-52408-7.

Sujit Kumar Bose: "Numerical Methods of Mathematics Implemented in Fortran", Springer, 2019.

Walter S. Brainerd, Charles H. Goldberg, Jeanne C. Adams: "Programmer's Guide to Fortran 90" (3rd Ed.), Springer, 1996.

Walter S. Brainerd: "Guide to Fortran 2003 Programming", Springer, 2009. ISBN 978-1-84882-542-0

Walter S. Brainerd: "Guide to Fortran 2008 Programming", 2nd Ed., Springer, 2015. ISBN 978-1447167587

Ian Chivers and Jane Sleightholme: "Introduction to Programming with Fortran", 4th Ed., Springer, 2018, ISBN 978-3-319-75501-4

Norman S. Clerman, Walter Spector: "Modern Fortran: Style and Usage", Cambridge University Press, 2012. ISBN 978-0-521-51453-8

Milan Curcic: "Modern Fortran: Building efficient parallel applications", Manning Publications, 2020. ISBN 978-1617295287.  Coarray

Mark Jones Lorenzo: "Abstracting Away the Machine: The History of the FORTRAN Programming Language (FORmula TRANslation)", Independently published, 2019. ISBN 978-1082395949

Arjen Markus: "Modern Fortran in Practice", Cambridge Univ. Press, 2012. ISBN 978-1-13908479-6

M. Metcalf, J. Reid Fortran 90bit1993 -  "Fortran 90 Explained"Oxford Univ. Press1990

Michael Metcalf, John Reid, Malcolm Cohen: "Modern Fortran Explained", Numerical Mathematics and Scientific Computation, 4th Ed., Oxford Univ Press, 2011. ISBN 978-0199601417

Michael Metcalf, John Reid, Malcolm Cohen: "Modern Fortran Explained : Incorporating Fortran 2018", 5th Ed., Oxford Univ. Press, 2018. ISBN 978-0198811886

Valmer Norrod, et al: "A self-study course in FORTRAN programing - Volume I - textbook", Computer Science Corporation El Segundo, California, 1970. NASA(N70-25287).

Valmer Norrod, Sheldom Blecher, and Martha Horton: "A self-study course in FORTRAN programing - Volume II - workbook", NASA CR-1478, Vol. II, 1970. NASA(N70-25288).

 Fortran  (Introduction to Modern Fortran)

Fortran90 (JAMSTEC) - 

History of FORTRAN and FORTRAN II 

[]


Fortran - Fortran 90

FORTRAN 77

Co-array Fortran

High Performance Fortran

GNU Fortran

Fortran Builder - NAG

COBOL

PL/I

en:F_(programming_language) - FFortran951996

[]


Fortran Wiki

Fortran ()

fortran-lang.orgthe new home of Fortran on the internet (2020).
Learn Fortran

Fortran--ZDNET Japan2021517

An introduction to the Fortran programming language, by Reinhold Bader, Nisarg Patel, Leibniz Supercomputing Centre.

"5 Reasons Why Fortran is Still Used", blog by Martin D. Maas, Ph.D (Last updated: 2021-09-20)

HARP 103 (HIPAC 10319621962  HARPFORTRANFORTRANIBM使

NEW! Most Popular Programming Languages 1965 - 2022 FORTRAN

Fortran Wiki : Object-oriented programming

Victor Eijkhout : Introduction to Scientific Programming in C++17/Fortran2008, The Art of HPC, volume 3

Fortran

fortran-jp.org

Fortran

(RIST)HPC使  FortranC