Skip to content

Commit 673d0bd

Browse files
committed
minor
1 parent 6b539b4 commit 673d0bd

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

R/00_pmclust_reduceK.r

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ pmclust.reduceK <- function(X = NULL, K = 2, MU = NULL,
2929
K <- K - length(i.k)
3030

3131
### Initial global storage.
32-
PARAM.org <- set.global(K = K)
32+
if(algorithm[1] %in% .PMC.CT$algorithm.gbd){
33+
PARAM.org <- set.global(K = K)
34+
} else if(algorithm[1] %in% .PMC.CT$algorithm.dmat){
35+
PARAM.org <- set.global.dmat(K = K)
36+
} else{
37+
comm.stop("The algorithm is not found.")
38+
}
3339

3440
### Replacing PARAM.org by previous PARAM.new.
35-
PARAM.org$K <- K
3641
PARAM.org$ETA <- PARAM.new$ETA[-i.k] / sum(PARAM.org$ETA[-i.k])
3742
PARAM.org$log.ETA <- log(PARAM.org$ETA)
3843
PARAM.org$MU <- matrix(PARAM.new$MU[, -i.k], ncol = K)

R/dmat_em_base.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ em.step.dmat <- function(PARAM.org){
284284
PARAM.new <- try(em.onestep.dmat(PARAM.org))
285285
### WCC: temp
286286
# PARAM.new <- em.onestep.dmat(PARAM.org)
287-
if(any(class(PARAM.new) == "try-error") || is.nan(PARAM.new$logL)){
287+
if(class(PARAM.new) == "try-error" || is.nan(PARAM.new$logL)){
288288
comm.cat("Results of previous iterations are returned.\n", quiet = TRUE)
289289
.pmclustEnv$CHECK$convergence <- 99
290290
PARAM.new <- PARAM.org

R/pm_aecm_base.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ aecm.step.spmd <- function(PARAM.org){
102102

103103
### Start AECM here.
104104
PARAM.new <- try(aecm.onestep.spmd(PARAM.org))
105-
if(any(class(PARAM.new) == "try-error") || is.nan(PARAM.new$logL)){
105+
if(class(PARAM.new) == "try-error" || is.nan(PARAM.new$logL)){
106106
comm.cat("Results of previous iterations are returned.\n", quiet = TRUE)
107107
.pmclustEnv$CHECK$convergence <- 99
108108
PARAM.new <- PARAM.org

R/pm_apecm_base.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ apecm.step.spmd <- function(PARAM.org){
138138

139139
### Start APECM here.
140140
PARAM.new <- try(apecm.onestep.spmd(PARAM.org))
141-
if(any(class(PARAM.new) == "try-error") || is.nan(PARAM.new$logL)){
141+
if(class(PARAM.new) == "try-error" || is.nan(PARAM.new$logL)){
142142
comm.cat("Results of previous iterations are returned.\n", quiet = TRUE)
143143
.pmclustEnv$CHECK$convergence <- 99
144144
PARAM.new <- PARAM.org

R/pm_apecma_base.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ apecma.step.spmd <- function(PARAM.org){
9797

9898
### Start APECMA here.
9999
PARAM.new <- try(apecma.onestep.spmd(PARAM.org))
100-
if(any(class(PARAM.new) == "try-error") || is.nan(PARAM.new$logL)){
100+
if(class(PARAM.new) == "try-error" || is.nan(PARAM.new$logL)){
101101
comm.cat("Results of previous iterations are returned.\n", quiet =TRUE)
102102
.pmclustEnv$CHECK$convergence <- 99
103103
PARAM.new <- PARAM.org

R/pm_em_base.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ em.step.spmd <- function(PARAM.org){
185185

186186
### Start EM here.
187187
PARAM.new <- try(em.onestep.spmd(PARAM.org))
188-
if(any(class(PARAM.new) == "try-error") || is.nan(PARAM.new$logL)){
188+
if(class(PARAM.new) == "try-error" || is.nan(PARAM.new$logL)){
189189
comm.cat("Results of previous iterations are returned.\n", quiet = TRUE)
190190
.pmclustEnv$CHECK$convergence <- 99
191191
PARAM.new <- PARAM.org

0 commit comments

Comments
 (0)