Note
Click here to download the full example code
[[-0.304 0. 0. ]
[-0. -0.972 0. ]
[ 0. 0. -1.623]]
# Authors: Pierre Ablin <pierreablin@gmail.com>
#
# License: MIT
import numpy as np
from qndiag import qndiag
n, p = 10, 3
diagonals = np.random.uniform(size=(n, p))
A = np.random.randn(p, p) # mixing matrix
C = np.array([A.dot(d[:, None] * A.T) for d in diagonals]) # dataset
B, _ = qndiag(C)
with np.printoptions(precision=3, suppress=True):
print(B.dot(A)) # Should be a permutation + scale matrix
Total running time of the script: ( 0 minutes 0.006 seconds)