def compute_functional_and_gradients(self):
    self.a = self.x
    residuals = (((self.datay - ((self.a[0] * self.datax) * self.datax)) - (self.a[1] * self.datax)) - self.a[2])
    f = flex.sum(((0.5 * residuals) * residuals))
    g = flex.double(self.n)
    dR_da = ((- self.datax) * self.datax)
    dR_db = (- self.datax)
    dR_dc = flex.double(len(self.datax), (- 1))
    g[0] = flex.sum((residuals * dR_da))
    g[1] = flex.sum((residuals * dR_db))
    g[2] = flex.sum((residuals * dR_dc))
    return (f, g)
def compute_functional_and_gradients(self):
    self.a = self.x
    residuals = (((self.datay - ((self.a[0] * self.datax) * self.datax)) - (self.a[1] * self.datax)) - self.a[2])
    f = flex.sum(((0.5 * residuals) * residuals))
    g = flex.double(self.n)
    dR_da = ((- self.datax) * self.datax)
    dR_db = (- self.datax)
    dR_dc = flex.double(len(self.datax), (- 1))
    g[0] = flex.sum((residuals * dR_da))
    g[1] = flex.sum((residuals * dR_db))
    g[2] = flex.sum((residuals * dR_dc))
    return (f, g)