powered by
Complete the upper (or lower) extra-diagonal terms in order to obtain a symmetric matrix.
symmetrize(M, update.upper = TRUE)
a matrix
should the upper extra diagonal terms be updated using the lower extra diagonal terms?
# NOT RUN { M <- matrix(NA, 4, 4) M[lower.tri(M)] <- 1:6 symmetrize(M, update.upper = TRUE) # good M[upper.tri(M, diag = FALSE)] <- M[lower.tri(M, diag = FALSE)] M # wrong # }
Run the code above in your browser using DataLab