Description Usage Arguments Value Examples
Define a product manifold composed of simpler manifolds
1 |
... |
One or more simpler Manifold definitions |
List containing manifold definitions for the product manifold
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 | mani.defn1 <- get.product.defn(get.sphere.defn(n=5), get.spd.defn(n=5))
mani.defn2 <- get.product.defn(
get.stiefel.defn(n=10, p=5),
get.stiefel.defn(n=7, p=3),
get.grassmann.defn(n=10, p=5)
)
## Not run:
# --- Estimate jointly: Sigma in SPD manifold and mu in sphere manifold ---
library(mvtnorm)
n <- 400
p <- 3
mu.true <- rep(1/sqrt(p), p)
Sigma.true <- diag(2,p) + 0.1
y <- rmvnorm(n, mean = mu.true, sigma = Sigma.true)
tx <- function(x) {
idx.mu <- 1:p
idx.S <- 1:p^2 + p
mu <- x[idx.mu]
S <- matrix(x[idx.S], p, p)
list(mu = mu, Sigma = S)
}
f <- function(x) {
par <- tx(x)
-sum(dmvnorm(y, mean = par$mu, sigma = par$Sigma, log = TRUE))
}
mod <- Module("ManifoldOptim_module", PACKAGE = "ManifoldOptim")
prob <- new(mod$RProblem, f)
mu0 <- diag(1, p)[,1]
Sigma0 <- diag(1, p)
x0 <- c(mu0, as.numeric(Sigma0))
mani.defn <- get.product.defn(get.sphere.defn(p), get.spd.defn(p))
mani.params <- get.manifold.params()
solver.params <- get.solver.params(isconvex = TRUE)
res <- manifold.optim(prob, mani.defn, method = "LRBFGS",
mani.params = mani.params, solver.params = solver.params, x0 = x0)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.