fortran66のブログ

fortran について書きます。

【メモ帳】FORTRAN と APL

Fortran 90 と ALGOL & APL

Fortran 90 は従来の FORTRAN に、 ALGOL 系(就中 Modula-2)の構造化プログラミングと APL 的な配列操作の概念が加えられている。

APL と Fortran に関する参考文献

Comparison of the functional power of APL2 and FORTRAN 90
APL の側から、APL と Fortran 90 との組み込み関数等を比較している。

ci.nii.ac.jp
上のものを簡潔にまとめて日本語で紹介している。

参考 「APL の何がダメなのか」

What's wrong with APL?

用意されているデータ構造が矩形の配列のみであることのもよう。

What's wrong with APL2

Vector, the Journal of the British APL Association

If Jim could change two things in hindsight he would like (1) to have created the function library that Gary Bergquist is working on now and (2) to have called it , not “APL2”, but either APL version 2 (which would have persuaded more people to migrate) or by a completely new name – such as “Java”.

John Reid 氏の Fortran に関する講演

Modern Fortran, with emphasis on coarrays (John Reid, JKR Associates/Rutherford Appleton Laboratory)

先ごろ ISO Fortran 議長を引退された John Reid 氏が、過去の Fortran 規格について振り返るとともに、次期規格の Fortran 2018 で導入される機能についても解説されております。規格制定の中枢にいた人の解説ですので、啓発される所が多々あります。

youtu.be

動画ですが、まず最初の7分弱が無音です。現代音楽の前奏なのかもしれません。全体に音声状態があまりよくなく、聞いていて頭痛がしてきました。

Fortran 2003 への各ベンダーの対応状況について、NEC富士通にもふれられていてよかったです。

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

  • 作者: Michael Metcalf,John Reid,Malcolm Cohen
  • 出版社/メーカー: Oxford University Press, U.S.A.
  • 発売日: 2011/05/08
  • メディア: ペーパーバック
  • この商品を含むブログを見る
Fortran 2018 が ISO 規格として正式に通ったら、Modern Fortran Explaned の新作が出るのでしょうか。

【ニュース】intel fortran ver.19 beta update 1 来る! その他

Intel® Parallel Studio XE Beta 2019 Beta Update 1

update 1 が来ていました。
詳しくは見ていませんが Fortran の大きな変更点は無いようです。

Nick Higham:Lectures on Multiprecision Algorithms in Kácov

半精度や多倍長精度などに関して。動画・スライドあり。
Lectures on Multiprecision Algorithms in Kácov | Nick Higham

遅ニュース

19th March 2018
Silverfrost FTN95 version 8.30 is released.
www.silverfrost.com

gfortran-8 apt install 可

gfortran-8 parameterized derived type など

戯れに bash on windows のコンソールで sudo apt install gfortran-8 をやってみたところ、インストールしてくれました。gfortran-9 はまだ not found のようです。

gfortran-8 で parameterized derived type が可能になったとのことで、テストしてみました。

なお coarray はデフォルト状態では single image のままのようです。forall(integer:: i=...) もまだのようです。

ソース・プログラム

program Console6
  implicit none
  type :: t_test(kind, leng)
    integer, kind :: kind = 8
    integer, len  :: leng =10
    real(kind) :: x(leng)
  end type t_test
  type(t_test) :: a
  type(t_test(4)) :: b
  type(t_test(leng=5)) :: c
  print *, a%kind, a%leng
  print *, b%kind, b%leng
  print *, c%kind, c%leng
  c%x =  1.0
  print *, 'c='
  print *, c
end program Console6

実行結果

O@HP8:~$ gfortran-8 param.f90
O@HP8:~$ ./a.out
           8          10
           4          10
           8           5
 c=
           8           5   1.0000000000000000        1.0000000000000000        1.0000000000000000        1.0000000000000000        1.0000000000000000

f:id:fortran66:20180612004215p:plain

【ニュース】Manning Fortran 本少し進む その他【メモ帳】

