You are probably reading a bad ARPACK documentation that has the wrong description of the ZNEUPD
subroutine. In reality there is an additional argument RWORK
before INFO
(for a total of 24 arguments) and also SIGMA
comes before WORKEV
- see the official documentation and some source code. That &INFO
comes as 0
in your case is just a lucky coincidence.
There is another problem in your code though - the C prototypes of the subroutines would be incorrect with most Fortran compilers on x86/x64. This is due to the fact that the CHARACTER
arguments BMAT
, WHICH
and HOWMNY
are character arrays (strings) and the length of each actual string argument is also passed by value as additional hidden argument of integer type. Therefore the prototype of ZNAUPD
should be:
extern "C"
void znaupd_(int *IDO,
char *BMAT,
int *N,
char *WHICH,
int *NEV,
double *TOL,
complex<double> *RESID,
int *NCV,
complex<double> *V,
int *LDV,
int *IPARAM,
int *IPNTR,
complex<double> *WORKD,
complex<double> *WORKL,
int *LWORKL,
double *RWORK,
int *INFO,
int _BMAT, // The length of the actual BMAT argument
int _WHICH // The length of the actual WHICH argument
);
The same is true for ZNEUPD
but it has three hidden integer arguments:
extern "C"
void zneupd_(bool *RVEC,
char *HOWMNY,
bool *SELECT,
complex<double> *D,
complex<double> *Z,
int *LDZ,
complex<double> *SIGMA,
complex<double> *WORKEV,
char *BMAT,
int *N,
char *WHICH,
int *NEV,
double *TOL,
complex<double> *RESID,
int *NCV,
complex<double> *V,
int *LDV,
int *IPARAM,
int *IPNTR,
complex<double> *WORKD,
complex<double> *WORKL,
int *LWORKL,
double *RWORK,
int *INFO,
int _HOWMNY,
int _BMAT,
int _WHICH
);