Cov shrink matrix with average correlation

Hello World!

I have a my covariance matrix with let's say 500 assets and I need to replace my "initial" Covmatrix with shrinked one by changing all the correlations inside by their average. On the diagonal I would have the variances and others are covariances but with correlation_mean×sd1×sd2 ... No idea so far for me. Please help me someone :frowning: