powered by
Via the eigen package
eigen_Xt_times_diag_w_times_X(X, w, num_cores = 1)
The resulting matrix
A numeric matrix of size n x p
A numeric vector of length p
The number of cores to use. Unless p is large, keep to the default of 1.
n = 100 p = 10 X = matrix(rnorm(n * p), nrow = n, ncol = p) w = rnorm(p) eigen_Xt_times_diag_w_times_X(t(X), w)
Run the code above in your browser using DataLab