changed from matrix to array (use np.dot) for consistency