[Rcpp-devel] error handling for computational singularity
Xiao He
praguewatermelon at gmail.com
Sun Jul 7 03:56:30 CEST 2013
Hi dear listers,
Take the mock function below for an example. What would be the best way to
handle computational singularity?
#include <R.h>
#include <stdio.h>
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
using namespace arma;
RcppExport SEXP foo(SEXP X, SEXP Y){
arma::mat x=Rcpp::as<arma::mat>(X), y=Rcpp::as<arma::mat>(Y);
arma::mat output = arma::solve(x, y );
return(wrap(output));
}
For instance, if I use the function on the dataset below, R would crash. I
read the error handling section of the document in
http://www.jstatsoft.org/v40/i08/paper, but I am not exactly sure what to
do with my situation. Thank you in advance for your help!
x = cbind(1:2, 1:2)
.Call("foo", x, x)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130706/822003c1/attachment.html>
More information about the Rcpp-devel
mailing list