Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
build fixes in some systems
Browse files Browse the repository at this point in the history
  • Loading branch information
dkesada committed Dec 2, 2020
1 parent aa157cc commit ee98de6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 55 deletions.
3 changes: 2 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
CXX_STD = CXX11
16 changes: 4 additions & 12 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
// [[Rcpp::export]]
Rcpp::List create_causlist_cpp(Rcpp::List &cl, Rcpp::List &net, unsigned int size, StringVector &ordering) {
Rcpp::List aux;
Rcpp::StringVector caus_unit;
Rcpp::StringVector caus_unit, parents;
std::string node;
Rcpp::StringVector parents;

// Translation into causal list
for(unsigned int i = 0; i < ordering.size(); i++){
Expand Down Expand Up @@ -40,8 +39,7 @@ Rcpp::CharacterMatrix cl_to_arc_matrix_cpp(Rcpp::List &cl, Rcpp::CharacterVector
unsigned int rows){
Rcpp::StringMatrix res (rows, 2);
unsigned int res_row = 0;
Rcpp::List slice;
Rcpp::List cu;
Rcpp::List slice, cu;
Rcpp::StringVector nodes;
Rcpp::NumericVector arcs;

Expand Down Expand Up @@ -72,14 +70,8 @@ Rcpp::CharacterMatrix cl_to_arc_matrix_cpp(Rcpp::List &cl, Rcpp::CharacterVector
//' @return a list with the modified position and the new number of arcs
// [[Rcpp::export]]
Rcpp::List pos_plus_vel_cpp(Rcpp::List &cl, Rcpp::List &vl, int n_arcs){
Rcpp::List slice_cl;
Rcpp::List slice_vl;
Rcpp::List cu_cl;
Rcpp::List cu_vl;
Rcpp::List pair_cl;
Rcpp::List pair_vl;
Rcpp::NumericVector dirs_cl;
Rcpp::NumericVector dirs_vl;
Rcpp::List slice_cl, slice_vl, cu_cl, cu_vl, pair_cl, pair_vl;
Rcpp::NumericVector dirs_cl, dirs_vl;
Rcpp::List res (2);

for(unsigned int i = 0; i < cl.size(); i++){
Expand Down
12 changes: 4 additions & 8 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ Rcpp::NumericVector add_vel_dirs_vec(const NumericVector &d1, const NumericVecto
// @param cmp the direction to be searched, either 0 or 1
// @return a list with the Velocity's new causal list and number of operations
void locate_directions(Rcpp::List &vl, Rcpp::List &pool, int cmp, bool invert){
Rcpp::List slice;
Rcpp::List cu;
Rcpp::List pair;
Rcpp::List slice, cu, pair;
Rcpp::NumericVector dirs;
unsigned int pool_i = 0;

Expand All @@ -214,7 +212,7 @@ void locate_directions(Rcpp::List &vl, Rcpp::List &pool, int cmp, bool invert){
for(unsigned int k = 0; k < dirs.size(); k++){
if(invert)
dirs[k] = -dirs[k];
if(abs(dirs[k]) == cmp){
if(std::abs(dirs[k]) == cmp){
Rcpp::NumericVector pool_res (3);
pool_res[0] = i;
pool_res[1] = j;
Expand All @@ -233,10 +231,8 @@ void locate_directions(Rcpp::List &vl, Rcpp::List &pool, int cmp, bool invert){
// @param cmp the direction to be searched, either 0 or 1
// @return a list with the Velocity's new causal list and number of operations
void modify_directions(Rcpp::List &vl, Rcpp::List &n_pool, int cmp){
Rcpp::List slice;
Rcpp::List pair;
Rcpp::NumericVector tuple;
Rcpp::NumericVector dirs;
Rcpp::List slice, pair;
Rcpp::NumericVector tuple, dirs;
unsigned int idx;
NumericVector base = {-1,1};
NumericVector rand (1);
Expand Down
46 changes: 12 additions & 34 deletions src/velocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
//' @return a velocity list with randomized values
// [[Rcpp::export]]
Rcpp::List randomize_vl_cpp(Rcpp::List &vl, NumericVector &probs) {
Rcpp::List slice;
Rcpp::List velocity;
Rcpp::List directions;
Rcpp::List cu;
Rcpp::List pair;
unsigned int abs_op = 0;
Rcpp::List slice, velocity, directions, cu, pair;
unsigned int abs_op = 0, dir_tmp;
Rcpp::List res (2);

// Initialization of the velocity
Expand All @@ -22,7 +18,8 @@ Rcpp::List randomize_vl_cpp(Rcpp::List &vl, NumericVector &probs) {
pair = slice[j];
directions = random_directions(probs, slice.size());
pair[1] = directions[0];
abs_op += directions[1];
dir_tmp = directions[1]; // Error on some systems with abs_op += directions[1];
abs_op += dir_tmp;
}
}

Expand All @@ -40,18 +37,8 @@ Rcpp::List randomize_vl_cpp(Rcpp::List &vl, NumericVector &probs) {
//' @return a list with the Velocity's causal list and the number of operations
// [[Rcpp::export]]
Rcpp::List pos_minus_pos_cpp(Rcpp::List &cl, Rcpp::List &ps, Rcpp::List &vl){
Rcpp::List slice_cl;
Rcpp::List slice_ps;
Rcpp::List slice_vl;
Rcpp::List cu_cl;
Rcpp::List cu_ps;
Rcpp::List cu_vl;
Rcpp::List pair_cl;
Rcpp::List pair_ps;
Rcpp::List pair_vl;
Rcpp::NumericVector dirs_cl;
Rcpp::NumericVector dirs_ps;
Rcpp::NumericVector dirs_vl;
Rcpp::List slice_cl, slice_ps, slice_vl, cu_cl, cu_ps, cu_vl, pair_cl, pair_ps, pair_vl;
Rcpp::NumericVector dirs_cl, dirs_ps, dirs_vl;
int n_abs = 0;
Rcpp::List res (2);

Expand Down Expand Up @@ -89,14 +76,8 @@ Rcpp::List pos_minus_pos_cpp(Rcpp::List &cl, Rcpp::List &ps, Rcpp::List &vl){
//' @return a list with the Velocity's causal list and the number of operations
// [[Rcpp::export]]
Rcpp::List vel_plus_vel_cpp(Rcpp::List &vl1, Rcpp::List &vl2, int abs_op){
Rcpp::List slice_vl1;
Rcpp::List slice_vl2;
Rcpp::List cu_vl1;
Rcpp::List cu_vl2;
Rcpp::List pair_vl1;
Rcpp::List pair_vl2;
Rcpp::NumericVector dirs_vl1;
Rcpp::NumericVector dirs_vl2;
Rcpp::List slice_vl1, slice_vl2, cu_vl1, cu_vl2, pair_vl1, pair_vl2;
Rcpp::NumericVector dirs_vl1, dirs_vl2;
Rcpp::List res (2);

for(unsigned int i = 0; i < vl1.size(); i++){
Expand Down Expand Up @@ -133,12 +114,9 @@ Rcpp::List vel_plus_vel_cpp(Rcpp::List &vl1, Rcpp::List &vl2, int abs_op){
// [[Rcpp::export]]
Rcpp::List cte_times_vel_cpp(float k, Rcpp::List &vl, unsigned int abs_op, int max_op){
Rcpp::List res (2);
int n_op;
Rcpp::List pool;
Rcpp::List n_pool;
int idx;
int n_op, idx, cmp;
Rcpp::List pool, n_pool;
int l_pool = abs_op;
int cmp;
Rcpp::NumericVector pos;
bool invert = false;
NumericVector tmp;
Expand All @@ -165,13 +143,13 @@ Rcpp::List cte_times_vel_cpp(float k, Rcpp::List &vl, unsigned int abs_op, int m

if(n_op < 0){ // Convert {0} into {1,-1}
l_pool = max_op - abs_op; // Number of 0's remaining
n_op = abs(n_op);
n_op = std::abs(n_op);
pool = Rcpp::List(l_pool);
cmp = 0;
}

else{ // Convert {1,-1} into {0}
n_op = abs(n_op);
n_op = std::abs(n_op);
pool = Rcpp::List(l_pool);
cmp = 1;
}
Expand Down

0 comments on commit ee98de6

Please sign in to comment.