计算在C#中使用先进的矩阵库的C#的特征向量。净 [英] Calculating EigenVectors in C# using Advanced Matrix Library in C#. NET

查看:1168
本文介绍了计算在C#中使用先进的矩阵库的C#的特征向量。净的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,大家好,我现在用的是以下库: HTTP:// WWW 。codeproject.com / KB /食谱/ AdvancedMatrixLibrary.aspx

Ok guys, I am using the following library: http://www.codeproject.com/KB/recipes/AdvancedMatrixLibrary.aspx

和我想计算某些矩阵我的特征向量。我不知道该如何制订code。

And I wish to calculate the eigenvectors of certain matrices I have. I do not know how to formulate the code.

到目前为止,我已经尝试:

So far I have attempted:

Matrix MatrixName = new Matrix(n, n);
Matrix vector = new Matrix(n, 0);
Matrix values = new Matrix(n, 0);

Matrix.Eigen(MatrixName[n, n], values, vector);

但它说,最好的重载的方法匹配具有一些无效参数。我知道图书馆的作品,但我只是不知道如何制定我的C#code。

However it says that the best overloaded method match has some invalid arguments. I know the library works but I just do not know how to formulate my c# code.

任何帮助将是非常美妙!

Any help would be fantastic!

推荐答案

综观图书馆,本征方法的签名看起来是这样的:

Looking at the Library, the signature of the Eigen method looks like this:

public static void Eigen(Matrix Mat, out Matrix d,out Matrix v)

有几个误区:

  1. 注意旁边到D和V参数退出关键字。你需要的了关键字添加到调用征。

  1. Notice the out keyword next to the d and v parameters. You need to add the out keyword to the call to Eigen.

在code需要一个矩阵作为第一个参数,而你正在发送的元素。因此, matrixname中[N,N] 需要改变,以 matrixname中

The code expects a Matrix as the first argument, while you are sending an element. Thus, MatrixName[n, n] needs to change to MatrixName.

您不必实例化的载体和值矩阵,由于本征的方法可以实现这个要求,将返回值发送感谢out关键字的两个参数。需要注意的一点也就是你将如下接收输出:

You don't need to instantiate the vector and values Matrices, since the Eigen method does this for you and will return the values in the two arguments you send thanks to the out keyword. One thing to note as well is that you will receive the output as follows:

  • 值将是一个[N + 1,1]矩阵

  • values will be a [n+1,1] Matrix

载体将是一个[N + 1,N + 1]基

vector will be a [n+1,n+1] Matrix

还不如矩阵(N,0)如你期望从你最初的code。

Not as Matrix(n, 0) as you expect from your initial code.

在code将是这样的:

The code will look like this:

Matrix MatrixName = new Matrix(n, n);
Matrix vector;
Matrix values;

Matrix.Eigen(MatrixName, out values, out vector);

这篇关于计算在C#中使用先进的矩阵库的C#的特征向量。净的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