Skip to content

Commit

Permalink
In C's ergm_etagrad() and ergm_etagradmult(), immediately skip terms …
Browse files Browse the repository at this point in the history
…with 0 model parameters, fixing an ASAN warning.
  • Loading branch information
krivit committed Jan 10, 2025
1 parent d38b283 commit 686fd32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ergm
Version: 4.8.0-7549
Date: 2025-01-09
Version: 4.8.0-7554
Date: 2025-01-11
Title: Fit, Simulate and Diagnose Exponential-Family Models for Networks
Authors@R: c(
person(c("Mark", "S."), "Handcock", role=c("aut"), email="handcock@stat.ucla.edu"),
Expand Down
2 changes: 2 additions & 0 deletions src/etamap.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ void ergm_etagrad(double *theta, SEXP etamap, double *etagrad){

for(unsigned int i = 0; i < ncurved; i++){
SETUP_CALL(gradient);
if(nfrom == 0) continue;
double *g = REAL(eval(call, R_EmptyEnv));
double *dest = etagrad1+from+to*ntheta;
for(unsigned int j=0; j<nto; j++, dest+=ntheta, g+=nfrom)
Expand Down Expand Up @@ -181,6 +182,7 @@ void ergm_etagradmult(double *theta, double *v, unsigned int nv, SEXP etamap, do

for(unsigned int i = 0; i < ncurved; i++){
SETUP_CALL(gradient);
if(nfrom == 0) continue;
double *g = REAL(eval(call, R_EmptyEnv));
double *g1 = g - 1 - nfrom;
for(unsigned int j=1; j<=nfrom; j++){
Expand Down

0 comments on commit 686fd32

Please sign in to comment.