Community
cancel
Showing results for 
Search instead for 
Did you mean: 
51 Views

Problem getting mkl_scsrsv function to work.

Hi, I am just trying to solve a simple linear equation with this test program. I am using MKL 2017 with Microsoft Visual Studio and have tested other functions with the array matdescra with them working. 

In the documentation, I tried following: void mkl_scsrsv (const char *transa , const MKL_INT *m , const float *alpha , const char *matdescra , const float *val , const MKL_INT *indx , const MKL_INT *pntrb , const MKL_INT *pntre , const float *x , float *y ); 

#include <stdio.h>
#include <stdlib.h>
#include "mkl.h"


#define NNZ_A 12
#define M_A 6



/* 
	This sample program tries to compute:

	[ 3.0, 0.0, 0.0, 4.0, 0.0, 0.0 ]                [1]
	[ 0.0, 5.0, 0.0, 0.0, 0.0, 1.0 ]                [4]
	[ 0.0, 0.0, 0.0, 6.0, 0.0, 0.0 ]      X   =     [6]
	[ 0.0, 10.0, 0.0, 0.0, 11.0, 0.0 ]              [8]
	[ 12.0, 0.0, 0.0, 1.0, 2.0, 3.0 ]		[2]
	[ 0.0, 0.0, 8.0, 0.0, 0.0, 0.0 ]                [4]

*/

int main() {

	float			A[NNZ_A] = { 3.0, 4.0, 5.0, 1.0, 6.0, 10.0, 11.0, 12.0, 1.0, 2.0, 3.0, 8.0 };
	MKL_INT			A_col[NNZ_A] = { 1, 4, 2, 6, 4, 2, 5, 1, 4, 5, 6, 3 };
	MKL_INT			A_rowIndex[M_A + 1] = { 1, 3, 5, 6, 8, 12, 13 };
	char			matdescra[6];
	char			transa = 'n';
	MKL_INT m = M_A;
	MKL_INT k = M_A;
	float alpha = 1.0;


	float			X[M_A] = { 1.0, 4.0, 6.0, 8.0, 2.0, 4.0 };
	float			Y[M_A] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };

	matdescra[0] = 'g';
	matdescra[3] = 'c'; 


	mkl_scsrsv(&transa, &m, &alpha, matdescra, A, A_col, A_rowIndex, &(A_rowIndex[1]), X, Y);

	
	getchar(); 

	return 0;
}

Yet I get the error message: 
Intel MKL ERROR: Parameter 4 was incorrect on entry to MKL_SCSRSV.

I just cannot get matdescra working on the CSR function for some reason. I appreciate any help, I have been stuck on what to do. 

 

0 Kudos
1 Reply
MariaZh
Employee
51 Views

Hi,

The point is that this routine can only be used for sparse upper or lower triangular matrices, so that matdescra[0]='G' is inconsistent. 
Please take a look at the description at https://software.intel.com/ru-ru/node/520828#1AEAB8E0-C05B-46E4-ACDC-203CFA5E668A:

alpha is scalar, x and y are vectors, A is a sparse upper or lower triangular matrix with unit or non-unit main diagonal, AT is the transpose of A.


Best regards,
Maria

Reply