scripts/temp-distance-functions/expand_matrix.R

expand_matrix <- function(A) {
    m <- nrow(A)
    n <- ncol(A)

    if (m > n) {
        stop("A must have more columns than rows")
    }
    # B <- Matrix(0, nrow = m, ncol = m, sparse = TRUE)
    # C <- Matrix(0, nrow = n, ncol = n, sparse = TRUE)
    # cbind(rbind(B, t(A)), rbind(A, C))
    rbind(A, Matrix(0, nrow = n-m, ncol = n, sparse = TRUE))
}
jtipton25/sgMRA documentation built on Feb. 9, 2023, 4:53 a.m.