cast matrix dimensions to native integers before calling newMat