==25705== Memcheck, a memory error detector ==25705== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==25705== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info ==25705== Command: /data/blackswan/ripley/R/R-devel-vg/bin/exec/R --vanilla ==25705== R Under development (unstable) (2018-01-28 r74175) -- "Unsuffered Consequences" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pkgname <- "MGGM" > source(file.path(R.home("share"), "R", "examples-header.R")) > options(warn = 1) > library('MGGM') > > base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') > base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv') > cleanEx() > nameEx("MGGM.path") > ### * MGGM.path > > flush(stderr()); flush(stdout()) > > ### Name: MGGM.path > ### Title: Solution path of multiple Gaussion graph model > ### Aliases: MGGM.path > > ### ** Examples > > library(MASS) > > ## generating L true sparse precision and covariance matrices > L <- num_of_matrix <- 4 > ## two different underlying matrices > L0 <- 2 > p <- dim_of_matrix <- 20 > n <- 120 #number of observations for each l > nn <- rep(n,L) > MAX_iter <- 200 #max number of iterations > > Gene_cov<-function(p){ + sigma <- runif(p-1,0.5,1) + covmat0 <- diag(1,p) + for (i in 1:(p-1)){ + for (j in (i+1):p){ + temp <- exp(-sum(sigma[i:(j-1)]/2)) + covmat0[i,j] <- temp + covmat0[j,i] <- temp + } + } + return(covmat0) + } > covmat1 <- Gene_cov(p) > covmat_inverse1 <- solve(covmat1) > covmat2 <- Gene_cov(p) > covmat_inverse2 <- solve(covmat2) > > ## set first L/2 and last L/2 matrices to be the same > covmat0 <- cbind(matrix(rep(covmat1,L/2),p,p*L/2), matrix(rep(covmat2,L/2),p,p*L/2)) > covmat_inverse0 <- cbind(matrix(rep(covmat_inverse1,L/2),p,p*L/2), + matrix(rep(covmat_inverse2,L/2),p,p*L/2)) > > > ## generating sample covariance matrices S_bar = [S_1, ... S_L] > S_bar <- matrix(0,p,L*p) > for (l in 1:L){ + temp <- mvrnorm(n = nn[l], rep(0,p), covmat0[,((l-1)*p+1):(l*p)]) + S_bar[,((l-1)*p+1):(l*p)] <- crossprod(temp) / nn[l] + } > > > ## matrices generation ends > Lambda1.vec <- log(p)*c(.8, .5, .4, .3, 0.2) #lasso penlaty > Lambda2.vec <- log(p)*c(.1, .08, .06, .05, .04, .03, .0) #grouping penalty > tau <- c(0.01) #thresholding parameter > > ## generating graphs > graph_complete = matrix(0,2,L*(L-1)/2) > for (l1 in 1:(L-1)){ + graph_complete[,(L*(l1-1)-(l1-1)*l1/2+1):(L*l1-l1*(l1+1)/2)] = rbind(rep(l1,L-l1),(l1+1):L) + } > graph <- graph_complete - 1 > > sol_path <- MGGM.path(S_bar, nn, Lambda1.vec, Lambda2.vec, graph, tau) ==25705== Invalid read of size 8 ==25705== at 0x154996A1: zero_agree (packages/tests-vg/MGGM/src/main.cpp:122) ==25705== by 0x1549A882: solve_lasso (packages/tests-vg/MGGM/src/main.cpp:292) ==25705== by 0x1549B1F5: solve_grouping (packages/tests-vg/MGGM/src/main.cpp:399) ==25705== by 0x1549B9EB: matrix_grouping_sub (packages/tests-vg/MGGM/src/main.cpp:491) ==25705== by 0x1549C164: matrix_grouping_path (packages/tests-vg/MGGM/src/main.cpp:655) ==25705== by 0x49B914: do_dotCode (svn/R-devel/src/main/dotcode.c:1813) ==25705== by 0x4CBAA1: bcEval (svn/R-devel/src/main/eval.c:6766) ==25705== by 0x4D9FCF: Rf_eval (svn/R-devel/src/main/eval.c:624) ==25705== by 0x4DB8BE: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==25705== by 0x4DA15C: Rf_eval (svn/R-devel/src/main/eval.c:747) ==25705== by 0x4DE13F: do_set (svn/R-devel/src/main/eval.c:2774) ==25705== by 0x4DA37B: Rf_eval (svn/R-devel/src/main/eval.c:699) ==25705== Address 0x1220adc0 is 0 bytes inside a block of size 608 free'd ==25705== at 0x4C2ED18: free (/builddir/build/BUILD/valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c:530) ==25705== by 0x1549A870: solve_lasso (packages/tests-vg/MGGM/src/main.cpp:291) ==25705== by 0x1549B1F5: solve_grouping (packages/tests-vg/MGGM/src/main.cpp:399) ==25705== by 0x1549B9EB: matrix_grouping_sub (packages/tests-vg/MGGM/src/main.cpp:491) ==25705== by 0x1549C164: matrix_grouping_path (packages/tests-vg/MGGM/src/main.cpp:655) ==25705== by 0x49B914: do_dotCode (svn/R-devel/src/main/dotcode.c:1813) ==25705== by 0x4CBAA1: bcEval (svn/R-devel/src/main/eval.c:6766) ==25705== by 0x4D9FCF: Rf_eval (svn/R-devel/src/main/eval.c:624) ==25705== by 0x4DB8BE: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==25705== by 0x4DA15C: Rf_eval (svn/R-devel/src/main/eval.c:747) ==25705== by 0x4DE13F: do_set (svn/R-devel/src/main/eval.c:2774) ==25705== by 0x4DA37B: Rf_eval (svn/R-devel/src/main/eval.c:699) ==25705== Block was alloc'd at ==25705== at 0x4C2DB6B: malloc (/builddir/build/BUILD/valgrind-3.13.0/coregrind/m_replacemalloc/vg_replace_malloc.c:299) ==25705== by 0x1549A40E: solve_lasso (packages/tests-vg/MGGM/src/main.cpp:233) ==25705== by 0x1549B1F5: solve_grouping (packages/tests-vg/MGGM/src/main.cpp:399) ==25705== by 0x1549B9EB: matrix_grouping_sub (packages/tests-vg/MGGM/src/main.cpp:491) ==25705== by 0x1549C164: matrix_grouping_path (packages/tests-vg/MGGM/src/main.cpp:655) ==25705== by 0x49B914: do_dotCode (svn/R-devel/src/main/dotcode.c:1813) ==25705== by 0x4CBAA1: bcEval (svn/R-devel/src/main/eval.c:6766) ==25705== by 0x4D9FCF: Rf_eval (svn/R-devel/src/main/eval.c:624) ==25705== by 0x4DB8BE: R_execClosure (svn/R-devel/src/main/eval.c:1764) ==25705== by 0x4DA15C: Rf_eval (svn/R-devel/src/main/eval.c:747) ==25705== by 0x4DE13F: do_set (svn/R-devel/src/main/eval.c:2774) ==25705== by 0x4DA37B: Rf_eval (svn/R-devel/src/main/eval.c:699) ==25705== > > > > > > ### *