Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Stack Overflow Error in Eigenvalue Solver: dfeast_scsrgv

$
0
0

Hi,

I'm trying to solve eigenvalue problem for large sparse matrices using dfeast_scsrgv function. The function works fine for small problems (ex: 8*8 sparse matrix) but it gives System.StackOverflowException error for larger problems( ex: 200*200 sparse matrix) . I'm using Visual Studio 2008 and MKL version 11 with most recent updates installed. My system is windows 64 bit and the programming language is C++. Following I provided the eigenvalue solver code that I'm using. In debug mode when I reach  dfeast_scsrgv  line it gives me Stack Overflow error. I do not think I am using any infinite loop or unnecessary large arrays. I would appreciate if someone can help me to fix the problem. Thanks! 

   
//Convert stiffness and mass matrix to CSR format - Seldon library
int NumStiff = M_GStiff.GetDataSize();   
Vector<double> V_GStiffVal   (NumStiff);   
Vector<int>    V_GStiffColInd(NumStiff);
Vector<int>    V_GStiffRowPtr(PrbDim+1);
ConvertToCSR(M_GStiff, prop, V_GStiffRowPtr, V_GStiffColInd, V_GStiffVal);  
 
int NumMass = M_GMass.GetDataSize();
Vector<double> V_GMassVal   (NumMass);
Vector<int>    V_GMassColInd(NumMass);
Vector<int>    V_GMassRowPtr(PrbDim+1);
ConvertToCSR(M_GMass, prop, V_GMassRowPtr, V_GMassColInd, V_GMassVal);   
 
//Release memory
M_GStiff.Clear();
M_GMass.Clear();
 
//Convert Seldon format to typical C array
double* a = V_GStiffVal.GetData();
int*   ia = V_GStiffRowPtr.GetData();
int*   ja = V_GStiffColInd.GetData();   
 
double* b = V_GMassVal.GetData();
int*   ib = V_GMassRowPtr.GetData();
int*   jb = V_GMassColInd.GetData();
 
// Convert matrix from 0-based C-notation to Fortran 1-based
int nnz = ia[PrbDim]; 
for (int i = 0; i < PrbDim+1; i++)        ia[i] += 1;    
for (int i = 0; i < nnz; i++)                 ja[i] += 1;  
 
for (int i = 0; i < PrbDim+1; i++)      ib[i] += 1;
for (int i = 0; i < nnz; i++)              jb[i] += 1;
 
// Initialize variables for the solver
double Error    = 0;
int    Loop     = 0;
int    NumMode  = 10;
double Emin     = 0;
double Emax     = pow(10.0,10.0);    
int    Flag     = 0;
char   MTyp     = 'U';
int    NumEigen = NumMode;
 
vector<int>    V_FPM (128,0);
vector<double> V_Eigen(NumMode,0);
vector<double> V_Res (NumMode,0);    
 
V_FPM[0]  = 1;
V_FPM[1]  = 8;
V_FPM[2]  = 12;
V_FPM[3]  = 20;
V_FPM[4]  = 0;
V_FPM[5]  = 0;
V_FPM[6]  = 5;
V_FPM[13] = 0;
V_FPM[63] = 0;
 
int*    P_FPM          = &V_FPM[0];
double* P_Eigen        = &V_Eigen[0];  
double* P_Res          = &V_Res[0];    
double dDum;
 
// Call Eigenvalue Solver
dfeast_scsrgv (&MTyp, &PrbDim, a, ia, ja, b, ib, jb,
                P_FPM, &Error, &Loop, &Emin, &Emax, &NumMode, P_Eigen, &dDum, &NumEigen, P_Res, &Flag);

Viewing all articles
Browse latest Browse all 1616

Trending Articles



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