2003年12月25日(木)

最小二乗 by gsl on C++

gsl の最小二乗のサンプルコードを C++ で wrap してみる。

C の癖に微妙にオブジェクト志向くさい感じがあちこちにあって、その癖 C++ とはあんまり擦り合わせがうまくいかんなみたいな。

関数ポインタを構造体に喰わせないといけないんだがどうしたものか。 gsl は C のライブラリなので構造体の側では int (*) ということになっている。一方 C++ の都合では関数ポインタはクラス名まで含む罠。さらにオブジェクトごとに実体があるってことは、ちゃんとポイントしてやるか static にするか…

virtual な member function にしてカラで宣言しておいて、実体は継承側で定義、代入は基底側でって考えたんだが無意味かのぅ。普通に C で関数書かせて引数でそのポインタ受け取るかのぅ。

[referer:

Script Error

The script did not produce proper HTTP headers. Please see the error log to see the detail of the errors. Depending on the server configuration, you can also run thisscript under CGIWrap debugging. Usually, either rename or linkthe script temporarily to a file which ends with .cgidextension, or add a AddHandler cgi-script-debug .cgiline to your .htaccess file.

]

あわせて読みたい