R Under development (unstable) (2025-05-04 r88189 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. 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. > set.seed(20250409) > > covprod <- distfreereg:::covprod > > block_dims <- c(7,5,13) > n <- sum(block_dims) > > Sigma_list <- lapply(seq_along(block_dims), + function(i) rWishart(1, df = block_dims[i], diag(block_dims[i]))[,,1]) > > Sigma_mat <- as.matrix(Matrix::bdiag(Sigma_list)) > Sigma_vec <- rnorm(n) > Sigma_num <- rnorm(1) > M <- matrix(rnorm(3*n), nrow = n) > > all.equal(covprod(Sigma_list, M), + Sigma_mat %*% M) [1] TRUE > all.equal(covprod(Sigma_mat, M), + Sigma_mat %*% M) [1] TRUE > all.equal(covprod(Sigma_vec, M), + diag(Sigma_vec) %*% M) [1] TRUE > all.equal(covprod(Sigma_num, M), + diag(Sigma_num, nrow = n) %*% M) [1] TRUE > > proc.time() user system elapsed 1.85 0.15 2.00