2016-08-28 46 views
0

尋找特徵向量,我試圖讓使用this video(4:50)的AHP程序。我被困在尋找標準權重的特徵向量。我從this webpage使用了一個類庫,但結果差異很大。從矩陣

這是我寫到目前爲止testcode。

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); 
    } 

回答

1

當使用第三方庫時,您應該經常仔細閱讀提供的文檔。

smatrixevd的情況下,它明確規定:

答:這是由其上部或下部三角部分給出對稱矩陣...

爲了強調加粗部分。

你輸入矩陣不是對稱的,所以你去。

您要撥打的通用矩陣功能是rmatrixevd

+0

我明白了。我不得不承認,即使矩陣只有相同數量的行和列......我會看看,並感謝你。 – tomiG

+0

@ user3699148它與行和列無關;您只能評估方矩陣的特徵值。對稱矩陣意味着給定矩陣「A」,它的轉置矩陣是相同的; '轉置(A)= A'。 – InBetween

1

你必須包括所有11層的.cs庫文件存在於alglib得到特徵值和特徵向量的結果becoz一個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

我曾經嘗試這樣做,它會工作。 ..