【问题标题】:Debugging runtime error in Rcpp调试 Rcpp 中的运行时错误
【发布时间】:2013-12-10 18:25:36
【问题描述】:

我已将 R 中的采样算法转换为 Rcpp。 Rcpp 代码正在编译,但在从 R Error in eval(expr, envir, enclos) 调用函数时出错:索引超出范围”。traceback() 也没有提供信息。

7: stop(list(message = "index out of bounds", call = eval(expr, 
   envir, enclos), cppstack = NULL))  
6: .Call("temp1_eeSNP_regress", PACKAGE = "temp1", x, y, feature, 
   alpHa, gamMa_prob, beTa, estimate_alpha, estimate_beta, B_inv_alpHa, 
   itermax, thin, burnIn)  
5: eeSNP_regress(x = e.obj$x, y = e.obj$y, feature = e.obj$feature, 
   alpHa = e.obj$alpHa, beTa = e.obj$beTa, gamMa_prob = e.obj$gamMa.prob, 
   estimate_alpha = F, estimate_beta = T, B_inv_alpHa = rep(1/100, 
       dim(e.obj$feature)[2] + 1), itermax = 5000, thin = 40, 
   burnIn = 1000) at cmd.R#1  
4: eval(expr, envir, enclos)  
3: eval(ei, envir)  
2: withVisible(eval(ei, envir))

有没有办法在 Rcpp 中调试此类运行时错误,而不是抛出一堆 cout? R里面可以调用gdb吗?

【问题讨论】:

    标签: c++ r debugging rcpp


    【解决方案1】:

    是的,您可以将gdb 与 R 一起使用。

    参见编写 R 扩展手册中的 Section 4.4 "Debugging Compiled Code" 示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-16
      相关资源
      最近更新 更多