Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Odd dgesv results

$
0
0

Hello,

I'm trying to refactor a piece of code that solves a simple Ax=b linear problem using MKL. From the manual, I saw that dgesv is the function I should call.

A is an n-by-n Jacobian matrix (with just 5 non-zero diagonals), while b and x are arrays of size n.

To solve the problem I use this snippet of code

MKL_INT n = matrix_size;
MKL_INT nrhs = 1;
MKL_INT info;
MKL_INT *pivot = calloc(matrix_size, sizeof(MKL_INT));
dgesv(&n, &nrhs, A, &n, pivot, b, &n, &info);

My problem is that the solution (stored in b) is completely different from my reference result as computed by the old code (a custom and unmaintainable solver). At some point I thought that I introduced an error in the computation of A or b, but if I store these two guys on disk, load them up into MATLAB and solve the problem with A\b, the result is consistent with the old solver.

Am I missing something?


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>