Skip to content

Commit

Permalink
fixed solaris error
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Feb 4, 2020
1 parent 5853af9 commit 35e0ae4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: signnet
Title: Methods to Analyse Signed Networks
Version: 0.5.0
Version: 0.5.1
Authors@R:
person(given = "David",
family = "Schoch",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# signnet 0.5.1

* fixed C++ issue for circular arc graphs
* fixed failing eigen centrality test

# signnet 0.5.0

* added vignettes and tests
Expand Down
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Update from 0.5.0 to 0.5.1

This update fixes an issue on solaris (as requested by B. Ripley) :
`circArc.cpp:7:22: error: call of overloaded ‘acos(int)’ is ambiguous`

# Resubmission 3 of initial submission

> \dontrun{} should only be used if the example really cannot be executed
Expand Down
2 changes: 1 addition & 1 deletion src/circArc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using namespace Rcpp;

// [[Rcpp::export]]
double arcDist(NumericVector x,NumericVector y, double r) {
double pi = acos(-1);
static const double pi = 3.14159265;
double c = sqrt((x[0]-y[0])*(x[0]-y[0])+(x[1]-y[1])*(x[1]-y[1]));
double theta = acos((2*r*r-c*c)/(2*r*r));
return 2*pi*r*theta/(2*pi);
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-centrality_indices.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ test_that("evcent works",{
g <- igraph::graph.full(5)
igraph::E(g)$sign <- 1
igraph::E(g)$sign[1] <- -1
ev <- round(eigen_centrality_signed(g, scale = TRUE),8)
ev <- abs(round(eigen_centrality_signed(g, scale = TRUE),8))
ev_true <- c(0.68614066, 0.68614066, 1, 1, 1)
expect_equal(ev,ev_true)
expect_equal(stats::cor(ev,ev_true),1)
})

test_that("evcent no scale works",{
g <- igraph::graph.full(5)
igraph::E(g)$sign <- 1
igraph::E(g)$sign[1] <- -1
ev <- round(eigen_centrality_signed(g, scale = FALSE),8)
ev <- abs(round(eigen_centrality_signed(g, scale = FALSE),8))
ev_true <- c(0.34560347, 0.34560347, 0.50369186, 0.50369186, 0.50369186)
expect_equal(ev,ev_true)
expect_equal(stats::cor(ev,ev_true),1)
})

0 comments on commit 35e0ae4

Please sign in to comment.