From f27a2113fa7a471d9e54a2562e02550811e5cfe3 Mon Sep 17 00:00:00 2001 From: randef1ned <46381867+randef1ned@users.noreply.github.com> Date: Sun, 14 Jan 2024 02:19:10 +0800 Subject: [PATCH] Update docs and bug fixes --- .github/workflows/lint.yaml | 32 ++++++++++++++++++++++++++++++++ .gitignore | 1 - DESCRIPTION | 7 +++---- R/mat_util.R | 1 + R/mrw.R | 2 +- man/random.walk.Rd | 2 +- src/Makevars | 14 ++++++++++++++ 7 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/lint.yaml create mode 100644 src/Makevars diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..f4c4ef2 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,32 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: lint + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::lintr, local::. + needs: lint + + - name: Lint + run: lintr::lint_package() + shell: Rscript {0} + env: + LINTR_ERROR_ON_LINT: true diff --git a/.gitignore b/.gitignore index c95bebc..4f392af 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ src/tests/netreg_benchmarks* src/tests/netreg_tests* src/test src/netReg.dSYM/* -src/Makevars src/stamp-h1 src/**/*.o src/**/*.a diff --git a/DESCRIPTION b/DESCRIPTION index e2c167e..8297370 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,10 +3,9 @@ Type: Package Title: Network Diffusion Algorithms Version: 0.2.1 Date: 2018-04-20 -Authors@R: c(person("Simon", "Dirmeier", +Authors@R: person("Simon", "Dirmeier", email = "simon.dirmeier@gmx.de", - role = c("aut")), - person("Yinchun", "Su", email = "me@yinchun.su", role = c("ctb", "cre"))) + role = c("aut", "cre")) Maintainer: Simon Dirmeier Description: Implementation of network diffusion algorithms such as heat diffusion or Markov random walks. Network diffusion algorithms generally @@ -18,7 +17,7 @@ Description: Implementation of network diffusion algorithms such as URL: https://github.com/randef1ned/diffusr BugReports: https://github.com/randef1ned/diffusr/issues License: GPL (>=3) -Depends: R (>= 3.4) +Depends: R (>= 4.0) LazyData: TRUE LinkingTo: Rcpp, RcppEigen biocViews: sparseMatrixStats diff --git a/R/mat_util.R b/R/mat_util.R index 54aff7f..e45608f 100644 --- a/R/mat_util.R +++ b/R/mat_util.R @@ -159,4 +159,5 @@ colSums3 <- function(mat, is.sparse = NULL) { } else { sums <- colSums2(mat) } + return(sums) } diff --git a/R/mrw.R b/R/mrw.R index d539716..06b4197 100644 --- a/R/mrw.R +++ b/R/mrw.R @@ -54,7 +54,7 @@ #' nodes, such that the random walk gets not biased to nodes with high #' degree. In that case the original input matrix will be normalized as: #' \deqn{ P(j | i) = \dfrac{1}{\text{degree}(i)} \times -#' \min \left(1, \dfrac{\text{degree}(j)}{\text{degree}(i)}\right)} +#' \min \left(1, \dfrac{\text{degree}(i)}{\text{degree}(j)}\right)} #' \emph{Note that this will not consider edge weights.} #' #' @param allow.ergodic Allow multiple components in a graph. diff --git a/man/random.walk.Rd b/man/random.walk.Rd index 4220e4c..f8689c2 100644 --- a/man/random.walk.Rd +++ b/man/random.walk.Rd @@ -45,7 +45,7 @@ computed solving the analytical solution or rather iteratively} nodes, such that the random walk gets not biased to nodes with high degree. In that case the original input matrix will be normalized as: \deqn{ P(j | i) = \dfrac{1}{\text{degree}(i)} \times - \min \left(1, \dfrac{\text{degree}(j)}{\text{degree}(i)}\right)} + \min \left(1, \dfrac{\text{degree}(i)}{\text{degree}(j)}\right)} \emph{Note that this will not consider edge weights.}} \item{allow.ergodic}{Allow multiple components in a graph.} diff --git a/src/Makevars b/src/Makevars new file mode 100644 index 0000000..aecc367 --- /dev/null +++ b/src/Makevars @@ -0,0 +1,14 @@ +## With Rcpp 0.11.0 and later, we no longer need to set PKG_LIBS as there is +## no user-facing library. The include path to headers is already set by R. +PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) + +## With R 3.1.0 or later, you can uncomment the following line to tell R to +## enable compilation with C++11 (or even C++14) where available +## R 4.0.0 made C++11 the default, R 4.1.0 switched to C++14, R 4.3.0 to C++17 +## _In general_ we should no longer need to set a standard as any recent R +## installation will do the right thing. Should you need it, uncomment it and +## set the appropriate value, possibly CXX17. +CXX_STD = CXX17 + +PKG_CPPFLAGS = -w -I../inst/include/ -I/opt/intel/oneapi/mkl/latest/include/ -I/usr/include/mkl -Wno-ignored-attributes -DMKL_ILP64 -m64 -DRCPP_USE_UNWIND_PROTECT -fopenmp -O3 -march=native -fno-math-errno -mfma +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DEIGEN_INITIALIZE_MATRICES_BY_ZERO -DEIGEN_NO_DEBUG -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl