Skip to content

allocate com_size per community in FOMD_Rcpp - #2

Merged
martirm merged 1 commit into
martirm:mainfrom
kevinushey:bugfix/rcpp-sugar-lengths
Oct 11, 2026
Merged

martirm merged 1 commit into
martirm:mainfrom
kevinushey:bugfix/rcpp-sugar-lengths

Conversation

@kevinushey

Copy link
Copy Markdown
Contributor

Background

The next Rcpp release (see RcppCore/Rcpp#1513) checks that the operands of a sugar expression, and a vector assigned into a matrix row, column or Range subset, have matching lengths. Previously a longer operand was silently truncated to the length of the left-hand side or target. With that check, clustAnalytics fails its CRAN checks with:

Error: sugar operands have different lengths (2 and 34)

In FOMD_Rcpp(), com_size is allocated with n (the number of vertices) but indexed by community, and then divided into FOMD, which has n_com elements. Old Rcpp read only the first n_com entries, so results were correct. The sibling functions out_degree_fractions_Rcpp() and TPR_coms_Rcpp() already allocate with n_com.

Change

Allocate com_size with n_com.

Testing

R CMD check on the patched package passes against both the current Rcpp branch and released Rcpp 1.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants