From ee3cfc34d1e84a4a01446953defa879d004b95d5 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Mon, 9 Jul 2018 21:03:30 +0200 Subject: [PATCH] Changes for R package on CRAN --- pkg/LICENSE | 22 ++-------------------- pkg/R/A_NAMESPACE.R | 2 +- pkg/src/registerDynamicSymbol.c | 10 ++++++++++ pkg/tests/testthat/test-optimParams.R | 2 +- 4 files changed, 14 insertions(+), 22 deletions(-) create mode 100644 pkg/src/registerDynamicSymbol.c diff --git a/pkg/LICENSE b/pkg/LICENSE index 5d50df5..6a8f2de 100644 --- a/pkg/LICENSE +++ b/pkg/LICENSE @@ -1,20 +1,2 @@ -Copyright (c) 2016-2017, Mor-Absa Loum ; 2017, Benjamin Auder - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +YEAR: 2016-2018 +COPYRIGHT HOLDER: Mor-Absa Loum, Benjamin Auder diff --git a/pkg/R/A_NAMESPACE.R b/pkg/R/A_NAMESPACE.R index 0a45138..ab9ea34 100644 --- a/pkg/R/A_NAMESPACE.R +++ b/pkg/R/A_NAMESPACE.R @@ -1,6 +1,6 @@ #' @include utils.R #' -#' @useDynLib morpheus +#' @useDynLib morpheus, .registration = TRUE #' #' @importFrom jointDiag ajd #' @importFrom stats rbinom rmultinom rnorm pnorm runif integrate sd diff --git a/pkg/src/registerDynamicSymbol.c b/pkg/src/registerDynamicSymbol.c new file mode 100644 index 0000000..b371922 --- /dev/null +++ b/pkg/src/registerDynamicSymbol.c @@ -0,0 +1,10 @@ +// RegisteringDynamic Symbols + +#include <R.h> +#include <Rinternals.h> +#include <R_ext/Rdynload.h> + +void R_init_morpheus(DllInfo* info) { + R_registerRoutines(info, NULL, NULL, NULL, NULL); + R_useDynamicSymbols(info, TRUE); +} diff --git a/pkg/tests/testthat/test-optimParams.R b/pkg/tests/testthat/test-optimParams.R index 8d0e7b3..6864804 100644 --- a/pkg/tests/testthat/test-optimParams.R +++ b/pkg/tests/testthat/test-optimParams.R @@ -50,7 +50,7 @@ naive_f = function(link, M1,M2,M3, p,β,b) test_that("naive computation provides the same result as vectorized computations", { h <- 1e-7 #for finite-difference tests - tol <- .25 * sqrt(h) #about 7.9 e-5 + tol <- 1e-3 #large tolerance, necessary in some cases... (generally 1e-6 is OK) for (dK in list( c(2,2), c(5,3))) { d = dK[1] -- 2.44.0