move Weights to Matrix class