Skip to content

Commit

Permalink
sign comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebaron committed Mar 9, 2017
1 parent 5adcf63 commit e80550e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/devtran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Rcpp::List DEVTRAN(const Rcpp::List parin,
idat.idata_row();

// Number of individuals in the data set
const unsigned int NID = dat.nid();
const int NID = dat.nid();
const int nidata = idat.nrow();

int j = 0;
Expand Down Expand Up @@ -219,13 +219,14 @@ Rcpp::List DEVTRAN(const Rcpp::List parin,
// Matrix of designs
Rcpp::NumericMatrix tgrid = Rcpp::as<Rcpp::NumericMatrix>(parin["tgridmatrix"]);


// Vector of length idata.nrow() that maps each ID to a design
// Already has C indexing
Rcpp::IntegerVector tgridi = Rcpp::as<Rcpp::IntegerVector>(parin["whichtg"]);

if(tgridi.size() == 0) tgridi = Rcpp::rep(0,NID);

if(tgridi.size() < NID) CRUMP("Length of design indicator less than NID.");
if(tgridi.size() < (signed) NID) CRUMP("Length of design indicator less than NID.");

if(max(tgridi) >= tgrid.ncol()) {
Rcpp::stop("Insufficient number of designs specified for this problem.");
Expand Down

0 comments on commit e80550e

Please sign in to comment.