• using R Under development (unstable) (2012-02-23 r58468)
  • using platform: i686-pc-linux-gnu (32-bit)
  • using session charset: UTF-8
  • checking for file ‘GrassmannOptim/DESCRIPTION’ ... OK
  • checking extension type ... Package
  • this is package ‘GrassmannOptim’ version ‘1.0’
  • checking package dependencies ... OK
  • checking if this is a source package ... OK
  • checking if there is a namespace ... NOTE
    As from R 2.14.0 all packages need a namespace.
    One will be generated on installation, but it is better to handcraft a
    NAMESPACE file: R CMD build will produce a suitable starting point.
  • checking for executable files ... OK
  • checking whether package ‘GrassmannOptim’ can be installed ... OK
  • checking installed package size ... OK
  • checking package directory ... OK
  • checking for portable file names ... OK
  • checking for sufficient/correct file permissions ... OK
  • checking DESCRIPTION meta-information ... OK
  • checking top-level files ... OK
  • checking index information ... OK
  • checking package subdirectories ... OK
  • checking R files for non-ASCII characters ... OK
  • checking R files for syntax errors ... OK
  • checking whether the package can be loaded ... OK
  • checking whether the package can be loaded with stated dependencies ... OK
  • checking whether the package can be unloaded cleanly ... OK
  • checking for unstated dependencies in R code ... OK
  • checking S3 generic/method consistency ... OK
  • checking replacement functions ... OK
  • checking foreign function calls ... OK
  • checking R code for possible problems ... NOTE
    GrassmannOptim: warning in matrix(rnorm(p^2), nc = p): partial argument
    match of 'nc' to 'ncol'
    GrassmannOptim : getGradient: warning in matrix(0, nr = d, nc = (p -
    d)): partial argument match of 'nr' to 'nrow'
    GrassmannOptim : getGradient: warning in matrix(0, nr = d, nc = (p -
    d)): partial argument match of 'nc' to 'ncol'
    GrassmannOptim: warning in matrix(rnorm(d * (p - d)), nr = d, nc = (p -
    d)): partial argument match of 'nr' to 'nrow'
    GrassmannOptim: warning in matrix(rnorm(d * (p - d)), nr = d, nc = (p -
    d)): partial argument match of 'nc' to 'ncol'
  • checking Rd files ... OK
  • checking Rd metadata ... OK
  • checking Rd cross-references ... OK
  • checking for missing documentation entries ... OK
  • checking for code/documentation mismatches ... OK
  • checking Rd \usage sections ... OK
  • checking Rd contents ... OK
  • checking for unstated dependencies in examples ... WARNING
    ‘library’ or ‘require’ call not declared from: ‘MASS’
  • checking examples ... ERROR
    Running examples in ‘GrassmannOptim-Ex.R’ failed
    The error most likely occurred in:

    > ### Name: GrassmannOptim
    > ### Title: Grassmann Manifold Optimization
    > ### Aliases: GrassmannOptim
    > ### Keywords: optimize programming package
    >
    > ### ** Examples
    >
    >
    > objfun <- function(W){value <- f(W); gradient <- Grad(W);
    + return(list(value=value, gradient=gradient))}
    >
    > f <- function(W){d <- W$dim[1]; Y<-matrix(W$Qt[,1:d], nc=d);
    + return(0.5*Trace(t(Y)%*%W$A%*%Y))}
    >
    > Grad <- function(W){
    + Qt <- W$Qt; d <- W$dim[1]; p <- nrow(Qt); grad <- matrix (0, p, p);
    + Y <- matrix(Qt[,1:d], nc=d); Y0 <- matrix(Qt[,(d+1):p], nc=(p-d));
    + return(t(Y) %*% W$A %*% Y0)}
    >
    > p=5; d=2; set.seed(123);
    > a <- matrix(rnorm(p**2), nc=p); A <- t(a)%*%a;
    >
    > # Exact Solution
    > W <- list(Qt=eigen(A)$vectors[,1:p], dim=c(d,p), A=A);
    > ans <- GrassmannOptim(objfun, W, eps_conv=1e-5, verbose=TRUE);
    Initialization...
    iter Loglik Gradient
    1 9.8887e+00 2.7611e-07
    > ans$converged
    [1] TRUE
    >
    > # Random starting matrix
    > m<-matrix(rnorm(p**2), nc=p); m<-t(m)%*%m;
    > W <- list(Qt=eigen(m)$vectors, dim=c(d,p), A=A);
    > ans <- GrassmannOptim(objfun, W, eps_conv=1e-5, verbose=TRUE);
    Initialization...
    iter Loglik Gradient
    1 6.2438e+00 2.6699e+01
    2 7.6248e+00 1.9694e+00
    3 7.7557e+00 1.0914e+00
    4 8.3940e+00 8.2616e+00
    5 9.0608e+00 6.1352e+00
    6 9.5756e+00 5.7580e+00
    7 9.7627e+00 1.4214e+00
    8 9.8466e+00 6.3750e-01
    9 9.8751e+00 1.2311e-01
    10 9.8854e+00 5.5193e-02
    11 9.8874e+00 1.1600e-02
    12 9.8879e+00 4.1282e-03
    13 9.8889e+00 1.6586e-03
    23 9.8890e+00 7.9597e-04
    32 9.8892e+00 8.2306e-04
    41 9.8893e+00 2.4065e-04
    Convergence may not have been reached.
    Maximum iterations is reached
    > plot(ans$fvalues)
    >
    > # Simulated Annealing
    > W <- list(dim=c(d,p), A=A);
    > ans <- GrassmannOptim(objfun, W, sim_anneal=TRUE, max_iter_sa=35, verbose=TRUE);
    Initialization...
    Simulated Annealing... This may take a while.
    Initial temperature= 20
    Cooling...
    Current temperature:
    10
    5
    2.5
    1.25
    0.625
    0.3125
    0.15625
    0.078125
    iter Loglik Gradient
    1 9.8887e+00 1.6953e-04
    Convergence may not have been reached.
    Maximum iterations is reached
    >
    > ########
    >
    > set.seed(13);p=8; nobs=200; d=3; sigma=1.5; sigma0=2; require(MASS);
    Loading required package: MASS
    Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
    there is no package called ‘MASS’
    >
    > objfun <- function(W){return(list(value=f(W), gradient=Gradient(W)))}
    >
    > f <- function(W){
    + Qt <- W$Qt; d <- W$dim[1]; p <- ncol(Qt); Sigmas <- W$sigmas;
    + U <- matrix(Qt[,1:d], nc=d); V <- matrix(Qt[,(d+1):p], nc=(p-d));
    + return(-log(det(t(V)%*%Sigmas$S%*%V))-log(det(t(U)%*%Sigmas$S_res%*%U)))}
    >
    > Gradient <- function(W)
    + {Qt <- W$Qt; d <- W$dim[1]; p <- ncol(Qt); Sigmas <- W$sigmas;
    + U <- matrix(Qt[,1:d], nc=d); V <- matrix(Qt[,(d+1):p], nc=(p-d));
    + terme1 <- solve(t(U)%*%Sigmas$S_res%*%U)%*% t(U)%*%Sigmas$S_res%*%V;
    + terme2 <- t(U)%*%Sigmas$S%*%V%*%solve(t(V)%*%Sigmas$S%*%V);
    + return(2*(terme1 - terme2))}
    >
    > y<-array(runif(n=nobs, min=-2, max=2), c(nobs, 1));
    > fy<-scale(cbind(y, y^2, y^3),TRUE,FALSE);
    >
    > #Structured error PFC model;
    > Gamma<-diag(p)[,c(1:3)]; Gamma0<-diag(p)[,-c(1:3)];
    > Omega <-sigma^2*matrix(0.5, nc=3, nr=3); diag(Omega)<-sigma^2;
    > Delta<- Gamma%*%Omega%*%t(Gamma) + sigma0^2*Gamma0%*%t(Gamma0);
    > Err<- t(mvrnorm(n=nobs, mu=c(rep(0, p)), Sig=Delta ));
    Execution halted