关于ipad和模拟器上的不同结果

时间:2013-01-31 02:37:39

标签: iphone ios xcode ipad ios-simulator

我想计算对称矩阵的特征向量。 xcode上的模拟器给出了正确的答案,但ipad却没有。那个怎么样?我使用dsyevd_来获取它们。特征值是相同的,但特征向量并不完全相同,它们的结果如下所示。

逐列

模拟器:

-0.009208  -0.404135  -0.210490  -0.312938   0.319550  -0.054404   0.737996   0.211291 
 0.169398   0.066748   0.379263  -0.370896  -0.250928  -0.437742  -0.118876   0.645547 
 0.110466   0.209999   0.326172   0.103889   0.123889   0.783749   0.136729   0.422151 
-0.104180  -0.116803  -0.608893  -0.361196  -0.518578   0.358588  -0.196926   0.194939 
 0.378676   0.302345  -0.023872  -0.680679   0.387809   0.109714  -0.193866  -0.318246 
-0.084033   0.817684  -0.351129   0.104907  -0.057308  -0.193755   0.367770   0.118133 
-0.418374   0.003169  -0.263900   0.056836   0.620621  -0.077634  -0.444729   0.403855 
 0.789095  -0.120198  -0.375779   0.381694   0.108631  -0.083484  -0.114602   0.209948 

ipad设备:

-0.188080  -0.329016  -0.541892   0.066310   0.206281  -0.231312   0.263823  -0.626635 
-0.043405   0.132373  -0.026365   0.363429   0.238327   0.861865   0.117671  -0.185366 
-0.061033   0.293438   0.013891   0.331374  -0.284734  -0.111909  -0.702862  -0.461036 
-0.104180  -0.116803  -0.608893  -0.361196  -0.518578   0.358588  -0.196926   0.194939 
 0.378676   0.302345  -0.023872  -0.680679   0.387809   0.109714  -0.193866  -0.318246 
-0.084033   0.817684  -0.351129   0.104907  -0.057308  -0.193755   0.367770   0.118133 
-0.418374   0.003169  -0.263900   0.056836   0.620621  -0.077634  -0.444729   0.403855 
 0.789095  -0.120198  -0.375779   0.381694   0.108631  -0.083484  -0.114602   0.209948

前三个元素完全不同,但其他五个元素完全相同。谁能帮助我?我试图弄清楚很多天。非常感谢你。

使用dsyevd _

添加计算特征向量的代码
__CLPK_integer n = N, lda = LDA, info, lwork, liwork, iwkopt;
__CLPK_integer* iwork;
double wkopt;
double* work;
double s[N];
printf( " DSYEVD Example Program Results\n" );
lwork = -1;
liwork = -1;
dsyevd_( "Vectors", "U", &n, v, &lda, s, &wkopt, &lwork, &iwkopt, &liwork, &info );
lwork = (int)wkopt;
work = (double*)malloc( lwork*sizeof(double) );
liwork = iwkopt;
iwork = (__CLPK_integer*)malloc( liwork*sizeof(int) );
dsyevd_( "Vectors", "U", &n, v, &lda, s, work, &lwork, iwork, &liwork, &info );
if( info > 0 ) {
    printf( "The algorithm failed to compute eigenvalues.\n" );
    exit( 1 );
}  

0 个答案:

没有答案