, numpy array matrix: . . , ... , D ** 0.5 , numpy, . :
import numpy as np
from numpy import dot, diag
D = diag([1., 2., 3.])
print D**(-0.5)
[[ 1. Inf Inf]
[ Inf 0.70710678 Inf]
[ Inf Inf 0.57735027]]
, - . numpy ,
D = np.array([1., 2., 3.])
A = np.cov(np.random.randn(3,100))
L = dot(diag(D**(-0.5)), dot(A, diag(D**0.5)))