Skip to content

Instantly share code, notes, and snippets.

@glw
Created April 23, 2018 16:16
Show Gist options
  • Save glw/51040253f8f3ed8d4655eca13c562554 to your computer and use it in GitHub Desktop.
Save glw/51040253f8f3ed8d4655eca13c562554 to your computer and use it in GitHub Desktop.
covariance matrix

covariance matrix

numpy http://wiki.scipy.org/Tentative_NumPy_Tutorial

http://stackoverflow.com/a/21759340 Python b1 = np.array([21,78,45,133,12,245,19,148,35,19,149,251,210,168,47,153]).reshape(4, 4) b2 = np.array([41,105,210,148,94,15,32,179,36,14,195,75,84,158,157,255]).reshape(4, 4) b3 = np.array([97,152,87,211,35,147,153,25,98,78,123,14,52,210,96,128]).reshape(4, 4) b4 = np.array([119,95,241,198,15,19,175,52,98,65,36,26,159,54,223,9]).reshape(4, 4) X = numpy.row_stack([b1, b2, b3, b4]) X -= X.mean(axis=0) by_hand = numpy.dot(X.T, X.conj()) / fact print(by_hand)

by_hand - probably has to have a different equation

interesting resources: http://prancer.physics.louisville.edu/astrowiki/index.php/Image_processing_with_Python_and_SciPy http://www.programmingforbiologists.org/importing-data-python http://www.spectralpython.net/fileio.html http://www.spectralpython.net/algorithms.html

R http://data.princeton.edu/R/glms.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment