Skip to content
DeepForgeby svx
All problems
HardLinear Algebrala-088

Whitening Transform 2x2

Problem

Compute the symmetric whitening matrix W = inv(C)^(1/2) for a symmetric positive definite 2x2 covariance matrix C.

Use the eigendecomposition C = Q*Lambda*Q^T with orthonormal Q and return W = Q*Lambda^(-1/2)*Q^T, so that W*C*W = I.

Hint

Invert the square roots of the eigenvalues in the diagonal factor.

Test cases

case 1
in: [[[4,0],[0,9]]]
expected: [[0.5,0],[0,0.3333333333333333]]
case 2
in: [[[1,0],[0,1]]]
expected: [[1,0],[0,1]]
case 3
in: [[[2,1],[1,2]]]
expected: [[0.7886751345948128,-0.21132486540518702],[-0.21132486540518702,0.7886751345948128]]
case 4
in: [[[3,1],[1,3]]]
expected: [[0.6035533905932736,-0.10355339059327373],[-0.10355339059327373,0.6035533905932736]]
Starter codePython
def whitening_2x2(C):
    # Your code here
    pass

4 test cases · run your code against them in the editor