fit function

New generic for estimating matrix distributions