Efficient way of doing linear regression

Related to your question: