Discussion about this post

User's avatar
Orith Loeb's avatar

Hiiii, a little bit different, here is my solution:

# DDC-54: Eigenvalues and squared singular values

import numpy as np

rng = np.random.default_rng(seed=42)

M = rng.integers(low=0, high=101, size=(4, 10))

S = M@M.T

U,Sing, Vh = np.linalg.svd(S)

Sing_s = np.sort (Sing)

eigen_S, V = np.linalg.eig (S)

eigen_S_sorted = np.sort(eigen_S)

are_equal_approximately = np.allclose(Sing_s, eigen_S_sorted)

print("Sing_s :", Sing_s)

print("eigen_S_sorted:", eigen_S_sorted)

print(f"\nAre they approximately equal? {are_equal_approximately}")

Expand full comment
1 more comment...

No posts