Added weighted least squares with a test case.

Need to dig a little deeper into the values and its correctness for
various cases.