- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear MKL users,
I am a bit confused with how to use mkl routines for upper triangular matrices. For example. I have the matrix:
1.000000 2.000000 3.000000
0.000000 4.000000 5.000000
0.000000 0.000000 8.000000
which I store row major format via:
the array data of size num_columns by num_rows with entry i,j stored as
data[i*num_cols + j] = value
I store the full matrix, even the zeros. Then I call the following to get the inverse:
LAPACKE_dtrtri( LAPACK_ROW_MAJOR, 'U', 'N', num_column, data, num_columns);
this Lapacke routine works fine and data is overwritten with the inverse matrix, as expected.
Now I would like to solve the system A x = b with
double b[3] = {1.,2.,3.}
cblas_dtrsv (CblasRowMajor, 'u', 'n', 'n', 3, data, 3, b, 1);
but the output is always:
Intel MKL ERROR: Parameter 2 was incorrect on entry to cblas_dtrsv
I tried to store only the nonzero elements in data, i.e. change the data array to be
double data[6] = {1.,2.,3.,4.,5.,8.}
but I still get the same error. Can someone explain how I must define my matrix to be recognized as upper triangular for the cblas routine and how the cblas routines are different from the Lapacke ones?
thanks very much
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please use the enum constants as named at https://software.intel.com/en-us/node/468386. The MKL documentation is, I think, misleading in that it seems to say that the values 'U' and 'N' are suitable for the Cblas_?trsv argument Uplo, just the same as for the Fortran BLAS routine ?trsv argument uplo. In your program, use
cblas_dtrsv(CblasRowMajor, CblasUpper, CblasNoTrans, CblasNonUnit, 3, A, 3, b, 1);
and you will not only get the correct behavior, but the source code will also have better readability.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replacing the characters by the enum constants fixed it. Thank you!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page