Return the weighted average of 1-D array x using weights, i.e. sum(x * weights) / sum(weights).
x
weights
sum(x * weights) / sum(weights)
solve(...)