- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I am trying to use MKL and have some problems.

If sparse matrix has only one diagonal,everything isOK, but if not I can't find a solution.

This sample was tested on Matlab and passed succefully.

Solvers SG andPARDISO

Can you help me please with this problem.

Pavel.

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

vector

vector

vector

iaV.push_back(1);

for( int y = 0; y < fileA.Rows(); y++ )

{

int numValues = 0;

bool isData = false;

for( int x = 0; x < fileA.Cols(); x++ )

{

double value = fileA.Get( y, x );

if( value != 0 )

{

numValues++;

jaV.push_back( x + 1 );

aV.push_back( value );

}

}

if( numValues != 0 )

{

iaV.push_back( iaV[ iaV.size() - 1 ] + numValues );

}

}

vector

for( int y = 0; y < fileB.Rows(); y++ )

{

double value = fileB.Get( y, 0 );

rhsV.push_back( value );

}

Solve( fileA.GetNumLines(), iaV, jaV, aV, rhsV );

bool Solve( int matrixSize, vector

{

int n = matrixSize, rci_request, itercount;

double* rhs = &rhsV[0];

int* ia = &iaV[0];

int* ja = &jaV[0];

double* a = &aV[0];

double* solution = new double[matrixSize];

int ipar[128];

double dpar[128];

double* tmp = new double[4 * matrixSize];

char tr = 'u';

for( int i = 0; i < n; i++ )

solution* = 1;*

dcg_init( &n, solution, rhs, &rci_request, ipar, dpar, tmp );

if( rci_request != 0 )

return false;

ipar[8] = 1;

ipar[9] = 0;

dpar[0] = 1.E-5;

dcg_check( &n, solution, rhs, &rci_request, ipar, dpar, tmp );

if (rci_request != 0)

return false;

while(true)

{

dcg( &n, solution, rhs, &rci_request, ipar, dpar, tmp );

if (rci_request == 0)

break;

if(rci_request == 1)

{

mkl_dcsrsymv( &tr, &n, a, ia, ja, tmp, &tmp

continue;

}

return false;

}

dcg_get( &n, solution, rhs, &rci_request, ipar, dpar, tmp, &itercount );

MKL_FreeBuffers();

return true;

}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I tried to solve this matrix with CG and PARDISO, but most of the work was done on CG. I used PARDISO only to check if it passes or not. If you can help me with CG, I would be very glad, but if you think I should work with PARDISO, i will write here a PARDISO sample - it is twice as big.

Thank you for the swift reply!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

One double [][] fileA = {...}

and second double [] fileB = {...}

Pls help !!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

As withoutyour definition of the fileA, file B class, I haven'ttried to the exact code.

But according to your discription :

"If sparse matrix has only one diagonal,everything isOK, but if not I can't find a solution "

andread the input sparse matrix,

I thought, your problem should be in the CSR format of the matA, which issymmetric positive definite system and read by as full CSR format in your code, right?

But the function mkl_dcsrsymv() actually ask the upper or lower trianglein CSR format.

Please see MKL manuals.

The mkl_?csrsymv routine performs a matrix-vector operation defined as `y` := `A`*`x`

where:

`x` and `y` are vectors,

`A` is an upper or lower triangle of the symmetrical sparse matrix in the CSR format (3-array variation).

for example, upper triangle format,

for( int y = 0; y < fileA.Rows(); y++ )

{

int numValues = 0;

bool isData = false;

for( int x =

**y**; x < fileA.Cols(); x++ )

BestRegards,

Ying

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page