fortran66のブログ

fortran について書きます。

【ニュース】Julia Box 無料終了【乞食悲報】

今月で無料終了 以降 $7(学割)

Dear JuliaBox User,

In January 2019, we notified the Julia community that we would be ending the free version of JuliaBox. Until now, we were able to provide JuliaBox for free thanks in part to generous support from our sponsors and hosting providers.

However, because JuliaBox use has grown so much, we can no longer afford to provide JuliaBox for free. As a result, we will be ending the free version of JuliaBox at the end of October 2019.

For paid JuliaBox users, there are no changes and JuliaBox will continue to be available at the same price (as low as $7 per month for academic users) with the same current level of support.

ジェフリー・エプスタインの寄付金が切れたからだと面白いが、無理かw  Julia 言語誕生の頃 2012 年ごろに ハーバード、MIT あたりの理工系に積極的に接触していて、2015 年ごろ Julia 某と韓国型マッサージ関係にあったようだw

Thinking Machine 社は、理事のおばちゃんが会社の金でこぎれいなオフィスに絵画を買い集めたりして見事倒産。絵にかいたような倒産。

Juliaプログラミングクックブック ―言語仕様からデータ分析、機械学習数値計算まで
Julia 1.0 Programming Cookbook: Over 100 numerical and distributed computing recipes for your daily data science work?ow (English Edition)

Julia 1.0 Programming Cookbook: Over 100 numerical and distributed computing recipes for your daily data science work?ow (English Edition)

【寝言】R・ストールマン追放 および ジュエルペット  

「Remove Richard Stallman(リチャード・ストールマン氏を取り除こう)」

エロ同人みたなロリコンおじさんジェフリー・エプスタインがらみのニュースでMIT周辺もにぎわっています。しばらく前にストールマンも巻き込まれているとニュースが流れていましたが、ついに多くの役職から辞任させられたようです。

ぐぬぬ...という気分でしょう。 

f:id:fortran66:20191002230439p:plain
GNU GNU

gigazine.net

記事にはパワーワードが頻出していますw

「Remove Richard Stallman(リチャード・ストールマン氏を取り除こう)」
ストールマン氏は社会的に無知なアスペルガー症候群だから取り除かれるべき」
ストールマン氏は奴隷にされた子どもについて、どういうわけか『完全に喜んでいました』と述べています」と要約しました。

空気の読めない粗野な言動、見苦しい外見からして、典型的キモヲタ風なのですが、「ストールマン氏自身はエプスタイン事件のスキャンダルに全く関わっていません」そうです。

エプスタインはロリペドなので、ショタやケモナーならスキャンダルに全く関わらなくてすみますね!

ジュエルペット第三期

イルカ先生好き!イェイッ!

第三期 ジュエルペット・サンシャイン www.youtube.com

ジュエルペット第二期

竹達彩奈高森奈津美 だが見てないw

www.youtube.com

共産中国70周年

イスラム国が70年続いたみたいなものw 

私からの贈り物 「ジュゲムペットでウヒョイッ!」 ジュエルペットの偽物(パチモン)ジュゲムペットにいつの間にか乗っ取られる世界w

●第36話 「ジュゲムペットでウヒョイッ!」 あなたは信じますか? あなたの住む世界に侵略者が潜んでいることを。そこにも、ほら、あそこにも。今まさに、侵略の魔の手はのびているのです。

ジュエルペット サンシャイン 第36話 「ジュゲムペットでウヒョイッ!」

www.youtube.com

Silent Invasion: China's Influence in Australia

Silent Invasion: China's Influence in Australia

Claws of the Panda: Beijing's Campaign of Influence and Intimidation in Canada (English Edition)

Claws of the Panda: Beijing's Campaign of Influence and Intimidation in Canada (English Edition)

【寝言】NHK 漢詩を読む 令和元年 後期 その他

NHK カルチャーラジオ 漢詩を読む 愛 そのさまざまな形 自然への愛

www4.nhk.or.jp

今期から佐藤正光「愛 そのさまざまな形 人への愛」となって、同性愛とか少年愛とかでてきて先生大ハッスルの模様です。前期副題は「人への愛」とのことなので、後期は「ケモノへの愛」でケモナー登場が期待されます。

【ニュース】f18 が llvm に認知される その他 - fortran66のブログ

