LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ARPACK++ error "Matrix data contains inconsistencies" (https://www.linuxquestions.org/questions/programming-9/arpack-error-matrix-data-contains-inconsistencies-888394/)

shitij90 06-26-2011 01:18 AM

ARPACK++ error "Matrix data contains inconsistencies"
 
Hi !!

In the following code, I am trying to define a matrix in CCS (which is equivalent to CSR for a symmetric matrix, right ?) in ARPACK++.
I have installed and patched ARPACK++.
(The matrix is not sparse, but still it should not give an error)


Code:

#include <iostream>
#include "arlsmat.h"//matrix class is here
#define N 3

using namespace std;

double acsr[]={7,1,1,
              1,2,3,
              1,3,6};//array with non-zero values
//actually, this is the whole matrix (there are no zero values !)

int ja[]={0,1,2,0,1,2,0,1,2};//column indices
int ia[]={0,3,6,9};//row indices

int main()
{
       
        ARluSymMatrix<double> arr(N, 9, acsr, ja, ia); //default value of  last parameter, uplo='L' (store lower triangle)
       
return 0;
}

This code gives me the error-
Arpack error in ARluSymMatrix::DefineMatrix.
-> Matrix data contain inconsistencies.

Why is this so ? I have checked the values of ia and ja by running intel MKl on the matrix to find the CSR (again, CSR=CCS for symmetric matrix, right ?--I am asking this because ARPACK++ uses CCS, not CSR), and the values are the same.

Is this some problem of 0 and 1 indexing ? Does ARPACK++ use 1 indexing ?


Thank you for your help in advance !!

shitij90 06-26-2011 11:55 PM

Never mind, got it.

For someone else who might get stuck,

1. The function requires only non zero elements from the lower/upper triangle, instead of the whole matrix.

2. So, to get CCS considering the lower triangle, consider the upper triangle and calculate the CSR (CCS=CSR of transposed) and vice versa.
Then feed this into the function and it should be fine.


All times are GMT -5. The time now is 02:59 PM.