powered by
Rescales a square matrix such that the trace is the same as the dimension.
normalizeTrace(x)
A square numeric matrix to be rescaled.
A numeric matrix.
This is computed as {x=as.matrix(x); x/mean(diag(x))}.
{x=as.matrix(x); x/mean(diag(x))}
base::diag
# NOT RUN { set.seed(3456L) A=tcrossprod(runif(10L)) A0 = normalizeTrace(A) sum(diag(A0)) - nrow(A) # }
Run the code above in your browser using DataLab