Description Usage Arguments Details Value Note Author(s) References See Also Examples
~~ A concise (1-5 lines) description of what the function does. ~~
1 |
fnH |
~~Describe |
iN |
~~Describe |
sMethod |
~~Describe |
bPoints |
~~Describe |
vZ |
~~Describe |
vW |
~~Describe |
lExtraArgsKernel |
~~Describe |
~~ If necessary, more details than the description above ~~
~Describe the value returned If it is a LIST, use
comp1 |
Description of 'comp1' |
comp2 |
Description of 'comp2' |
...
~~further notes~~
~Make other sections like Warning with Warning .... ~
~~who you are~~
~put references to the literature/web site here ~
~~objects to See Also as help
, ~~~
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (fnH, iN, sMethod, bPoints = FALSE, vZ = NULL, vW = NULL,
lExtraArgsKernel = NULL)
{
if (!bPoints) {
if (sMethod == "MC") {
vZ <- runif(iN)
vW <- rep(1/iN, iN)
}
else if (sMethod == "QMC") {
vZ <- hammset(iN)
vW <- rep(1/iN, iN)
}
else if (sMethod == "TR") {
vZ <- as.matrix(0:(iN - 1))/(iN - 1)
vW <- c(0.5, matrix(1, iN - 2, 1), 0.5)/(iN - 1)
}
else if (sMethod == "GL") {
lGL <- gauss.quad(iN)
vZ <- (lGL$nodes + 1)/2
vW <- (lGL$weights)/2
}
else if (sMethod == "CC") {
lCC <- CC.quad(iN)
vZ <- lCC$nodes
vW <- lCC$weights
}
mW <- diag(as.vector(vW))
mHtemp <- matrix(0, iN, iN)
for (k in 1:iN) {
for (l in 1:iN) {
mHtemp[k, l] <- fnH(vZ[k], vZ[l], lExtraArgsKernel)
}
}
if (sMethod %in% c("MC", "QMC")) {
mH <- mHtemp/iN
mHsymm <- mH
}
else if (sMethod %in% c("TR", "GL", "CC")) {
mH <- mHtemp %*% mW
mHsymm <- sqrt(mW) %*% mHtemp %*% sqrt(mW)
}
}
else {
iN <- length(vZ)
mHtemp <- matrix(0, iN, iN)
for (k in 1:iN) {
for (l in 1:iN) {
mHtemp[k, l] <- fnH(vZ[k], vZ[l], lExtraArgsKernel)
}
}
mH <- mHtemp %*% mW
mHsymm <- sqrt(mW) %*% mHtemp %*% sqrt(mW)
}
lEigen <- eigen(mHsymm, symmetric = TRUE)
vEigVal <- lEigen$values
lEigen <- eigen(mH, symmetric = FALSE)
mEigVec <- lEigen$vectors
if (sMethod %in% c("MC", "QMC")) {
mEigVecNorm <- mEigVec * sqrt(iN)
}
else if (sMethod %in% c("TR", "GL", "CC")) {
mEigVecNorm <- mEigVec
for (k in 1:length(vZ)) {
dTemp <- sqrt(sum(t(vW) * mEigVec[, k] * mEigVec[,
k]))
mEigVecNorm[, k] <- mEigVec[, k]/as.numeric(dTemp)
}
}
return(list(nodes = vZ, weights = vW, eigval = vEigVal, eigvec = mEigVec,
eigvecnorm = mEigVecNorm))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.