From 1d8dcfa5ce52584257915a7b6a7323b969d5a1ba Mon Sep 17 00:00:00 2001 From: Michael Braun Date: Sun, 25 Mar 2018 21:23:53 -0500 Subject: [PATCH] Version 0.2.1.1. Replaced deprecated Matrix package functions cBind and rBind with their cbind and rbind counterparts. --- DESCRIPTION | 8 ++++---- NEWS | 3 +++ NEWS.md | 5 +++++ R/binary.R | 2 +- R/rmvn-sparse.R | 4 ++-- man/rmvn.sparse.Rd | 4 ++-- tests/testthat/test_sparseMVN.R | 4 ++-- vignettes/replication.R | 4 ++-- vignettes/sparseMVN.Rnw | 12 ++++++------ 9 files changed, 27 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 37ebb66..4674a0f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,8 @@ Package: sparseMVN Type: Package Title: Multivariate Normal Functions for Sparse Covariance and Precision Matrices -Version: 0.2.1 -Date: 2017-05-23 +Version: 0.2.1.1 +Date: 2018-03-26 Authors@R: person(given="Michael", family="Braun", email="braunm@smu.edu", role=c("aut","cre","cph")) Maintainer: Michael Braun URL: http://www.smu.edu/Cox/Departments/FacultyDirectory/BraunMichael @@ -12,9 +12,9 @@ Description: Computes multivariate normal (MVN) densities, and precision matrix is sparse. License: MPL (>= 2.0) Depends: - R (>= 3.4.0) + R (>= 3.4.4) Imports: - Matrix (>= 1.2.8), + Matrix (>= 1.2.12), methods Suggests: mvtnorm (>= 1.0.6), diff --git a/NEWS b/NEWS index 162d469..e1b8c96 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ NEWS FILE FOR SPARSEMVN PACKAGE +VERSION 0.2.1.1 (Mar. 26, 2018) + +- Removed deprecated Matrix package functions cBind and rBind. VERSION 0.2.1 diff --git a/NEWS.md b/NEWS.md index 2da4445..20ef655 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # NEWS file for sparseMVN package +## VERSION 0.2.1.1 (Mar. 26, 2018) + +* Removed deprecated Matrix package functions cBind and rBind. + + ## VERSION 0.2.1 (May 23, 2017) * New vignette. diff --git a/R/binary.R b/R/binary.R index d4acae9..61579e3 100644 --- a/R/binary.R +++ b/R/binary.R @@ -90,7 +90,7 @@ binary.hess <- function(P, data, priors, order.row=FALSE) { } Bmu <- .d2.dmu(N,SX, XO) - res <- rbind(cbind(B2, Matrix::t(cross)),cBind(cross, Bmu)) + res <- rbind(cbind(B2, Matrix::t(cross)),cbind(cross, Bmu)) return(drop0(res)) } diff --git a/R/rmvn-sparse.R b/R/rmvn-sparse.R index f5acfdf..0c0994f 100644 --- a/R/rmvn-sparse.R +++ b/R/rmvn-sparse.R @@ -35,8 +35,8 @@ #' #' ## build sample sparse covariance matrix #' Q1 <- tril(kronecker(Matrix(seq(0.1,p,length=p*p),p,p),diag(m))) -#' Q2 <- cBind(Q1,Matrix(0,m*p,k)) -#' Q3 <- rBind(Q2,cBind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) +#' Q2 <- cbind(Q1,Matrix(0,m*p,k)) +#' Q3 <- rbind(Q2,cbind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) #' V <- tcrossprod(Q3) #' CH <- Cholesky(V) #' diff --git a/man/rmvn.sparse.Rd b/man/rmvn.sparse.Rd index 22f6621..d7c7d8b 100644 --- a/man/rmvn.sparse.Rd +++ b/man/rmvn.sparse.Rd @@ -53,8 +53,8 @@ if pivoting was turned off. ## build sample sparse covariance matrix Q1 <- tril(kronecker(Matrix(seq(0.1,p,length=p*p),p,p),diag(m))) - Q2 <- cBind(Q1,Matrix(0,m*p,k)) - Q3 <- rBind(Q2,cBind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) + Q2 <- cbind(Q1,Matrix(0,m*p,k)) + Q3 <- rbind(Q2,cbind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) V <- tcrossprod(Q3) CH <- Cholesky(V) diff --git a/tests/testthat/test_sparseMVN.R b/tests/testthat/test_sparseMVN.R index 2ba8e20..f346b19 100644 --- a/tests/testthat/test_sparseMVN.R +++ b/tests/testthat/test_sparseMVN.R @@ -14,8 +14,8 @@ test_that("sparseMVN", { mu <- seq(-3,3,length=p*m+k) Q1 <- tril(kronecker(Matrix(seq(0.1,p,length=p*p),p,p),diag(m))) - Q2 <- cBind(Q1,Matrix(0,m*p,k)) - Q3 <- rBind(Q2,cBind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) + Q2 <- cbind(Q1,Matrix(0,m*p,k)) + Q3 <- rbind(Q2,cbind(Matrix(rnorm(k*m*p),k,m*p),Diagonal(k))) CV <- Matrix::tcrossprod(Q3) chol.CV <- Matrix::Cholesky(CV) ## creates a dCHMsimpl object diff --git a/vignettes/replication.R b/vignettes/replication.R index d550960..17768d9 100644 --- a/vignettes/replication.R +++ b/vignettes/replication.R @@ -15,8 +15,8 @@ registerDoParallel(cores=cores) build_mat <- function(N, k) { t1 <- exp(rnorm(k*k)) Q1 <- tril(kronecker(diag(N),Matrix(t1,k,k))) - Q2 <- cBind(Q1,Matrix(0, N*k, k)) - Q3 <- rBind(Q2,cBind(Matrix(rnorm(N*k*k), k, N*k), Diagonal(k))) + Q2 <- cbind(Q1,Matrix(0, N*k, k)) + Q3 <- rbind(Q2,cbind(Matrix(rnorm(N*k*k), k, N*k), Diagonal(k))) tcrossprod(Q3) } diff --git a/vignettes/sparseMVN.Rnw b/vignettes/sparseMVN.Rnw index cf4737e..2783059 100644 --- a/vignettes/sparseMVN.Rnw +++ b/vignettes/sparseMVN.Rnw @@ -354,8 +354,8 @@ Now the Hessian has an "banded" sparsity pattern, as in Figure~\ref{fig:banded}. \begin{subfigure}[b]{.5\textwidth} <>= Mat <- as(kronecker(diag(N), matrix(1, k, k)),"sparseMatrix") -Mat <- rBind(Mat, Matrix(1, p, N*k)) -Mat <- cBind(Mat, Matrix(1, k*N+p, p)) +Mat <- rbind(Mat, Matrix(1, p, N*k)) +Mat <- cbind(Mat, Matrix(1, k*N+p, p)) printSpMatrix(as(Mat,"nMatrix")) @ \caption{A ``block-arrow'' sparsity pattern.}\label{fig:blockarrow} @@ -363,8 +363,8 @@ printSpMatrix(as(Mat,"nMatrix")) \begin{subfigure}[b]{.5\textwidth} <>= Mat <- kronecker(Matrix(1, k, k), diag(N)) -Mat <- rBind(Mat, Matrix(1, p, N * k)) -Mat <- cBind(Mat, Matrix(1, k*N+p, p)) +Mat <- rbind(Mat, Matrix(1, p, N * k)) +Mat <- cbind(Mat, Matrix(1, k*N+p, p)) printSpMatrix(as(Mat,"nMatrix")) @ \caption{A ``banded'' sparsity pattern.}\label{fig:banded} @@ -375,8 +375,8 @@ printSpMatrix(as(Mat,"nMatrix")) <>= Mat2 <- as(kronecker(diag(Q),matrix(1,k,k)),"lMatrix") %>% - rBind(Matrix(TRUE,p,Q*k)) %>% - cBind(Matrix(TRUE, k*Q+p, p)) %>% + rbind(Matrix(TRUE,p,Q*k)) %>% + cbind(Matrix(TRUE, k*Q+p, p)) %>% as("dgCMatrix") %>% as("symmetricMatrix") A2 <- as(Mat2,"matrix")