Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Dec 21, 2023
1 parent 7f29384 commit fb27749
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/fdasrsf/bayesian.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <RcppArmadillo.h>
#include <Rcpp.h>
// Correctly setup the build environment
// [[Rcpp::depends(RcppArmadillo)]]

Expand Down Expand Up @@ -275,7 +274,7 @@ RcppExport SEXP simucode(SEXP R_iter, SEXP R_p, SEXP R_qt1_5, SEXP R_qt2_5,
logpost = (p/2+alpha)*log(kappa)-kappa*(beta+dist);
log_collect[j] = logpost;
}

NumericVector pctaccept = as<NumericVector>(numaccept) / iter;
vec Rr_best_match = best_match+1;
mat Rr_match_collect = match_collect+1;
Expand Down
10 changes: 4 additions & 6 deletions src/fdasrsf/pair_align_functions_expomap.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <RcppArmadillo.h>
#include <Rcpp.h>
// Correctly setup the build environment
// [[Rcpp::depends(RcppArmadillo)]]

Expand Down Expand Up @@ -38,7 +37,7 @@ RcppExport SEXP cuL2norm2(SEXP R_x, SEXP R_y) {

// get ordering of x
// borrowed from Hadley Wickhams github.com/hadley/adv-r/blob/master/extras/cpp/order.cpp

vector<pair<double, int> > vals;
vals.reserve(n);
for(int i = 0; i < n; i++) {
Expand Down Expand Up @@ -93,9 +92,8 @@ RcppExport SEXP trapzCpp(SEXP R_x, SEXP R_y) {

// order vectors and calculate l2 norm, for f.L2norm()
//RcppExport double order_l2norm(NumericVector x, NumericVector y) {
RcppExport SEXP order_l2norm(SEXP R_x, SEXP R_y) {
vec x = as<vec>(R_x);
vec y = as<vec>(R_y);
RcppExport double order_l2norm(vec x, vec y) {

int n = x.size();
// get ordering of x
// borrowed from Hadley Wickhams adv-r/extras/cpp/order.cpp
Expand Down Expand Up @@ -128,5 +126,5 @@ RcppExport SEXP order_l2norm(SEXP R_x, SEXP R_y) {
for (int i = 0; i<(n-1); i++) {
area2 += (xSort[i+1] - xSort[i]) * (ySortSq[i+1] + ySortSq[i]);
}
return wrap(sqrt(area2 / 2.0));
return sqrt(area2 / 2.0);
}

0 comments on commit fb27749

Please sign in to comment.