Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

problem with mkl_ddiasv

Petros_Mamales
Beginner
331 Views
[cpp]#include 
using std::cout;
using std::endl;
#include 

inline void test_Intel_diasv() {
	double values[ 5* 3];
	values[ 0 + 5 *0 ] = 0L; 	values[ 0 + 5 *1 ] = 100L; 		values[ 0 + 5 *2 ] = 1L; 
	values[ 1 + 5 *0 ] = 0L; 	values[ 1 + 5 *1 ] = 100.1L; 	values[ 1 + 5 *2 ] = 2L; 
	values[ 2 + 5 *0 ] = 11L; 	values[ 2 + 5 *1 ] = 100.2L; 	values[ 2 + 5 *2 ] = 0L; 
	values[ 3 + 5 *0 ] = 0L; 	values[ 3 + 5 *1 ] = 100.3L; 	values[ 3 + 5 *2 ] = 0L; 
	values[ 4 + 5 *0 ] = 0L; 	values[ 4 + 5 *1 ] = 100.4L; 	values[ 4 + 5 *2 ] = 0L; 

	MKL_INT dist[3];
	dist[0] = -2;
	dist[1] = 0;
	dist[2] = 3;
	
	double rhs[5] ;
	rhs[0] = 104L ;
	rhs[1] = 210.2L ;
	rhs[2] = 311.6L ;
	rhs[3] = 425.2L ;
	rhs[4] = 541L ;

	double sln[5] ;
	sln[0] = 1L ;
	sln[1] = 2L ;
	sln[2] = 3L ;
	sln[3] = 4L ;
	sln[4] = 5L ;

	double x[5] ;
	char transa='N';
	MKL_INT mRows = 5;
	double alpha = 1L;
	char matdescra[6];
	matdescra[0] = 'd';	//diagonal
	matdescra[1] = '-' ;	// non-Unit diagonals
	matdescra[2] = 'n' ;	// non-Unit diagonals
	matdescra[3] = 'f' ;	// FORTRAN indexing
	matdescra[4] = '-' ;	// non-Unit diagonals
	matdescra[5] = '-' ;	// non-Unit diagonals

	MKL_INT lval = 5;
	MKL_INT ndiag = 3;

	mkl_ddiasv( &transa, &mRows, α, matdescra, values, &lval, dist, &ndiag, rhs, x ) ;

	for ( size_t i = 0; i != 5; ++i )
		cout << x << "\t" << sln << endl;
}

int main() {
	test_Intel_diasv() ;
}[/cpp]
Hi,
The following example should give the obvious solution {1,2,3,4,5}.
The matrix is :
100 * * 1 *
* 100.1 * * 2
11 * 100.2 * *
* 12 * 100.3 *
* * 13 * 100.4

I get an error having to do with the matdescra input.
Can you please help ?
Thank you in advance,
Petros

0 Kudos
2 Replies
mecej4
Honored Contributor III
331 Views
You have to do some preparatory work before calling mkl_?ddiasv, which works on triangular matrices.

See this recent thread:

http://software.intel.com/en-us/forums/showthread.php?t=102273

0 Kudos
Petros_Mamales
Beginner
331 Views
Hi Mecej,
Thank you for your response,
Petros
0 Kudos
Reply