如何在c#中将整数数组转换为矩阵

时间:2015-05-12 04:49:04

标签: c# mathnet

我有一个名为resp的整数数组我希望将其重写/转换为/ {row matrix,名称为resp

int[] resp= {1, 0, 1, 0};

我正在使用Mathnet.Numerics库。

我该怎么做?

1 个答案:

答案 0 :(得分:1)

在Mathnet中,您无法初始化整数数组。事实上,这方面的支持有限。如果你尝试过,你会得到这个:

app.set('views', path.join(__dirname, 'views'));

您可以初始化具有相似值(带双精度)的矢量,如下所示:

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.

为了构建矩阵,您需要一个多维数组。