Fit: use generic classes and optimize Polynomial() matrix creation

Use only the generic Vector and Matrix classes in Fit.
Also Polynomial() is optimized by not creating DenseVectors for every column in the matrix.

Maybe it is possible to rewrite code that DenseOfRows() can be replaced by the faster DenseOfColumns() in LinearMultiDim() and LinearGeneric().