本題の前に どうやら日記放置しすぎたようですが、それはまあ気にしない。 今回のお題はPythonです。 最近Science with PythonというコミュニティがGoogle groupにできましてですね、Twitterでのハッシュタグは#sciwpyなんですが、せっかく参加したので科学技術計算で残念ながら現役バリバリのFortranをPythonから利用する方法を書いてみよーかと。 PythonからFortranを使う利点 Pythonにもnumpyとかscipyとか便利な数値計算のためのライブラリがあるので、軽い数値計算ならPythonだけでも十分いけます。PyPyとかCythonという選択肢もありますし。 ところが、かなり重い計算とか、すでにFortranでコードがある状態だとPythonで書くor書き直す気にはならないのですよ。なぜか? Pythonで速く書けても、CやFort
1) プログラム trapfpe.c を作る /******************* trapfpe.c **********************/ #define _GNU_SOURCE 1 #include <fenv.h> static void __attribute__ ((constructor)) trapfpe () { feenableexcept (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW); } /**********************************************************/ 2) trapfpe.c をコンパイル gcc -c -o libtrapfpe.a trapfpe.c 3) 対象となるプログラムを libtrapfpe をリンクしてコンパイル。 オプションの -g を忘れないこと
Intel® oneAPI Toolkits - Free for All Developers Intel® oneAPI Toolkits are the next generation of standards-based Intel® Software Development Tools for building applications across diverse architectures. All Intel® oneAPI Toolkits products are available at no cost. The Intel oneAPI Toolkits do not require license files and the terms of use are based on the End User License Agreement. Support is
Fortran と C の混合プログラミング 初版 1999.3.5 最終修正 2000.1.26 ここでのお話は Unix ( FreeBSD , Linux , Sun OS ) でのお話です。 1. 関数名の付き方 C の関数はコンパイルされると 関数名の左に _ ( アンダーバー ) を付けた名前がつきます。 次のような例を実行してみて下さい。 ----------- csub.c の内容 --------- csub(){} ---------------------------------- % cc -c csub.c % nm csub.o 一方、Fortran では関数名の両側に _ をつけます。次のような 例を実行してみて下さい。 ----------- ffub.f の内容 --------- subroutine fsub() return end subrou
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く