Skip to content

Commit 1d03ca9

Browse files
committed
Removed the cache.sp term option: shared partner cache is always active.
fixes statent/ergm#529
1 parent 581f93a commit 1d03ca9

16 files changed

+331
-633
lines changed

R/InitErgmTerm.R

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -934,13 +934,12 @@ InitErgmTerm.b1degree <- function(nw, arglist, ..., version=packageVersion("ergm
934934
#'
935935
#' @param d a vector of distinct integers.
936936
#'
937-
#' @template ergmTerm-cache-sp
938937
#' @template ergmTerm-general
939938
#'
940939
#' @concept bipartite
941940
#' @concept undirected
942-
InitErgmTerm.b1dsp <- function(nw, arglist, cache.sp=TRUE, ...){
943-
.d_sp_impl("b1", nw, arglist, cache.sp,
941+
InitErgmTerm.b1dsp <- function(nw, arglist, ...){
942+
.d_sp_impl("b1", nw, arglist,
944943
function(d, nw, ...) replace(numeric(length(d)), d==0, (nw%n%"bipartite")*(nw%n%"bipartite"-1)/2),
945944
...)
946945
}
@@ -1522,13 +1521,12 @@ InitErgmTerm.b2degree <- function(nw, arglist, ..., version=packageVersion("ergm
15221521
#'
15231522
#' @param d a vector of distinct integers
15241523
#'
1525-
#' @template ergmTerm-cache-sp
15261524
#' @template ergmTerm-general
15271525
#'
15281526
#' @concept bipartite
15291527
#' @concept undirected
1530-
InitErgmTerm.b2dsp <- function(nw, arglist, cache.sp=TRUE, ...){
1531-
.d_sp_impl("b2", nw, arglist, cache.sp,
1528+
InitErgmTerm.b2dsp <- function(nw, arglist, ...){
1529+
.d_sp_impl("b2", nw, arglist,
15321530
function(d, nw, ...) replace(numeric(length(d)), d==0, (network.size(nw)-nw%n%"bipartite")*(network.size(nw)-nw%n%"bipartite"-1)/2),
15331531
...)
15341532
}
@@ -2605,14 +2603,13 @@ InitErgmTerm.gwb1degree<-function(nw, arglist, gw.cutoff=30, ..., version=packag
26052603
#' @templateVar underlying b1dsp
26062604
#' @template ergmTerm-gw-cutoff
26072605
#'
2608-
#' @template ergmTerm-cache-sp
26092606
#' @template ergmTerm-general
26102607
#'
26112608
#' @concept bipartite
26122609
#' @concept undirected
26132610
#' @concept curved
2614-
InitErgmTerm.gwb1dsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
2615-
.dgw_sp_impl("b1", nw, arglist, cache.sp, gw.cutoff=gw.cutoff, ...)
2611+
InitErgmTerm.gwb1dsp<-function(nw, arglist, gw.cutoff=30, ...) {
2612+
.dgw_sp_impl("b1", nw, arglist, gw.cutoff=gw.cutoff, ...)
26162613
}
26172614

26182615
################################################################################
@@ -2661,14 +2658,13 @@ InitErgmTerm.gwb2degree<-function(nw, arglist, gw.cutoff=30, ..., version=packag
26612658
#' @templateVar underlying b2dsp
26622659
#' @template ergmTerm-gw-cutoff
26632660
#'
2664-
#' @template ergmTerm-cache-sp
26652661
#' @template ergmTerm-general
26662662
#'
26672663
#' @concept bipartite
26682664
#' @concept undirected
26692665
#' @concept curved
2670-
InitErgmTerm.gwb2dsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
2671-
.dgw_sp_impl("b2", nw, arglist, cache.sp, gw.cutoff=gw.cutoff, ...)
2666+
InitErgmTerm.gwb2dsp<-function(nw, arglist, gw.cutoff=30, ...) {
2667+
.dgw_sp_impl("b2", nw, arglist, gw.cutoff=gw.cutoff, ...)
26722668
}
26732669

26742670
################################################################################

R/InitErgmTerm.dgw_sp.R

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SPTYPE_CODE <- c(UTP = 0L, OTP = 1L, ITP = 2L, RTP = 3L, OSP = 4L, ISP = 5L)
5252
type
5353
}
5454

55-
.d_sp_impl <- function(sp, nw, arglist, cache.sp, emptynwstats = function(...)NULL, ...){
55+
.d_sp_impl <- function(sp, nw, arglist, emptynwstats = function(...)NULL, ...){
5656
if(sp %in% c("b1","b2")){
5757
bip <- sp
5858
sp <- "d"
@@ -74,10 +74,10 @@ SPTYPE_CODE <- c(UTP = 0L, OTP = 1L, ITP = 2L, RTP = 3L, OSP = 4L, ISP = 5L)
7474

7575
list(name=if(nchar(bip)) "ddspbwrap" else paste0("d",utermname), coef.names=paste(conam,d,sep=""), iinputs=c(SPTYPE_CODE[type],d),
7676
minval=0, emptynwstats=emptynwstats(nw=nw, a=a, d=d, type=type),
77-
auxiliaries=if(cache.sp) .spcache.aux(type) else NULL)
77+
auxiliaries=.spcache.aux(type))
7878
}
7979

80-
.dgw_sp_impl <- function(sp, nw, arglist, cache.sp, gw.cutoff, ...){
80+
.dgw_sp_impl <- function(sp, nw, arglist, gw.cutoff, ...){
8181
if(sp %in% c("b1","b2")){
8282
bip <- sp
8383
sp <- "d"
@@ -111,10 +111,10 @@ SPTYPE_CODE <- c(UTP = 0L, OTP = 1L, ITP = 2L, RTP = 3L, OSP = 4L, ISP = 5L)
111111
c(list(name=if(nchar(bip)) "ddspdistbwrap" else paste0("d",sp,"spdist"),
112112
coef.names=if(type=="UTP" || nchar(bip)) paste0(bip,sp,"sp#",d) else paste0(bip,sp,"sp.",type,"#",d),
113113
cutoff.message = ergm_cutoff_message(maxsp, termname, sprintf("number of %ss on some %s", SPTYPE_DESC[type], c(e="edge", d="dyad", n="nonedge")[sp]), "cutoff", "gw.cutoff"),
114-
iinputs=SPTYPE_CODE[type], params=params, auxiliaries=if(cache.sp) .spcache.aux(type) else NULL), GWDECAY)
114+
iinputs=SPTYPE_CODE[type], params=params, auxiliaries=.spcache.aux(type)), GWDECAY)
115115
}else{
116116
coef.names <- paste(statname,"fixed",decay,sep=".")
117-
list(name=if(nchar(bip)) "dgwdspbwrap" else termname, coef.names=coef.names, inputs=decay, iinputs=SPTYPE_CODE[type], auxiliaries=if(cache.sp) .spcache.aux(type) else NULL)
117+
list(name=if(nchar(bip)) "dgwdspbwrap" else termname, coef.names=coef.names, inputs=decay, iinputs=SPTYPE_CODE[type], auxiliaries=.spcache.aux(type))
118118
}
119119
}
120120

@@ -159,7 +159,6 @@ SPTYPE_CODE <- c(UTP = 0L, OTP = 1L, ITP = 2L, RTP = 3L, OSP = 4L, ISP = 5L)
159159
#' @param d a vector of distinct integers
160160
#' @template ergmTerm-sp-type
161161
#'
162-
#' @template ergmTerm-cache-sp
163162
#' @template ergmTerm-general
164163
#'
165164
#' @template ergmTerm-directed
@@ -168,8 +167,8 @@ SPTYPE_CODE <- c(UTP = 0L, OTP = 1L, ITP = 2L, RTP = 3L, OSP = 4L, ISP = 5L)
168167
#'
169168
#' @concept directed
170169
#' @aliases desp-ergmTerm
171-
InitErgmTerm.desp<-function(nw, arglist, cache.sp=TRUE, ...) {
172-
.d_sp_impl("e", nw, arglist, cache.sp, ...)
170+
InitErgmTerm.desp<-function(nw, arglist, ...) {
171+
.d_sp_impl("e", nw, arglist, ...)
173172
}
174173

175174

@@ -204,7 +203,6 @@ InitErgmTerm.desp<-function(nw, arglist, cache.sp=TRUE, ...) {
204203
#' @template ergmTerm-gw-cutoff
205204
#' @template ergmTerm-sp-type
206205
#'
207-
#' @template ergmTerm-cache-sp
208206
#' @template ergmTerm-general
209207
#'
210208
#' @template ergmTerm-sp-types
@@ -213,8 +211,8 @@ InitErgmTerm.desp<-function(nw, arglist, cache.sp=TRUE, ...) {
213211
#'
214212
#' @concept directed
215213
#' @aliases dgwesp-ergmTerm
216-
InitErgmTerm.dgwesp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
217-
.dgw_sp_impl("e", nw, arglist, cache.sp, gw.cutoff, ...)
214+
InitErgmTerm.dgwesp<-function(nw, arglist, gw.cutoff=30, ...) {
215+
.dgw_sp_impl("e", nw, arglist, gw.cutoff, ...)
218216
}
219217

220218

@@ -243,7 +241,6 @@ InitErgmTerm.dgwesp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
243241
#' @param d a vector of distinct integers
244242
#' @template ergmTerm-sp-type
245243
#'
246-
#' @template ergmTerm-cache-sp
247244
#' @template ergmTerm-general
248245
#'
249246
#' @template ergmTerm-directed
@@ -252,8 +249,8 @@ InitErgmTerm.dgwesp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
252249
#'
253250
#' @concept directed
254251
#' @aliases ddsp-ergmTerm
255-
InitErgmTerm.ddsp<-function(nw, arglist, cache.sp=TRUE, ...) {
256-
.d_sp_impl("d", nw, arglist, cache.sp, emptynwstats=.dsp_emptynwstats, ...)
252+
InitErgmTerm.ddsp<-function(nw, arglist, ...) {
253+
.d_sp_impl("d", nw, arglist, emptynwstats=.dsp_emptynwstats, ...)
257254
}
258255

259256

@@ -273,7 +270,6 @@ InitErgmTerm.ddsp<-function(nw, arglist, cache.sp=TRUE, ...) {
273270
#' @template ergmTerm-gw-cutoff
274271
#' @template ergmTerm-sp-type
275272
#'
276-
#' @template ergmTerm-cache-sp
277273
#' @template ergmTerm-general
278274
#'
279275
#' @template ergmTerm-sp-types
@@ -284,8 +280,8 @@ InitErgmTerm.ddsp<-function(nw, arglist, cache.sp=TRUE, ...) {
284280
#'
285281
#' @concept directed
286282
#' @aliases dgwdsp-ergmTerm
287-
InitErgmTerm.dgwdsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
288-
.dgw_sp_impl("d", nw, arglist, cache.sp, gw.cutoff, ...)
283+
InitErgmTerm.dgwdsp<-function(nw, arglist, gw.cutoff=30, ...) {
284+
.dgw_sp_impl("d", nw, arglist, gw.cutoff, ...)
289285
}
290286

291287

@@ -317,7 +313,6 @@ InitErgmTerm.dgwdsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
317313
#' @param d a vector of distinct integers
318314
#' @template ergmTerm-sp-type
319315
#'
320-
#' @template ergmTerm-cache-sp
321316
#' @template ergmTerm-general
322317
#'
323318
#' @template ergmTerm-directed
@@ -326,8 +321,8 @@ InitErgmTerm.dgwdsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
326321
#'
327322
#' @concept directed
328323
#' @aliases dnsp-ergmTerm
329-
InitErgmTerm.dnsp<-function(nw, arglist, cache.sp=TRUE, ...) {
330-
.d_sp_impl("n", nw, arglist, cache.sp, emptynwstats=.dsp_emptynwstats, ...)
324+
InitErgmTerm.dnsp<-function(nw, arglist, ...) {
325+
.d_sp_impl("n", nw, arglist, emptynwstats=.dsp_emptynwstats, ...)
331326
}
332327

333328

@@ -347,15 +342,14 @@ InitErgmTerm.dnsp<-function(nw, arglist, cache.sp=TRUE, ...) {
347342
#' @template ergmTerm-sp-type
348343
#'
349344
#' @template ergmTerm-sp-types
350-
#' @template ergmTerm-cache-sp
351345
#' @template ergmTerm-general
352346
#'
353347
#' @template ergmTerm-gw-alpha-to-decay
354348
#'
355349
#' @concept directed
356350
#' @aliases dgwnsp-ergmTerm
357-
InitErgmTerm.dgwnsp<-function(nw, arglist, cache.sp=TRUE, gw.cutoff=30, ...) {
358-
.dgw_sp_impl("n", nw, arglist, cache.sp, gw.cutoff, ...)
351+
InitErgmTerm.dgwnsp<-function(nw, arglist, gw.cutoff=30, ...) {
352+
.dgw_sp_impl("n", nw, arglist, gw.cutoff, ...)
359353
}
360354

361355
################################################################################

R/ergm-options.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#'
4343
#' \item{`gw.cutoff`}{In geometrically weighted terms (`gwesp`, `gwdegree`, etc.) the highest number of shared partners, degrees, etc. for which to compute the statistic. This usually defaults to 30.}
4444
#'
45-
#' \item{`cache.sp`}{Whether the \ergmTerm{ergm}{gwesp}{}, \ergmTerm{ergm}{dgwesp}{}, and similar terms need should use a cache for the dyadwise number of shared partners. This usually improves performance significantly at a modest memory cost, and therefore defaults to `TRUE`, but it can be disabled.}
45+
#' \item{`cache.sp`}{Deprecated: Whether the \ergmTerm{ergm}{gwesp}{}, \ergmTerm{ergm}{dgwesp}{}, and similar terms need should use a cache for the dyadwise number of shared partners. This usually improves performance significantly at a modest memory cost, and therefore defaults to `TRUE`, but it can be disabled.}
4646
#'
4747
#' \item{`interact.dependent`}{Whether to allow and how to handle the user attempting to interact dyad-dependent terms (e.g., `absdiff("age"):triangles` or `absdiff("age")*triangles` as opposed to `absdiff("age"):nodefactor("sex")`). Possible values are `"error"` (the default), `"message"`, and `"warning"`, for their respective actions, and `"silent"` for simply processing the term.}
4848
#'

man/b1dsp-ergmTerm-f3ebeba1.Rd

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/b2dsp-ergmTerm-e9e03312.Rd

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/dsp-ergmTerm-1a10473d.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ergm-options.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/esp-ergmTerm-d2e07fc8.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gwb1dsp-ergmTerm-0bf628f4.Rd

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gwb2dsp-ergmTerm-2d408a5d.Rd

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gwdsp-ergmTerm-4e3dfd97.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gwesp-ergmTerm-3d6fb5a8.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gwnsp-ergmTerm-6def2a32.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/nsp-ergmTerm-4586ea4f.Rd

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)