numpy matrix to array,A = np.squeeze(np.asarray(M))