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)
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to