subroutine fitLine(x, y, intercept, slope, variance, covar, status)
real(single), intent(in) :: x(:), y(size(x))
real(single), intent(out) :: intercept, slope
real(single), intent(out), optional :: variance, covar(2, 2)
integer, intent(out), optional :: status
end subroutine fitLine
This fits a straight line to the set of points defined by x and y. The solution method is the standard one which assumes uncertainty in the y values only and solves the normal equations to arrive at a solution which minimizes the sum of the squares of the -separation between the resulting line and each point.