今年の春に、後期はケモノへの愛が出るのでは思っていましたが、果たして後期テキストを見ますと、12月のテーマが「第九章 愛玩する動物たち」で、「猫を愛して」「犬に親しむ」「馬への賛歌」「驢馬にまつわる話」ということで、ケモノ愛が噴出するようです。楽しみですね。

Cray chapel 1.20 出る

chapel-lang.org

読売新聞にジョアン・ジルベルト追悼抄

ネットでは購読者が販売店からもらう ID で読めるらしいのですが、そんな ID もらったかどうかw www.yomiuri.co.jp

プリプリちぃちゃん!! マンガ完結

結構前に出ていたようなのですが、マンガ第7巻で夕花ちゃん結婚エンドでめでたく完結していました。夕花ちゃんは初期のめんどくささから無事に成長・脱却した感じがあったので、まぁ順当な終わりの気がします。さすが篠塚ひろむ先生はバランスがいい。

しかし、予備知識なしで見たアニメ1話のラストは衝撃でしたw アニメはもう少し続いても良かったのに…


【アニメ】『プリプリちぃちゃん!!』プリプリ!ちぃちゃんがやってきたでち! ★ちゃおチャンネルでは他にも人気作品を公開中!★【公式】

マロニエ王国の七人の騎士

1巻の試し読みの範囲では、岩本ナオのいつもの自己評価の低い主人公の湿っぽい話かと思えて敬遠していたのですが、この前読んでみたところ2巻にかけて神話的になってきて面白かったです。誰が誰だか何が何だか主観なのか客観なのか象徴なのか分けの分からない迫力のワイドスクリーンバロック風というかw

現代において、こんな神話風の話を自然に表現して生み出せるメディアとしてのマンガに感心させられます。

【ニュース】Julia ヨイショ記事と思いきや、珍しく Fortran 褒められる

意外に公正で草

どうせ julia 上げ記事かと思ってみてませんでしたが、覗いてみると意外に Fortran も上げられてました。 お金が絡むとシビアです。

towardsdatascience.com

要旨

During the last months, I have been working intensively on quantitative intraday strategies. As a side result, I have tested workflows for similar tasks in Python, C, Fortran and Julia. Here are my findings.

  1. I work on projects related to instruments trading (i.e. I design and simulate derivatives market algorithmic/quantitative strategies).
  2. I have not used Machine Learning or AI techniques in these strategies, just plain/vanilla statistics and simulation.
  3. Handled data sets are large but not huge, normally my simulations cover 30 million records data sets per asset/instrument, every data is used several times, and I do parametric and Monte Carlo analysis. This implies a large number of iterations.
  4. I am not an expert programmer and I am not interested in becoming one, I just want to focus on the market logic and the strategies that exploit profitable edges.

  1. I need a language that can deal easily and without efforts with large data sets.
  2. I need speed.
  3. I do not need that much speed to require multi-core or parallel processing.
  4. I do not need —at this time— Machine Learning or AI libraries.  

言語

一部引用 (太字は私の強調)

Fortran is now a niche language (currently around position 30 in the list of most used programming languages in the world) but it still has an active community in specialised fields such as high-energy physics, astrophysics and molecular dynamics. Together with C, it is also the main programming language for supercomputing. Standards such as OpenMP and MPI which define ways to distribute computing among cores and distributed computers are always implemented first for C and Fortran.  

 

While modern Fortran has nothing to do with what most people think (upper case code, goto instructions and punched cards), its syntax shows some age. It allows a good code structure and it is quite easy to learn (even to master). My experience while porting the last simulation to Fortran was that coding was easy and that specifically, the algorithmic parts written in C were much easier to code in Fortran. The structured code was also superior to Python, although this is a personal opinion and I know many would disagree with this statement.
  

There were also some problems: a harder integration with graphical tools and the fact that variables need to be declared in advance (something I do not like) but in my opinion, the main issue was that debugging was hard because Fortran at the end ends up calling a C compiler. So my experience is that debugging Fortran was a bit harder than debugging the Python+C solution.
 

On the positive side, Fortran also had some unique solutions to deal with array and structured data, which includes custom index (array[2000:2020] is a valid index range, something that no other language can achieve), vector operations and simple ways to initialise variables and structures.
 

