Computation of the kernel (Gram) matrix for the training set
cmf_kernel_matrix_tt(x)
x |
---|
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as cmf_kernel_matrix_tt <- function(ft, mdb, alpha, verbose=1) { nmol <- length(mdb) gram <- matrix(0, nmol, nmol) atomlists <- make_atom_lists(ft, mdb) for (imol in 1:nmol) { if (verbose) {cat("."); flush.console()} mol <- mdb[[imol]] gram[imol,imol] <- cmf_kernel_al(ft, mol, mol, alpha, atomlists[[imol]], atomlists[[imol]]) } if (verbose) {cat("\n"); flush.console()} for (imol1 in 1:(nmol-1)) { mol1 <- mdb[[imol1]] if (verbose) {cat("."); flush.console()} for (imol2 in (imol1+1):nmol) { mol2 <- mdb[[imol2]] gram[imol1,imol2] <- cmf_kernel_al(ft, mol1, mol2, alpha, atomlists[[imol1]], atomlists[[imol2]]) gram[imol2,imol1] <- gram[imol1,imol2] } } }