'Ellipsoid test objective function'

def elli(self, x, rot=0, xoffset=0, cond=1000000.0, actuator_noise=0.0, both=False):

    if (not np.isscalar(x[0])):
        return [self.elli(xi, rot) for xi in x]
    if rot:
        x = rotate(x)
    N = len(x)
    if actuator_noise:
        x = (x + (actuator_noise * np.random.randn(N)))
    ftrue = sum(((cond ** (np.arange(N) / (N - 1.0))) * ((x + xoffset) ** 2)))
    alpha = (0.49 + (1.0 / N))
    beta = 1
    felli = (((np.random.rand(1)[0] ** beta) * ftrue) * max(1, (((10.0 ** 9) / (ftrue + 1e-99)) ** (alpha * np.random.rand(1)[0]))))
    if both:
        return (felli, ftrue)
    else:
        return ftrue
