% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simulate.R
\name{rmatrixnorm}
\alias{rmatrixnorm}
\title{Sample from a matrix-normal distribution}
\usage{
rmatrixnorm(mu, L_sigma_rows, L_sigma_cols)
}
\arguments{
\item{mu}{a matrix of means}

\item{L_sigma_rows}{the Cholesky-decomposed covariance matrix for the rows}

\item{L_sigma_cols}{the Cholesky-decomposed covariance matrix for the columns}
}
\value{
A single sample from a matrix-normal distribution with mean
\code{mu} (a matrix), row-wise covariances \code{sigma_rows}, and column-wise
covariances \code{sigma_cols}, where \code{L_sigma_rows} and \code{L_sigma_cols} are the
Cholesky-decomposed covariance matrices
}
\description{
Sample from a matrix-normal distribution
}
\examples{
mu <- matrix(rep(0, 8), nrow = 4)
sd_rows <- rep(1, 4)
sd_cols <- rep(1, 2)
r_rows <- cor_matrix(.25, 4)
r_cols <- cor_matrix(.75, 2)
L_sigma_rows <- chol(cov_matrix(sd_rows, r_rows))
L_sigma_cols <- chol(cov_matrix(sd_cols, r_cols))
rmatrixnorm(mu, L_sigma_rows, L_sigma_cols)
}
