いくつかの例を含む参考文献があると思いますが、私のGoogle-fuは私を失敗させ、Genieのドキュメントページも失敗させました.
非常に具体的な例、そこからのいくつかのValaコードを見てみましょう:
using GLib;
using Gsl;
public class Test : GLib.Object
{
public static void main (string[] args)
{
double[] a_data = new double[] { 0.18, 0.60, 0.57, 0.96,
0.41, 0.24, 0.99, 0.58,
0.14, 0.30, 0.97, 0.66,
0.51, 0.13, 0.19, 0.85 };
double[] b_data = new double[] { 1.0, 2.0, 3.0, 4.0 };
MatrixView m = MatrixView.array (a_data, 4, 4);
VectorView b = VectorView.array (b_data);
Vector x = new Vector (4);
int s;
Permutation p = new Permutation (4);
LinAlg.LU_decomp ((Matrix)(&m.matrix), p, out s);
LinAlg.LU_solve ((Matrix)(&m.matrix), p, (Vector)(&b.vector), x);
stdout.printf("x = \n");
Vector.fprintf(stdout, x, "%g");
}
}
そのプログラムをGenieに変換しようとした方法は次のとおりです。
[indent=4]
uses Gsl
init
a_data: array of double = { 0.18, 0.60, 0.57, 0.96,
0.41, 0.24, 0.99, 0.58,
0.14, 0.30, 0.97, 0.66,
0.51, 0.13, 0.19, 0.85 }
b_data: array of double = { 1.0, 2.0, 3.0, 4.0 }
var m = Gsl.MatrixView.array(a_data, 4, 4)
var b = Gsl.VectorView.array(b_data)
var x = new Gsl.Vector(4)
s:int = 0
var p = new Gsl.Permutation(4)
Gsl.LinAlg.LU_decomp(m, p, out s)
Gsl.LinAlg.LU_solve(m, p, b, x)
print "x =\n%g", x
この参照に従って正しいはずです。
しかし、それは失敗します:
LA.gs:12.28-12.32: error: syntax error, expected identifier
var m = Gsl.MatrixView.array(a_data, 4, 4)
^^^^^
LA.gs:13.28-13.32: error: syntax error, expected identifier
var b = Gsl.VectorView.array(b_data)
^^^^^
Compilation failed: 2 error(s), 0 warning(s)
それで、誰かがその特定のエラーが何を意味するのか説明してもらえますか? Genie のコンテキストにおける識別子とは何ですか?
Genie でそのような静的メソッドを呼び出す正しい方法は何ですか?