Change from_matrix to generator only