mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-30 12:30:18 +08:00
to get working..
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 +1,2 @@
|
||||
from Optimize import *
|
||||
from Inversion import *
|
||||
|
||||
Reference in New Issue
Block a user