1 |
A |
|
b |
|
mu |
|
ncap |
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 | ##---- 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 (A, b, mu=1, ncap=length(b))
{
m <- nrow (A)
n <- ncol (A)
X <- array (0,c(n,ncap))
R <- array (0,c(n,n))
diag (R) <- 1/mu
a <- t(A[1,,drop=FALSE])
phi <- c((1/mu) * crossprod(a) + 1)
w <- (1/phi) * R %*% a
rho <- b[1]
X[,1] <- rho * w
for (j in 2:ncap) {
R = R - phi * tcrossprod(w)
diag (R) <- diag (R) + 1/mu
a <- t(A[j,,drop=FALSE])
phi <- c(t(a) %*% R %*% a)
phi <- phi + 1
rho <- c(b[j] - crossprod (a, X[,j-1]))
w <- (1/phi) * R %*% a
X[,j] <- X[,j-1] + rho*w
}
X
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.