Category : linear-algebra

I am calculating an autocorrelation function of a signal using Numpy’s FFT by first calculating the power spectrum. I believe that autocorrelation functions are positive definite. However, when I test if my simulated autocorrelation function is positive definite, it often fails. Here’s some example code: import numpy as np def is_pos_def(x): return np.all(np.linalg.eigvals(x) > 0) ..

Read more

Below is my code: import numpy as np M = np.array([[0.94957099, 0.08870858 + 0.30074196j], [0.08870858 – 0.30074196j, -0.94957099]]) vals, vecs = np.linalg.eigh(M) eta = np.diag([vals[0], vals[1]]) print(vecs @ eta @ vecs.T) Obviously M is a Hermitian matrix, when I tried to use the result of the eigendecomposition to regain M, I got a different matrix ..

Read more

Apologies for double-posting. I haven’t found a solution yet. Former post: Conditional Numpy shuffling Problem I have a randomly shuffled 2D array of dtype=int and would like to maximize the distance between identical integers. This is an optimization problem. E.g. I have: np.array([1, 2, 2, 2], [3, 2, 1, 1], [1, 3, 3, 1], [1, ..

Read more

I am trying to speed up some multi-camera system that relies on calculation of fundamental matrices between each camera pair. Please notice the following is pseudocode. @ means matrix multiplication, | means concatenation. I have code to calculate F for each pair calculate_f(camera_matrix1_3x4, camera_matrix1_3x4), and the naiive solution is for c1 in cameras: for c2 ..

Read more