LAPACK routine works on iPhone simulator, but not on device
I'm using the Accelerate framework to solve 开发者_运维百科a under/overdetermined system of linear equations. The routine I'm using is dgelsd_ originally from LAPACK.
dgelsd_( &m, &n, &nrhs, a_t, &lda, b, &ldb, s, &RCOND, &IRANK, work, &workSize, iWork, &info);
This works fine in the simulator, where on supplying matrices a_t and b, the result is returned correctly in b. However, when I try this on the device, the result is all zeroes.
Where could I be going wrong? I have allocated a certain amount of working memory for the routine, as required, but I ran a check with the profiler and memory doesn't seem to be the issue.
Has anyone got LAPACK routines to work correctly on the iPhone device? Thanks.
Edit: iPhone SDK version 4.2, Device iPhone 4
Looks like it's a known issue when using double precision.
Solution: Use single-precision, i.e. Floats.
I am using sgesv_ (single-precison) to solve a 1200x1200 equation system. The execution time on an iPhone 4 is 1.1 s, compared to 60 s when using my old "manual" method.
LAPACK isn't available on ios devices - only BLAS and vDSP. It works on the simulator because that library is available on mac. iOS Accelerate Reference
精彩评论