我正在尝试用this video (4:50)做一个层次分析程序。我被困在寻找标准权重的特征向量。我使用的是this webpage的类库,但结果差别很大。
这是我到目前为止编写的测试代码。
private void button_calculate_Click(object sender, EventArgs e)
{
double[,] matrix = new double[,]
{
{1, 1/3, 1/2},
{3, 1, 1 },
{2, 1, 1}
};
double[] eigenValue;
double[,] eigenVector;
alglib.smatrixevd(matrix, 3, 1, false, out eigenValue, out eigenVector);
}发布于 2016-08-28 20:18:10
在使用第三方库时,您应该始终非常仔细地阅读提供的文档。
在smatrixevd的情况下,它清楚地表明:
A:对称矩阵,由其上三角部分或下三角部分给出…
粗体部分用于强调。
你的输入矩阵不是对称的,所以就是这样。
您希望为通用矩阵调用的函数是rmatrixevd
发布于 2017-07-04 00:57:39
你必须包含所有11个.cs库文件,才能得到特征值和特征向量的结果,因为一个.cs文件依赖于其他.cs文件。注意!
cs文件如下:
alglibmisc.cs - contains different algorithms which are hard to classify
dataanalysis.cs - contains data mining algorithms
diffequations.cs - contains differential equation solvers
fasttransforms.cs - contains FFT and other related algorithms
integration.cs - contains numerical integration algorithms
interpolation.cs - contains interpolation algorithms
linalg.cs - contains linear algebra algorithms
optimization.cs - contains optimization algorithms
solvers.cs - contains linear and nonlinear solvers
specialfunctions.cs - contains special functions
statistics.cs - statistics
alglibinternal.cs - contains internal functions which are used by other packages, but not exposed to the external world
ap.cs - contains publicly accessible vector/matrix classes, most important and general functions and other "basic" functionality.要获取更多信息,请查看以下内容:Manual of alglib
对于本征向量和本征值,请查看以下内容:How to use eigen vector library
我试过了,它会起作用的.
https://stackoverflow.com/questions/39191029
复制相似问题