0

I know this question is stupid. I want to find (only) the lowest M eigenvalues and eigenvectors of a complex hermitian sparse matrix. Intel MKL can clearly do this, but I am simply unable to find the manual for the latest version of Intel MKL.

The official Intel guidelines tell me to look at the file path-to-mkl/examples/solvers_eec/source/dexample_extremal_svd_c.c

That file does not exist, and as far as I can tell this guideline is from 2018 and does not conform to the latest version of mkl, which is from 2023. (I am using the Arch-Linux package intel-oneapi-mkl version 2023.0.0_25398-1)

I believe that the function I am looking for is zfeast_hcsrev as per this possibly newer guide. I even found an example program in the library which literally claims to demonstrate finding the first M eigenvalues ($MKLROOT/examples/c/sparse_eigsolvers/source/zfeast_sparse.c, depending on installation this may need to be built manually first). This includes this passage:

EDIT: Copyright issue, I am literally not allowed to post the original example, (even though it is a free example), so instead I have rewritten this, to avoid copyright infringement.

//Set the array fpm to default values, I don't think that should include the number of eigenvalues
feastinit(fpm);


//z (complex double) feast _ hcsr (complex sparse hermitian) ev (solve Ax = ex for e and x).
zfeast_hcsrev
(
    &UPLO,   // Is this the full or upper triangular matrix
    &N,      // matrix size
    val,     //CSR value, rows and cols
    rows,    
    cols,    
    fpm,     //parameter array
    &rel_error, //program writes relative error found
    &loop,   //number of loops used
    &Emin,   //lower and upper bound of eigenvalues
    &Emax,   
    &M0,     //The example calls this: "initial guess for subspace dimension to be used", I don't know what that means
    E,       //Claimed to be the first M eigenvalues
    X,       //Claimed to the first M Eigenvectors as a matrix
    &M,      // M, the number I want, but this only seems to be an output
    res_err,     //error on residual vectors
    &error_code    //error code
    );

The full example is included below (EDIT: NO, BECAUSE COPYRIGHT, even though it can be downloaded for free). This gives me 4 eigenvalues inside this interval.

The claim is that this should give the first M entries, the example program has. So I simply try to set M=2.

Obviously, this does not work. I still get 4 eigenvalues. So clearly I don't understand what the input parameters really do, and I can not find any official guidelines for this. (I have tried looking in $MKL_INCLUDE_DIR/mkl_solvers_ee.h where the function is defined, but that obviously doesn't include any comments telling me what the parameters actually do).

I even tried asking chatGPT, but it could not help, because the newest version of intel MKL is newer than 2021. It suggested I use a function which does not exist anymore.

Besides, I don't even think this is the right function to use, as it only searches in a particular pre-defined interval. I would prefer if I could just get the lowest eigenvalues everywhere.

So my stupid question is: how do I actually find only the lowest M eigenvalues and eigenvectors of a complex hermitian sparse matrix using Intel MKL? Please do not suggest that I switch over to the armadillo library, I just switched away from it because it is not thread-safe. (Edit: Normally armadillo is thread-safe, but NOT in the particular case of finding eigenvalues of a complex sparse matrix using eigs_gen which relies on ARPACK, as per my previous question)

EDIT: I am not allowed to publish the full example code, due to license issues, (kind of weird, seeing that I can install it for free but ok)

Nikolaj
  • 1,137
  • 10
  • 22
  • If you read the [documentation](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-0/feast-scsrev-feast-hcsrev.html) of the MKL it will tell you that `m` is an output parameter that tells you how many eigenvalues it found in the given interval. So you can only specify the interval in which you want to search for eigenvalues, but not how many you want to search for. (If you set `m0` to a too low value, the routine will fail.) Also, regarding armadillo and thread-safety, see https://stackoverflow.com/questions/30063240/is-armadillo-solve-thread-safe – chris_se Mar 19 '23 at 12:50
  • Could you please let us know which data layout you are trying for? And, could you please find the below document https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2023-0/the-feast-algorithm.html – Varsha - Intel Apr 14 '23 at 17:27

0 Answers0