fix#9570: implement mat ptr for generic types