def de_mean_matrix(A):
 (nr, nc) = shape(A)
 (column_means, _) = scale(A)
 return make_matrix(nr, nc, (lambda i, j: (A[i][j] - column_means[j])))

def de_mean_matrix ( A ) : ( nr , nc ) = shape ( A ) ( column_means , _ ) = scale ( A ) return make_matrix ( nr , nc , ( lambda i , j : ( A [ i ] [ j ] - column_means [ j ] ) ) )
returns the result of subtracting from every value in a the mean value of its column .