Skip to content

Commit ca2b929

Browse files
committed
Handled similar edge cases that might lead to nullpointer issues.
1 parent d7ea59e commit ca2b929

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Encoding: UTF-8
22
Type: Package
33
Package: fastTopics
4-
Version: 0.7-35
4+
Version: 0.7-36
55
Date: 2025-12-21
66
Title: Fast Algorithms for Fitting Topic Models and Non-Negative
77
Matrix Factorizations to Count Data

R/fit_poisson_nmf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ fit_poisson_nmf <- function (X, k, fit0, numiter = 100,
455455
cat(sprintf("Running at most %d %s updates, %s extrapolation ",
456456
numiter,method.text,
457457
ifelse(control$extrapolate,"with","without")))
458-
cat("(fastTopics 0.7-35).\n")
458+
cat("(fastTopics 0.7-36).\n")
459459
}
460460

461461
# INITIALIZE ESTIMATES

src/ccd.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ inline void ccd_update_factor_sparse (const sp_mat& V, const mat& W,
2929
unsigned int j, double e) {
3030
vec v = nonzeros(V.col(j));
3131
unsigned int n = v.n_elem;
32-
uvec i(n);
32+
if (n == 0)
33+
return;
34+
uvec i(n);
3335
getcolnonzeros(V,i,j);
3436
H.col(j) = ccd_kl_update(W.rows(i),sumw,v,H.col(j),e);
3537
}

src/pnmfem.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ inline vec pnmfem_update_factor_sparse (const sp_mat& X, const mat& F,
2525
vec x = nonzeros(X.col(j));
2626
unsigned int n = x.n_elem;
2727
vec f = F.col(j);
28-
uvec i(n);
28+
if (n == 0)
29+
return;
30+
uvec i(n);
2931
getcolnonzeros(X,i,j);
3032
poismixem(L1,u,x,i,f,numiter);
3133
return f;

0 commit comments

Comments
 (0)