to get working..

This commit is contained in:
Rowan Cockett
2013-10-22 20:11:30 -07:00
parent 2a8f43aa10
commit 2bb20280bf
6 changed files with 36 additions and 10 deletions
+5 -6
View File
@@ -1,4 +1,5 @@
import numpy as np
from SimPEG.utils import sdiag
class Inversion(object):
"""docstring for Inversion"""
@@ -11,20 +12,18 @@ class Inversion(object):
self.opt = opt
@property
def W(self):
def Wd(self):
"""
Standard deviation weighting matrix.
"""
return self._W
@W.setter
def W(self, value):
self._W = value
return sdiag(1/self.prob.std)
def run(self, m0):
m = m0
self._iter = 0
while True:
self._beta = self.getBeta()
self.opt.minimize(self.evalFunction,m)
m = self.opt.minimize(self.evalFunction,m)
if self.stoppingCriteria(): break
self._iter += 1
+4 -1
View File
@@ -111,13 +111,16 @@ class Minimize(object):
self._STOP[4] = self._iter >= self.maxIter
return all(self._STOP[0:3]) | any(self._STOP[3:])
def projection(self, p):
return p
def linesearch(self, p):
# Armijo linesearch
descent = np.inner(self.g, p)
t = 1
iterLS = 0
while iterLS < self.maxIterLS:
xt = self.xc + t*p
xt = self.projection(self.xc + t*p)
ft = self.evalFunction(xt, return_g=False, return_H=False)
if ft < self.f + t*self.LSreduction*descent:
break
+1
View File
@@ -1 +1,2 @@
from Optimize import *
from Inversion import *