Intel MKL (2023) 在 C 中找到最低特征值(复厄尔米特稀疏矩阵)

问题描述 投票:0回答:0

我知道这个问题很愚蠢。我想(只)找到一个复杂的厄尔米特稀疏矩阵的最低

M
特征值和特征向量。英特尔 MKL 显然可以做到这一点,但我根本找不到最新版本 英特尔 MKL 的手册。

Intel 官方指南 告诉我查看文件 path-to-mkl/examples/solvers_eec/source/dexample_extremal_svd_c.c

那个文件不存在,据我所知这个指南是从 2018 年开始的,不符合从 2023 年开始的最新版本的 mkl。(我使用的是 Arch-Linux 包

intel-oneapi-mkl
版本
2023.0.0_25398-1 
)

我相信我正在寻找的功能是

zfeast_hcsrev
根据 this 可能是更新的指南。我什至在库中找到了一个示例程序,它从字面上声称可以证明找到第一个
M
特征值(
$MKLROOT/examples/c/sparse_eigsolvers/source/zfeast_sparse.c
,根据安装情况,这可能需要先手动构建)。这包括这段话:

编辑:版权问题,我实际上不允许发布原始示例(即使它是一个免费示例),所以我重写了这个,以避免侵犯版权。

//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
    );

下面包含完整的示例(编辑:不,因为版权,即使它可以免费下载)。这给了我这个区间内的 4 个特征值。

声称这应该给出第一个

M
条目,示例程序有。所以我只是尝试设置
M=2
.

显然,这是行不通的。我仍然得到 4 个特征值。很明显我不明白输入参数的真正作用,而且我找不到任何官方指南。 (我试过在定义函数的

$MKL_INCLUDE_DIR/mkl_solvers_ee.h
中查找,但显然没有任何注释告诉我参数实际做什么)。

我什至尝试询问 chatGPT,但它无济于事,因为最新版本的英特尔 MKL 比 2021 更新。它建议我使用不再存在的功能。

此外,我什至不认为这是正确使用的功能,因为它只在特定的预定义间隔内搜索。如果我能在任何地方都获得最低的特征值,我会更愿意。

所以我的愚蠢问题是:我如何使用英特尔 MKL 仅找到复杂厄尔米特稀疏矩阵的最低

M
特征值和特征向量?请不要建议我切换到
armadillo
库,我只是因为它不是线程安全的而离开它。

编辑:由于许可证问题,我不允许发布完整的示例代码,(有点奇怪,看到我可以免费安装它但没关系)

c++ intel-mkl
© www.soinside.com 2019 - 2024. All rights reserved.