Skip to content

Commit

Permalink
Version 0.2.1.1. Replaced deprecated Matrix package functions cBind a…
Browse files Browse the repository at this point in the history
…nd rBind with their cbind and rbind counterparts.
  • Loading branch information
braunm committed Mar 26, 2018
1 parent 332f140 commit 1d8dcfa
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]", role=c("aut","cre","cph"))
Maintainer: Michael Braun <[email protected]>
URL: http://www.smu.edu/Cox/Departments/FacultyDirectory/BraunMichael
Expand All @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion R/binary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
4 changes: 2 additions & 2 deletions R/rmvn-sparse.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
#'
Expand Down
4 changes: 2 additions & 2 deletions man/rmvn.sparse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test_sparseMVN.R
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions vignettes/replication.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
12 changes: 6 additions & 6 deletions vignettes/sparseMVN.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,17 @@ Now the Hessian has an "banded" sparsity pattern, as in Figure~\ref{fig:banded}.
\begin{subfigure}[b]{.5\textwidth}
<<blockarrow, echo=FALSE, comment=NA>>=
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}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
<<banded, echo=FALSE, comment=NA>>=
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}
Expand All @@ -375,8 +375,8 @@ printSpMatrix(as(Mat,"nMatrix"))

<<echo=FALSE, results="hide">>=
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")
Expand Down

0 comments on commit 1d8dcfa

Please sign in to comment.