Fortran or C is the way to go if you need speed and plan to do analysis requiring multi CPU and/or multi-core —HFT industry uses C++ intensively — , and it is not casual that both AMD and Intel keep their compiler divisions selling both C++ and Fortran compilers. But if you do not need that much speed, it might be better to trade off some performance for a more friendly environment easier to debug and the possibility to use DataFrames.
 

Fortran performance is astonishing. Fortran was able to read a whole year of prices from a CSV file, convert them to integers to avoid loss of precision, round them down to contract ticks and store them into memory in around 1 second. This means that a strategy using 20 years of 1-minute prices would be loaded into memory and ready to be used in 20 seconds. It simply outperforms by far any other language I tried.
 

Its native usage of arrays also made calculations very fast too. In many operations Fortran outperforms C. Believe it or not, 60 years later, it is still the number one number cruncher and its structure is well suited for simulation problems because it was designed with that kind of problems in mind.

pointer function で連想配列 改

以前、Fortran2008 の pointer function を用いて、簡単な連想配列を作ってみましたが、ハッシュ法を N.Wirth の『アルゴリズム+データ構造=プログラム』 中の方法を用いてみました。キーは散らばっているでしょうか?

関数名を配列名のように使うので、このままでは連想配列ごとに関数を定義と駄目なので、何かいい手はないものか考えたいと思います。何か物憂く面倒くさいので、考えていませんし思いついていません。ポインターが返り値という関数なので、使い方をよく理解していない気がします。

fortran66.hatenablog.com

N.Wirth, Algorithms + Data Structures = Programs

Oberon 版 無料本 第五章 Key Transformations (Hashing)

http://www.ethoberon.ethz.ch/WirthPubl/AD.pdf

Modula-2 版 訳本

アルゴリズムとデータ構造

アルゴリズムとデータ構造

Pascal 版 原本

Algorithms + Data Structures = Programs (Prentice-Hall Series in Automatic Computation)

Algorithms + Data Structures = Programs (Prentice-Hall Series in Automatic Computation)

ソース・プログラム

    module hash_m
        implicit none
     !   private
     !   public :: ia
        
        integer, parameter :: nhash = 73
        type :: t_key
            character(len = :), allocatable :: key  
        end type t_key
        type (t_key)    :: keyc(nhash)  
        integer, target :: vals(nhash) = 0  
    contains
        pure integer function ihash(text) 
            character(len = *), intent(in) :: text
            integer :: i
            ihash = 0
            do i = 1, len_trim(text)
                ihash = mod(256 * ihash + iachar(text(i:i)), nhash)
            end do
            ihash = ihash + 1
        end function ihash  
       
        
        function ia(text) result(ires)
            character(len = *), intent(in) :: text
            integer, pointer :: ires 
            integer :: key, loc, ihop
            ihop = 1
            key = ihash(text) 
            do
                if (.not. allocated(keyc(key)%key)) then
                    keyc(key)%key = trim(text)
                    ires => vals(key)
                    exit
                else if (keyc(key)%key == trim(text)) then 
                    ires => vals(key)
                    exit
                else ! collision
                    key = mod(key + ihop, nhash) + 1   
                    ihop = ihop + 2
                    if (ihop == nhash) stop 'associative array exhausted!' 
                end if
            end do  
        end function ia      
    end module hash_m
    
    
    program Hash
        use hash_m
        implicit none
      
        ia('a') = 41
        print *, ia('a')
        ia('a') = 100
        print *, ia('a')
        ia('b') = 200
        print *, ia('a') + ia('b')
      
        ia('FORTRAN I') = 1957
        ia('FORTRAN II') = 1958
        ia('FORTRAN IV') = 1961
        ia('FORTRAN 66') = 1966
        ia('FORTRAN 77') = 1978
        ia('Fortran 90') = 1991
        ia('Fortran 95') = 1997
        ia('Fortran 2003') = 2004
        ia('Fortran 2008') = 2010
        ia('Fortran 2018') = 2018
        
        ia('Gold') = 1488
        ia('Silver') = 17
        ia('Platinum') = 946
        ia('Palladium') = 1590
        ia('Rhodium') = 4700
      
        block
          integer :: i
          do i = 1, nhash
              print '(i3,a,a20,a,i10)', i, ':', keyc(i)%key, '=>', ia(keyc(i)%key)
          end do    
       end block
    end program Hash

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

Modern Fortran Explained: Incorporating Fortran 2018 (Numerical Mathematics and Scientific Computation)

実行結果

