import numpy as np rows = np.array([[1., 2., 8.], [2., 4., 6.], [3., 6., 4.], [4., 8., 2.]]) matrix = np.corrcoef(rows, rowvar=False) assert matrix.shape == (3, 3) assert np.allclose(matrix, [[1,1,-1],[1,1,-1],[-1,-1,1]], atol=1e-12) print("Three-variable matrix: first two move together; third moves oppositely")