Implemented linear regression (vectorized and non-vectorized version)