Description Usage Arguments Examples
Linear interpolation of kernel values
1 | cmf_kernels_interpolate(kernels_a, alpha, alphas)
|
kernels_a |
|
alpha |
|
alphas |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ##---- 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_kernels_interpolate <- function(kernels_a, alpha, alphas)
{
nalphas <- length(alphas)
if (alpha >= alphas[1] && alpha <= alphas[nalphas]) {
iamin <- 1
iamax <- 2
for (ia in 1:(nalphas-1)) {
amin <- alphas[ia]
amax <- alphas[ia+1]
if ((alpha>=amin) && (alpha<=amax)) {
iamin <- ia
iamax <- ia + 1
break
}
}
c1 <- (amax - alpha) / (amax - amin)
c2 <- (alpha - amin) / (amax - amin)
res <- c1 * kernels_a[[iamin]] + c2 * kernels_a[[iamax]]
} else if (alpha < alphas[1]) {
res <- kernels_a[[1]]
} else if (alpha > alphas[nalphas]) {
res <- kernels_a[[nalphas]]
}
return(res)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.