Dear Yixuan,
Thank you very much.
I embedded the following into the program and it worked. The only thing changed
was that I added "Rcpp::” so it could read in a cpp file.
Rcpp::NumericVector test()
{
Rcpp::Environment pkg("package:mvtnorm");
Rcpp::Function pmvnorm = pkg["pmvnorm"];
Rcpp::NumericVector lower = Rcpp::NumericVector::create(1, 0, 1);
Rcpp::NumericVector upper = Rcpp::NumericVector::create(2, 1, 2);
Rcpp::NumericVector mean = Rcpp::NumericVector::create(0, 0, 0);
Rcpp::NumericMatrix cov(3, 3);
cov(0, 0) = cov(1, 1) = cov(2, 2) = 1;
return pmvnorm(lower,upper, mean, cov);
}
Best,
Li
On Jan 22, 2015, at 5:44 PM, Yixuan Qiu
<[email protected]<mailto:[email protected]>> wrote:
NumericVector test()
{
Environment pkg("package:mnormt");
Function pmnorm = pkg["pmnorm"];
NumericVector x = NumericVector::create(1, 0, 1);
NumericVector mean = NumericVector::create(0, 0, 0);
NumericMatrix cov(3, 3);
cov(0, 0) = cov(1, 1) = cov(2, 2) = 1;
return pmnorm(x, mean, cov);
}
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel