@@ -30,7 +30,7 @@ kmeans.m.step.dmat <- function(PARAM){
30
30
# tmp <- as.vector(colMeans(X.dmat[.pmclustEnv$CLASS.dmat == i.k,]))
31
31
# PARAM$MU[, i.k] <- as.vector(tmp)
32
32
# ## WCC: temp
33
- tmp.1 <- .pmclustEnv $ CLASS.dmat == i.k
33
+ tmp.1 <- .pmclustEnv $ CLASS == i.k # This is not a ddmatrix.
34
34
tmp.2 <- X.dmat [tmp.1 ,]
35
35
tmp.3 <- colMeans(tmp.2 )
36
36
tmp.4 <- as.vector(tmp.3 )
@@ -46,10 +46,11 @@ kmeans.logL.step.dmat <- function(){
46
46
# tmp.diff <- sum(.pmclustEnv$CLASS.dmat != tmp)
47
47
# .pmclustEnv$CLASS.dmat <- tmp
48
48
# ## WCC: temp
49
- tmp.1 <- apply(.pmclustEnv $ Z.dmat , 1 , which.min )
50
- tmp.2 <- .pmclustEnv $ CLASS.dmat != tmp.1
51
- tmp.diff <- sum(tmp.2 )
52
- .pmclustEnv $ CLASS.dmat <- tmp.1
49
+ tmp.1 <- as.matrix(.pmclustEnv $ Z.dmat )
50
+ tmp.2 <- unlist(apply(tmp.1 , 1 , which.min ))
51
+ tmp.3 <- .pmclustEnv $ CLASS != tmp.2 # This is not a ddmatrix.
52
+ tmp.diff <- sum(tmp.3 )
53
+ .pmclustEnv $ CLASS <- tmp.2
53
54
54
55
as.integer(tmp.diff )
55
56
} # End of kmeans.logL.step.dmat().
@@ -139,8 +140,9 @@ kmeans.update.class.dmat <- function(){
139
140
# ## WCC: original
140
141
# .pmclustEnv$CLASS.dmat <- apply(.pmclustEnv$Z.dmat, 1, which.min)
141
142
# ## WCC: temp
142
- tmp.1 <- apply(.pmclustEnv $ Z.dmat , 1 , which.min )
143
- .pmclustEnv $ CLASS.dmat <- tmp.1
143
+ tmp.1 <- as.matrix(.pmclustEnv $ Z.dmat )
144
+ tmp.2 <- unlist(apply(tmp.1 , 1 , which.min ))
145
+ .pmclustEnv $ CLASS <- tmp.2 # This is not a ddmatrix
144
146
145
147
invisible ()
146
148
} # End of kmeans.update.class.dmat().
0 commit comments