Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def backtracking1(A,b,x,n):
- nu=1
- for t in range(0,n):
- nu=2*nu
- condition = False
- while condition==False:
- before = x
- x = x-nu*gradient(A,b,x)
- if np.linalg.norm(x,1)<=1 and funcion(A,b,x) <= funcion(A,b,before)+np.dot(gradient(A,b,before).T,x-before)+(1/nu)*(np.linalg.norm(x-before)**2):
- condition = True
- else:
- nu = nu/2
- x = before
- return x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement