【发布时间】:2021-09-13 05:55:55
【问题描述】:
我正在尝试通过 RcppArmadillo 使用来自犰狳 (http://arma.sourceforge.net/docs.html#spsolve) 的 SparseLU 求解器:
#define ARMA_USE_SUPERLU
// [Rcpp::depends(RcppArmadillo)]
#include <RcppArmadillo.h>
// [[Rcpp::export]]
arma::vec sp_solver(arma::sp_mat K, arma::vec x) {
arma::superlu_opts opts;
opts.symmetric = true;
arma::vec res;
arma::spsolve(res, K, x, "superlu", opts);
return res;
}
/*** R
library(Matrix)
K <- sparseMatrix(i = c(1, 2, 1), j = c(1, 2, 2), x = c(1, 1, 0.5), symmetric = TRUE)
x <- runif(2)
sp_solver(K, x)
*/
我收到错误 undefined reference to 'superlu_free'。
我想我错过了一些图书馆链接。
知道如何解决这个问题吗?
我使用的是 Windows 10。
【问题讨论】:
标签: r rcpp armadillo rcpparmadillo