Manning Fortran 本 5章 coarray

第五章「Going parallel with Fortran coarrays」が加わりました。

www.manning.com



【メモ帳】

SIMD Instructions Considered Harmful

by David Patterson and Andrew Waterman on Sep 18, 2017
www.sigarch.org

ちょぼらうにょぽみ劇場

弱酸性ミリオンアーサー第5期

弱酸性ミリオンアーサー #49
金元寿子さん休養でどうなるか?

ソメラちゃん連載終了

https://pbs.twimg.com/media/Dd3uR68VMAAyNu5.jpg


ちょぼ先生とバーチャルユーチューバー

弱酸性ミリオンアーサー2

弱酸性ミリオンアーサー2

不思議なソメラちゃん [Blu-ray]

不思議なソメラちゃん [Blu-ray]

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained (Numerical Mathematics and Scientific Computation)

  • 作者: Michael Metcalf,John Reid,Malcolm Cohen
  • 出版社/メーカー: Oxford University Press, U.S.A.
  • 発売日: 2011/05/08
  • メディア: ペーパーバック
  • この商品を含むブログを見る

【メモ帳】Romberg 積分 

計算結果

\int_0^{\pi\over2} \cos^{-1}\left( {1\over1+2\cos x} \right)  dx=\zeta(2)

   1.64493103803760        1.64493061750701        1.64492430954817
   1.64492523592403        1.64490909117507        1.64486343605578
 pi^2/6
   1.64493406684823
続行するには何かキーを押してください . . .

プログラム

module m_mod
    implicit none
    integer, parameter :: kd = kind(0.0d0)
    real(kd), parameter :: pi = 4 * atan(1.0_kd)
contains
    pure real(kd) function f(x)
        real(kd), intent(in) :: x
        f = acos(1.0_kd / (1.0_kd + 2.0_kd * cos(x)))
    end function f
    
    pure function romberg(func, x0, x1, n) result(s) 
        procedure(f) :: func
        real(kd) :: s(6)
        real(kd), intent(in) :: x0, x1
        integer , intent(in) :: n
        real(kd) :: h, y(0:n), s0, s1, s2, t1, t2, r2
        integer :: i
        h = (x1 - x0) / n
        forall(i = 0:n) y(i) = func(x0 + i * h)
        s2 =     h * ( y(0) / 2 + sum(y(1:n-1  )) + y(n) / 2 )
        s1 = 2 * h * ( y(0) / 2 + sum(y(2:n-1:2)) + y(n) / 2 )
        s0 = 4 * h * ( y(0) / 2 + sum(y(4:n-1:4)) + y(n) / 2 )
        t2 = (4 * s2 - s1) / 3
        t1 = (4 * s1 - s0) / 3
        r2 = (16 * t2 - t1) / 15
        s = [r2,t2,t1,s2,s1,s0]
    end function romberg
end module m_mod

program test
    use m_mod
    implicit none
    integer, parameter :: n = 2**11
    real(kd) :: x0, x1
    integer :: i
    x0 = 0.0_kd 
    x1 = pi / 2.0_kd 
    print *, romberg(f, x0, x1, n)
    print *, 'pi^2/6'
    print *, pi**2 / 6
end program test

【文化芸術寝言】服部昇大先生 映画「ドリーム」について言及

FORTRAN 映画 ドリーム

昨年の秋に、FORTRAN が主演級の映画「ドリーム」を見に行きましたが、六代目 日ペンの美子ちゃん でおなじみの服部昇大先生が、映画紹介漫画「邦キチ! 映子さん」の第10話で「ドリーム」について言及されていることが判明しました。
comip.jp

f:id:fortran66:20180607003559p:plain

fortran66.hatenablog.com
f:id:fortran66:20180607003654p:plain

「ドリーム」は教育テレビの道徳の時間を元に作られたのではと思いましたが、ネタ元は実写版「テラフォーマーズ」だったようです。

火星は蟲獄!
f:id:fortran66:20180607003627p:plain