Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CRAN v 1.19.0
  • Loading branch information
gvegayon committed Oct 30, 2017
1 parent c84aa22 commit f01dd41
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,7 +1,6 @@
dist: trusty
language: r
sudo: false
cache: packages

r:
- release
Expand Down
4 changes: 2 additions & 2 deletions R/RcppExports.R
Expand Up @@ -300,8 +300,8 @@ moran_cpp <- function(x, w) {
.Call(`_netdiffuseR_moran_cpp`, x, w)
}

struct_equiv_cpp <- function(graph, v = 1.0, unscaled = FALSE, inv = FALSE, invrep = 0.0) {
.Call(`_netdiffuseR_struct_equiv_cpp`, graph, v, unscaled, inv, invrep)
struct_equiv_cpp <- function(graph, v = 1.0) {
.Call(`_netdiffuseR_struct_equiv_cpp`, graph, v)
}

matrix_compareCpp <- function(A, B, fun) {
Expand Down
6 changes: 3 additions & 3 deletions cran-comments.md
@@ -1,8 +1,8 @@
## Test environments

* Ubuntu 14.04 LTS (on travis-ci), R-rel 3.4.1 (2017-01-27), and R-rel 3.3.3 (2017-01-27).
* Windows Server 2012 R2 x64 (on AppVeyor), R version 3.4.2 (2017-09-28), R version 3.4.2 (2017-09-28).
* OS X El Capitan 10.11.6 (on travis-ci), R version 3.4.1 (2017-06-30).
* Ubuntu 14.04.5 LTS 64-bit (on travis-ci), R 3.4.2, and R 3.3.3.
* Windows Server 2012 R2 (on AppVeyor), R version 3.4.2 (64-bit), R version 3.3.3 (32-bit).
* OS X El Capitan 10.11.6 (on travis-ci), R version 3.4.2, and R 3.3.3.

## R CMD check results

Expand Down
11 changes: 4 additions & 7 deletions src/RcppExports.cpp
Expand Up @@ -452,17 +452,14 @@ BEGIN_RCPP
END_RCPP
}
// struct_equiv_cpp
List struct_equiv_cpp(const arma::sp_mat& graph, double v, bool unscaled, bool inv, double invrep);
RcppExport SEXP _netdiffuseR_struct_equiv_cpp(SEXP graphSEXP, SEXP vSEXP, SEXP unscaledSEXP, SEXP invSEXP, SEXP invrepSEXP) {
List struct_equiv_cpp(const arma::sp_mat& graph, double v);
RcppExport SEXP _netdiffuseR_struct_equiv_cpp(SEXP graphSEXP, SEXP vSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const arma::sp_mat& >::type graph(graphSEXP);
Rcpp::traits::input_parameter< double >::type v(vSEXP);
Rcpp::traits::input_parameter< bool >::type unscaled(unscaledSEXP);
Rcpp::traits::input_parameter< bool >::type inv(invSEXP);
Rcpp::traits::input_parameter< double >::type invrep(invrepSEXP);
rcpp_result_gen = Rcpp::wrap(struct_equiv_cpp(graph, v, unscaled, inv, invrep));
rcpp_result_gen = Rcpp::wrap(struct_equiv_cpp(graph, v));
return rcpp_result_gen;
END_RCPP
}
Expand Down Expand Up @@ -552,7 +549,7 @@ static const R_CallMethodDef CallEntries[] = {
{"_netdiffuseR_vertex_mahalanobis_dist_cpp", (DL_FUNC) &_netdiffuseR_vertex_mahalanobis_dist_cpp, 3},
{"_netdiffuseR_vertex_covariate_compare", (DL_FUNC) &_netdiffuseR_vertex_covariate_compare, 3},
{"_netdiffuseR_moran_cpp", (DL_FUNC) &_netdiffuseR_moran_cpp, 2},
{"_netdiffuseR_struct_equiv_cpp", (DL_FUNC) &_netdiffuseR_struct_equiv_cpp, 5},
{"_netdiffuseR_struct_equiv_cpp", (DL_FUNC) &_netdiffuseR_struct_equiv_cpp, 2},
{"_netdiffuseR_matrix_compareCpp", (DL_FUNC) &_netdiffuseR_matrix_compareCpp, 3},
{"_netdiffuseR_struct_test_mean", (DL_FUNC) &_netdiffuseR_struct_test_mean, 3},
{"_netdiffuseR_struct_test_var", (DL_FUNC) &_netdiffuseR_struct_test_var, 3},
Expand Down
17 changes: 2 additions & 15 deletions src/stats.cpp
Expand Up @@ -190,9 +190,8 @@ List moran_cpp(const arma::colvec & x, const arma::sp_mat & w) {
// [[Rcpp::export]]
List struct_equiv_cpp(
const arma::sp_mat & graph, // Must be a geodesic distances graph
double v = 1.0,
bool unscaled = false,
bool inv = false, double invrep = 0.0) {
double v = 1.0
) {

int n = graph.n_cols;
if (graph.n_cols != graph.n_rows) stop("-graph- is not square.");
Expand All @@ -217,16 +216,10 @@ List struct_equiv_cpp(
// Adding up the results
d.at(i,j) = pow(pow(graph.at(i,j) - graph.at(j,i), 2.0) + sumik + sumki, 0.5 );

// // If only inverse required
// if (inv && unscaled) d.at(i,j) = 1.0/(d.at(i,j) + 1e-15);

d.at(j,i) = d.at(i,j);
}
}

// // If only distance must be computed
// if (unscaled) return List::create(_["SE"]=d, _["d"]=d, _["gdist"]=graph);

// Computing distances
NumericMatrix SE(n,n);

Expand All @@ -251,12 +244,6 @@ List struct_equiv_cpp(
SE.at(i,j) = pow(dmax[i] - d.at(j,i), v)/(sumdmaxd + 1e-15);
}

// // If inverse required
// if (inv) {
// for(int j=0;j<n;j++) {
// SE.at(i,j) = 1/(SE.at(i,j) + 1e-10);
// }
// }
}

return List::create(_["SE"]=SE, _["d"]=d, _["gdist"]=graph);
Expand Down

0 comments on commit f01dd41

Please sign in to comment.