### For general methods.
pmclust <- function(X = NULL, K = 2, MU = NULL,
algorithm = .PMC.CT$algorithm, RndEM.iter = .PMC.CT$RndEM.iter,
CONTROL = .PMC.CT$CONTROL, method.own.X = .PMC.CT$method.own.X,
rank.own.X = .pbd_env$SPMD.CT$rank.source, comm = .pbd_env$SPMD.CT$comm){
if(comm.all(is.null(X))){
# Check global matrix.
A <- exists("X.spmd", envir = .GlobalEnv)
if(!A){
if(! algorithm[1] %in% .PMC.CT$algorithm.gbd){
comm.stop("A global X.spmd is required in .GlobalEnv.")
}
}
}
if(algorithm[1] %in% .PMC.CT$algorithm.gbd){
ret <- pmclust.internal(X, K,
MU = MU,
algorithm = algorithm[1],
RndEM.iter = RndEM.iter,
CONTROL = CONTROL,
method.own.X = method.own.X[1],
rank.own.X = rank.own.X,
comm = comm)
} else{
comm.stop("The algorithm is not found.")
}
if(algorithm[1] %in% c("kmeans")){
class(ret) <- "pkmeans"
} else{
class(ret) <- "pmclust"
}
ret
} # end of pmclust().
pkmeans <- function(X = NULL, K = 2, MU = NULL,
algorithm = c("kmeans"),
CONTROL = .PMC.CT$CONTROL, method.own.X = .PMC.CT$method.own.X,
rank.own.X = .pbd_env$SPMD.CT$rank.source, comm = .pbd_env$SPMD.CT$comm){
if(comm.all(is.null(X))){
# Check global matrix.
A <- exists("X.spmd", envir = .GlobalEnv)
if(!A){
if(! algorithm[1] %in% .PMC.CT$algorithm.gbd){
comm.stop("A global X.spmd is required in .GlobalEnv.")
}
}
}
if(algorithm[1] == "kmeans"){
ret <- pmclust.internal(X, K,
MU = MU,
algorithm = algorithm[1],
CONTROL = CONTROL,
method.own.X = method.own.X[1],
rank.own.X = rank.own.X,
comm = comm)
} else{
comm.stop("The algorithm is not found.")
}
class(ret) <- "pkmeans"
ret
} # end of pkmeans().
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.