R Under development (unstable) (2024-03-01 r86033 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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. > library(bdsmatrix) Attaching package: 'bdsmatrix' The following object is masked from 'package:base': backsolve > aeq <- function(x,y) all.equal(as.vector(x), as.vector(y)) > > # > # Test multiplication of a vector/matrix times a gchol > # > tmat <- bdsmatrix(c(3,2,2,4), + c(22,1,2,21,3,20,19,4,18,17,5,16,15,6,7, 8,14,9,10,13,11,12), + matrix(c(1,0,1,1,0,0,1,1,0,1,0,10,0, + 0,1,1,0,1,1,0,1,1,0,1,0,10), ncol=2)) > dimnames(tmat) <- list(NULL, letters[1:13]) > > gmat <- gchol(tmat) > g2 <- as.matrix(gmat) %*% diag(sqrt(diag(gmat))) > > > aeq(1:13 %*% g2, 1:13 %*% gmat) #vectors first [1] TRUE > aeq(g2 %*% 1:13, gmat %*% 1:13) [1] TRUE > > temp <- matrix(runif(39), nrow=3) > aeq(temp %*% g2, temp %*% gmat) [1] TRUE > aeq(g2 %*% t(temp), gmat %*% t(temp)) [1] TRUE > > proc.time() user system elapsed 0.28 0.06 0.34