Skip to content

Commit

Permalink
fix CRAN STRICT_R_HEADERS
Browse files Browse the repository at this point in the history
  • Loading branch information
rsbivand committed Aug 19, 2024
1 parent 2b349a3 commit 93683ed
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 65 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spatialreg
Version: 1.3-5
Date: 2024-08-04
Date: 2024-08-19
Title: Spatial Regression Analysis
Encoding: UTF-8
Authors@R: c(person("Roger", "Bivand", role = c("cre", "aut"), email = "[email protected]", comment=c(ORCID="0000-0003-2392-6140")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Version 1.3-5 (development)

* adding missing man page anchors

* conforming with STRICT_R_HEADERS=1

* Condition on forthcoming `tmap` 4

* #52 subgraph updates
Expand Down
2 changes: 1 addition & 1 deletion man/SpatialFiltering.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SpatialFiltering(formula, lagformula=NULL, data=list(), na.action=na.fail,
\references{Tiefelsdorf M, Griffith DA. (2007) Semiparametric Filtering of Spatial Autocorrelation: The Eigenvector Approach. Environment and Planning A, 39 (5) 1193 - 1221.}
\author{Yongwan Chun, Michael Tiefelsdorf, Roger Bivand}

\seealso{\code{\link[stats]{lm}}, \code{\link[base]{eigen}}, \code{\link{nb2listw}}, \code{\link{listw2U}}}
\seealso{\code{\link[stats]{lm}}, \code{\link[base]{eigen}}, \code{\link[spdep]{nb2listw}}, \code{\link[spdep]{listw2U}}}
\examples{
require("sf", quietly=TRUE)
columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1], quiet=TRUE)
Expand Down
2 changes: 1 addition & 1 deletion man/impacts.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Roger Bivand, Gianfranco Piras (2015). Comparing Implementations of Estimation M
\seealso{
\code{\link{trW}}, \code{\link{lagsarlm}}, \code{\link{nb2listw}}, \code{\link[MASS]{mvrnorm}}, \code{\link[coda]{plot.mcmc}}, \code{\link[coda]{summary.mcmc}}, \code{\link[coda]{HPDinterval}}
\code{\link{trW}}, \code{\link{lagsarlm}}, \code{\link[spdep]{nb2listw}}, \code{\link[MASS]{mvrnorm}}, \code{\link[coda]{plot.mcmc}}, \code{\link[coda]{summary.mcmc}}, \code{\link[coda]{HPDinterval}}
}
\examples{
require("sf", quietly=TRUE)
Expand Down
4 changes: 2 additions & 2 deletions man/invIrM.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ invIrW(x, rho, method="solve", feasible=NULL)
\item{style}{\code{style} can take values W, B, C, and S}
\item{method}{default \code{solve}, can also take value \code{chol}}
\item{feasible}{if NULL, the given value of rho is checked to see if it lies within its feasible range, if TRUE, the test is not conducted}
\item{x}{either a \code{listw} object from for example \code{nb2listw}, or a square spatial weights matrix, optionally a sparse matrix}
\item{x}{either a \code{listw} object from for example \code{nb2listw} or a square spatial weights matrix, optionally a sparse matrix}
}
\details{
The \code{invIrW} function generates the full weights matrix V, checks that rho lies in its feasible range between 1/min(eigen(V)) and 1/max(eigen(V)), and returns the nxn inverted matrix \deqn{(I - \rho V)^{-1}}. With method=\dQuote{chol} (only for a listw object), Cholesky decomposition is used, thanks to contributed code by Markus Reder and Werner Mueller.
Expand All @@ -38,7 +38,7 @@ Before version 0.6-10, \code{powerWeights} only worked correctly for positive rh
\references{Tiefelsdorf, M., Griffith, D. A., Boots, B. 1999 A variance-stabilizing coding scheme for spatial link matrices, Environment and Planning A, 31, pp. 165-180; Tiefelsdorf, M. 2000 Modelling spatial processes, Lecture notes in earth sciences, Springer, p. 76; Haining, R. 1990 Spatial data analysis in the social and environmental sciences, Cambridge University Press, p. 117; Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 152; Reder, M. and Mueller, W. (2007) An Improvement of the invIrM Routine of the Geostatistical R-package spdep by Cholesky Inversion, Statistical Projects, LV No: 238.205, SS 2006, Department of Applied Statistics, Johannes Kepler University, Linz}
\author{Roger Bivand \email{Roger.Bivand@nhh.no}}

\seealso{\code{\link{nb2listw}}}
\seealso{\code{\link[spdep]{nb2listw}}}

\examples{
library(spdep)
Expand Down
2 changes: 1 addition & 1 deletion man/trW.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ A numeric vector of \code{m} traces, with \dQuote{timings} and \dQuote{type} att


\seealso{
\code{\link{as_dgRMatrix_listw}}, \code{\link{nb2listw}}
\code{\link{as_dgRMatrix_listw}}, \code{\link[spdep]{nb2listw}}
}
\examples{
require("sf", quietly=TRUE)
Expand Down
118 changes: 59 additions & 59 deletions src/ml_sse.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2010 by Roger S. Bivand. */
/* Copyright 2010-24 by Roger S. Bivand. */

#include "spatialreg.h"

Expand Down Expand Up @@ -46,7 +46,7 @@ SEXP opt_error_init(void) { /* -Wstrict-prototypes */
OPT_ERROR_SSE *pt;
SEXP ptr;

pt = Calloc(1, OPT_ERROR_SSE);
pt = R_Calloc(1, OPT_ERROR_SSE);
pt->set = FALSE;

PROTECT(ptr = R_MakeExternalPtr(pt, R_NilValue, R_NilValue));
Expand Down Expand Up @@ -76,18 +76,18 @@ void opt_error_set(SEXP env) {
PROTECT(wy = findVarInFrame(env, install("wy"))); pc++;
PROTECT(WX = findVarInFrame(env, install("WX"))); pc++;

pt->y = Calloc(n, double);
pt->x = Calloc(np, double);
pt->yl = Calloc(n, double);
pt->wy1 = Calloc(n, double);
pt->xlq = Calloc(np, double);
pt->wx1 = Calloc(np, double);
pt->qy = Calloc(np, double);
pt->xlqyl = Calloc(p, double);
pt->jpvt = Calloc(p, int);
pt->work = Calloc(p*2, double);
/* pt->work = Calloc(p, double); */
pt->qraux = Calloc(p, double);
pt->y = R_Calloc(n, double);
pt->x = R_Calloc(np, double);
pt->yl = R_Calloc(n, double);
pt->wy1 = R_Calloc(n, double);
pt->xlq = R_Calloc(np, double);
pt->wx1 = R_Calloc(np, double);
pt->qy = R_Calloc(np, double);
pt->xlqyl = R_Calloc(p, double);
pt->jpvt = R_Calloc(p, int);
pt->work = R_Calloc(p*2, double);
/* pt->work = R_Calloc(p, double); */
pt->qraux = R_Calloc(p, double);

for (i=0; i<n; i++) {
pt->y[i] = NUMERIC_POINTER(y)[i];
Expand All @@ -110,19 +110,19 @@ SEXP opt_error_free(SEXP ptr) {

pt = (OPT_ERROR_SSE *) R_ExternalPtrAddr(ptr);

Free(pt->qraux);
Free(pt->work);
Free(pt->jpvt);
Free(pt->xlqyl);
Free(pt->qy);
Free(pt->wx1);
Free(pt->xlq);
Free(pt->wy1);
Free(pt->yl);
Free(pt->x);
Free(pt->y);

Free(pt);
R_Free(pt->qraux);
R_Free(pt->work);
R_Free(pt->jpvt);
R_Free(pt->xlqyl);
R_Free(pt->qy);
R_Free(pt->wx1);
R_Free(pt->xlq);
R_Free(pt->wy1);
R_Free(pt->yl);
R_Free(pt->x);
R_Free(pt->y);

R_Free(pt);
R_ClearExternalPtr(ptr);
return(R_NilValue);
}
Expand All @@ -132,7 +132,7 @@ SEXP hess_error_init(void) { /* -Wstrict-prototypes */
HESS_ERROR_SSE *pt;
SEXP ptr;

pt = Calloc(1, HESS_ERROR_SSE);
pt = R_Calloc(1, HESS_ERROR_SSE);
pt->set = FALSE;

PROTECT(ptr = R_MakeExternalPtr(pt, R_NilValue, R_NilValue));
Expand Down Expand Up @@ -162,14 +162,14 @@ void hess_error_set(SEXP env) {
PROTECT(wy = findVarInFrame(env, install("wy"))); pc++;
PROTECT(WX = findVarInFrame(env, install("WX"))); pc++;

pt->y = Calloc(n, double);
pt->x = Calloc(np, double);
pt->yl = Calloc(n, double);
pt->wy1 = Calloc(n, double);
pt->xl = Calloc(np, double);
pt->wx1 = Calloc(np, double);
pt->beta1 = Calloc(p, double);
pt->xlb = Calloc(n, double);
pt->y = R_Calloc(n, double);
pt->x = R_Calloc(np, double);
pt->yl = R_Calloc(n, double);
pt->wy1 = R_Calloc(n, double);
pt->xl = R_Calloc(np, double);
pt->wx1 = R_Calloc(np, double);
pt->beta1 = R_Calloc(p, double);
pt->xlb = R_Calloc(n, double);

for (i=0; i<n; i++) {
pt->y[i] = NUMERIC_POINTER(y)[i];
Expand All @@ -192,16 +192,16 @@ SEXP hess_error_free(SEXP ptr) {

pt = (HESS_ERROR_SSE *) R_ExternalPtrAddr(ptr);

Free(pt->xlb);
Free(pt->beta1);
Free(pt->wx1);
Free(pt->xl);
Free(pt->wy1);
Free(pt->yl);
Free(pt->x);
Free(pt->y);
R_Free(pt->xlb);
R_Free(pt->beta1);
R_Free(pt->wx1);
R_Free(pt->xl);
R_Free(pt->wy1);
R_Free(pt->yl);
R_Free(pt->x);
R_Free(pt->y);

Free(pt);
R_Free(pt);
R_ClearExternalPtr(ptr);
return(R_NilValue);
}
Expand All @@ -211,7 +211,7 @@ SEXP hess_lag_init(void) { /* -Wstrict-prototypes */
HESS_LAG_SSE *pt;
SEXP ptr;

pt = Calloc(1, HESS_LAG_SSE);
pt = R_Calloc(1, HESS_LAG_SSE);
pt->set = FALSE;

PROTECT(ptr = R_MakeExternalPtr(pt, R_NilValue, R_NilValue));
Expand Down Expand Up @@ -240,12 +240,12 @@ void hess_lag_set(SEXP env) {
PROTECT(x = findVarInFrame(env, install("x"))); pc++;
PROTECT(wy = findVarInFrame(env, install("wy"))); pc++;

pt->y = Calloc(n, double);
pt->x = Calloc(np, double);
pt->yl = Calloc(n, double);
pt->wy1 = Calloc(n, double);
pt->beta1 = Calloc(p, double);
pt->xb = Calloc(n, double);
pt->y = R_Calloc(n, double);
pt->x = R_Calloc(np, double);
pt->yl = R_Calloc(n, double);
pt->wy1 = R_Calloc(n, double);
pt->beta1 = R_Calloc(p, double);
pt->xb = R_Calloc(n, double);

for (i=0; i<n; i++) {
pt->y[i] = NUMERIC_POINTER(y)[i];
Expand All @@ -265,14 +265,14 @@ SEXP hess_lag_free(SEXP ptr) {

pt = (HESS_LAG_SSE *) R_ExternalPtrAddr(ptr);

Free(pt->xb);
Free(pt->beta1);
Free(pt->wy1);
Free(pt->yl);
Free(pt->x);
Free(pt->y);
R_Free(pt->xb);
R_Free(pt->beta1);
R_Free(pt->wy1);
R_Free(pt->yl);
R_Free(pt->x);
R_Free(pt->y);

Free(pt);
R_Free(pt);
R_ClearExternalPtr(ptr);
return(R_NilValue);
}
Expand Down

0 comments on commit 93683ed

Please sign in to comment.