resp
名前付きの整数配列を書き換え/変換したいというrow matrix
名前の整数配列がありresp
ます。
int[] resp= {1, 0, 1, 0};
Mathnet.Numericsライブラリを使用しています。
どうやってやるの?
resp
名前付きの整数配列を書き換え/変換したいというrow matrix
名前の整数配列がありresp
ます。
int[] resp= {1, 0, 1, 0};
Mathnet.Numericsライブラリを使用しています。
どうやってやるの?
Mathnet では、整数の配列を初期化できません。現状では、これに利用できるサポートは限られています。試してみると、次のようになります。
Unhandled Exception: System.TypeInitializationException: The type initializer
for 'MathNet.Numerics.LinearAlgebra.Vector`1' threw an exception. --->
System.NotSupportedException: Matrices and vectors of type 'Int32'
are not supported. Only Double, Single, Complex or Complex32 are supported at this point.
次のように、同様の値 (double を使用) でベクトルを初期化できます。
var resp = new [] {1.0, 0.0, 1.0, 0.0};
var V = Vector<double>.Build;
var rowVector = V.DenseOfArray(resp);
行列を構築するには、多次元配列が必要です。