gfortran 7 以上で、 ifort V.17 以上くらいで行けると思います。 

          41
         100
         300
  1:                    =>         0
  2:             Rhodium=>      4700
  3:                    =>         0
  4:                    =>         0
  5:            Platinum=>       946
  6:                    =>         0
  7:                    =>         0
  8:                    =>         0
  9:           Palladium=>      1590
 10:                    =>         0
 11:                    =>         0
 12:                    =>         0
 13:                    =>         0
 14:                    =>         0
 15:                    =>         0
 16:                    =>         0
 17:                    =>         0
 18:                    =>         0
 19:                    =>         0
 20:                    =>         0
 21:                    =>         0
 22:                    =>         0
 23:                    =>         0
 24:                    =>         0
 25:                   a=>       100
 26:                   b=>       200
 27:        Fortran 2018=>      2018
 28:                    =>         0
 29:                    =>         0
 30:                    =>         0
 31:          FORTRAN 77=>      1978
 32:                    =>         0
 33:                    =>         0
 34:                    =>         0
 35:                    =>         0
 36:                    =>         0
 37:                    =>         0
 38:                    =>         0
 39:                    =>         0
 40:                    =>         0
 41:                    =>         0
 42:           FORTRAN I=>      1957
 43:                    =>         0
 44:          Fortran 90=>      1991
 45:                    =>         0
 46:                    =>         0
 47:          Fortran 95=>      1997
 48:              Silver=>        17
 49:                    =>         0
 50:                    =>         0
 51:                    =>         0
 52:                    =>         0
 53:                    =>         0
 54:                    =>         0
 55:                    =>         0
 56:                    =>         0
 57:                    =>         0
 58:          FORTRAN II=>      1958
 59:                    =>         0
 60:        Fortran 2003=>      2004
 61:                    =>         0
 62:                    =>         0
 63:        Fortran 2008=>      2010
 64:                    =>         0
 65:                    =>         0
 66:          FORTRAN 66=>      1966
 67:                    =>         0
 68:                    =>         0
 69:                    =>         0
 70:                    =>         0
 71:          FORTRAN IV=>      1961
 72:                    =>         0
 73:                Gold=>      1488

【ニュース】金のトイレ盗まる!

トランプ大統領に貸与の申し出があった 18 金トイレ盗まる!

英美術館で使用可能状態で展示中に盗まれたようです。

www.kitco.com

f:id:fortran66:20190915012304p:plain
America

According to media reports, the working toilet was reported stolen from the Blenheim Palace in Oxfordshire, England. The museum is also the home where former prime minister Winston Churchill was born.       

The fully functional golden toilet, named "America," was created by Italian artist Maurizio Cattelan. It has been plumbed into the water system and visitors could fully engage with the artwork for three minutes.         

The theft created significant water damage to the museum.              

The toilet gained international recognition when it was installed in the Guggenheim Museum in New York in 2016. A year later, it gained even more notoriety after the Trump administration emailed the Guggenheim and asked to borrow Vincent Van Gogh's 1888 painting "Landscape with Snow." The curator of the famed institution proposed the golden toilet as a counteroffer.

支那人は便器にこびりついた白い石のようなものを削って中華料理の調味料に使うそうなので、食いしん坊の支那人の仕業かと思いましたが、設置後二日目での盗難ということで、食糞目的かも知れません。

【ニュース】「人気の高いプログラミング言語2019」

Fortran さんじゅうはち位

数日前の記事ですが、メモ帳代わりに。

IEEE Spectrum、「The Top Programming Languages 2019」を発表

news.infoseek.co.jp

最後に紹介しているのは、38位にランクインしている「Fortran」。科学計算言語としての莫大な遺産により現在も活発に開発されており、2018年末には最新版がリリースされCとの相互運用性、大規模な並列計算をサポートする改善が組み込まれていると御年60歳を超えるプログラミング言語の健在ぶりを称えている。

IEEE Top Programming Languages: Design, Methods, and Data Sources

https://spectrum.ieee.org/computing/software/the-top-programming-languages-2019

Finally, some older languages are still alive and kicking. In particular, despite being over 60 years old, Fortran still comes in at No. 38, likely due to the enormous legacy power of being the original scientific computing language. The language is still under active development, with the most recent Fortran standard released at the end of 2018, incorporating improved interoperability with C and better support for massive parallel computations.

https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2019