Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

Schur complement for asymmetric matrix

$
0
0

Hi all,

I am using mkl pardiso to do Schur complement. So far I got it working for symmetric matrix.  But for asymmetric matrix, I got crash at phase = 11. The error message is "... Access violation writing location ...." 

Can anyone provide any guidance on what the possible root cause is? I am using mkl 2018 update 2. The source code is as below. 

Thanks!

Hainan

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

#include <mkl.h>

#include <iostream>

 

void main()

{

int n = 5;

double a[11] = { 2, 1.0,

1.0, 1.0,

6.0, 7.0,

2.5,

1.0, 1.0, 7.0, 3.5 };

int ia[6] = { 0, 2, 4, 6, 7, 11 };

int ja[11] = { 0, 4,

1, 4,

2, 4,

3,

0, 1, 2, 4 };

int matrix_order = LAPACK_ROW_MAJOR;

char uplo = 'U';

int mtype = 11;   /* Real asymmetric matrix */

  /* RHS and solution vectors. */

//double b[8], x[8];

int nrhs = 1;     /* Number of right hand sides. */

  /* Internal solver memory pointer pt, */

  /* 32-bit: int pt[64]; 64-bit: long int pt[64] */

  /* or void *pt[64] should be OK on both architectures */

void *pt[64];

/* Pardiso control parameters. */

int iparm[64];

int maxfct, mnum, phase, error, msglvl, info;

/* Auxiliary variables. */

int i, j;

double ddum;          /* Double dummy */

int idum;         /* Integer dummy. */

  /* Schur data */

double schur[3] = { 0.0, 0.0,

0.0 };

int perm[5] = { 0, 0, 1, 1, 1 };

int ipiv[2];

int n_schur = 3; /* Schur complement solution size */

/* -------------------------------------------------------------------- */

/* .. Setup Pardiso control parameters. */

/* -------------------------------------------------------------------- */

for (i = 0; i < 64; i++)

{

iparm[i] = 0;

}

iparm[1 - 1] = 1;         /* No solver default */

iparm[2 - 1] = 2;         /* Fill-in reordering from METIS */

iparm[10 - 1] = 8;        /* Perturb the pivot elements with 1E-13 */

iparm[11 - 1] = 0;        /* Use nonsymmetric permutation and scaling MPS */

iparm[13 - 1] = 0;        /* Maximum weighted matching algorithm is switched-off (default for symmetric). Try iparm[12] = 1 in case of inappropriate accuracy */

iparm[14 - 1] = 0;        /* Output: Number of perturbed pivots */

iparm[18 - 1] = -1;       /* Output: Number of nonzeros in the factor LU */

iparm[19 - 1] = -1;       /* Output: Mflops for LU factorization */

iparm[35 - 1] = 1;        /*0: one-base; 1: zero-base*/

iparm[36 - 1] = 1;        /* Use Schur complement */

 

maxfct = 1;           /* Maximum number of numerical factorizations. */

mnum = 1;             /* Which factorization to use. */

msglvl = 1;           /* Print statistical information in file */

error = 0;            /* Initialize error flag */

  /* -------------------------------------------------------------------- */

  /* .. Initialize the internal solver memory pointer. This is only */

  /* necessary for the FIRST call of the PARDISO solver. */

  /* -------------------------------------------------------------------- */

for (i = 0; i < 64; i++)

{

pt[i] = 0;

}

/* -------------------------------------------------------------------- */

/* .. Reordering and Symbolic Factorization. This step also allocates   */

/* all memory that is necessary for the factorization.                  */

/* -------------------------------------------------------------------- */

phase = 11;

pardiso(pt, &maxfct, &mnum, &mtype, &phase,

&n, a, ia, ja, perm, &nrhs, iparm, &msglvl, &ddum, &ddum, &error);

if (error != 0)

{

printf("\nERROR during symbolic factorization: %d", error);

exit(1);

}

}


Viewing all articles
Browse latest Browse all 2652

Trending Articles



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