The class equation for row-equivalent matrices over a principal ideal domain A