I'm trying to use the MKL libraries to build a MATLAB routine to solve a matrix equation with a packed storage symmetric matrix (to save memory). I'm able to get it up and running fine using the following code, but for larger problems (say 5000x5000, which is still relatively small) it will run fine ~50% of the time, and crash MATLAB ~50% of the time. Does anybody see anything that I am obviously doing wrong?
typedef size_t INT;
#define MKL_INT INT
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const mxArray *prhs)
/* Locals */
lapack_int n, nr, lda, ldb, info;
double *ar, *br;
ar = mxGetPr(prhs); /* pointer to first input matrix */
br = mxGetPr(prhs); /* pointer to second input matrix */
everything seems to work perfectly. At least I haven't been able to crash it yet. Using dspsv, it would generally run once, and then crash the next time it ran. The input matrix is a column matrix that has the right number of elements for a packed storage matrix (n*(n+1)/2), so I have no idea what the problem could be, especially since it seems to work correctly for very small arrays and when it does run it runs fine for large arrays as well. Any ideas?