import numpy as np

#TODO: change implemenation to vectorized (In: matrix, Out: vec)
def Rastrigin(y):
    x = np.copy(y)
    A = 10
    n = x.shape[0]
    f = 0
    for i in range(n):
        x[i] = x[i] + 10
        f = f + x[i]*x[i] - A*np.cos(2*np.pi*x[i])
    f = f + A*n
    return f

def Squared(x):
    n = x.shape[0]
    f = 0
    for i in range(n):
        f = f + x[i]*x[i]
    return f

def functionWrapper():
    func = bf.Schwefel(n_dimensions=4)
    point = [25, -34.6, -112.231, 242]
     # results in -129.38197657025287
    print(func(point))

    
    
# decorator to change input numpy array to list
def numpyWrapper(func):
      
    def inner1(x): #x - numpy array
        x_list = x.tolist()
        result = func(x_list)
        return result
    return inner1
  
