栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

Error in .C(“ADMM

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Error in .C(“ADMM

# 下面这一段的result用到了函数loggle()
library('sm')
library('igraph')
X <- example$X
Omega.true <- example$Omega.true
dim(X) # dimension of data matrix
p <- nrow(X) # number of variables
pos <- round(seq(0.1, 0.9, length=9)*(ncol(X)-1)+1)
K <- length(pos)
ts <- proc.time()
result <- loggle(X, pos, h = 0.1, d = 0.15,
                 lambda = 0.25, fit.type = "pseudo", refit = TRUE,
                 num.thread = 1)




#loggle()函数定义中有一段如下的代码
#loggle()返回的就是result
  ...
  result <- .C("ADMM_simple",  #"ADMM_simple"是在另一个c语言的代码中定义的函数,
  								#这里通过.C()把"ADMM_simple"调过来,但是执行会出错
               as.double(Corr[, , Nd.index]),
               Z.vec = as.double(Z.vec),
               as.integer(p),
               as.integer(Nd),
               as.integer(Nd.pos.c),
               as.integer(Nd.pos.l),
               as.integer(member.index),
               as.integer(csize.index),
               as.integer(no),
               as.double(lambda),
               as.integer(fit.type),
               as.double(rho),
               as.double(epi.abs),
               as.double(epi.rel),
               as.integer(max.step)
   ...
   return(result)



#"ADMM_simple"在c语言中是这么定义的
void ADMM_simple(double *Corr, double *Z, int *P, int *Len, 
	int *Pos, int *Pos_Len, int *member_ind, int *csize_ind, 
	int *No, double *Lambda, int *fit_type, double *Rho, 
	double *Epi_abs, double *Epi_rel, int *Max_step){
  
	int p = *P, no = *No, L = *Len, Pos_L = *Pos_Len, p_n, n, i, j, k;
	int *member_ind_n;

	//iteration across block diagonals
	for(n=0; n..略..}
	//end iteration across block diagonals
}

于是我去网上找了一下R语言中的.C(),看到一篇论文里是把c语言代码变成一个R包然后在R里导入包,再执行.C()代码的。

我不知道论文中R包testsqrt是怎么做的?这个问题应该怎么解决呢?

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/886880.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号