/[escript]/trunk/downunder/py_src/regularizations.py
ViewVC logotype

Diff of /trunk/downunder/py_src/regularizations.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3981 by jfenwick, Fri Sep 21 02:47:54 2012 UTC revision 4007 by caltinay, Tue Oct 2 02:12:01 2012 UTC
# Line 30  class Regularization(object): Line 30  class Regularization(object):
30      """      """
31      """      """
32      def __init__(self, domain, m_ref=0, w0=None, w=None, location_of_set_m=Data(), tol=1e-8):      def __init__(self, domain, m_ref=0, w0=None, w=None, location_of_set_m=Data(), tol=1e-8):
33            """
34            """
35          self.__domain=domain          self.__domain=domain
36          self.__m_ref=m_ref          self.__m_ref=m_ref
37          self.location_of_set_m=location_of_set_m          self.location_of_set_m=location_of_set_m
# Line 54  class Regularization(object): Line 56  class Regularization(object):
56          return integrate(inner(grad(f0),grad(f1)))          return integrate(inner(grad(f0),grad(f1)))
57    
58      def project(self, Y=Data(), X=Data()):      def project(self, Y=Data(), X=Data()):
59            """
60            """
61          self.__projector.setValue(Y=Y, X=X)          self.__projector.setValue(Y=Y, X=X)
62          return  self.__projector.getSolution()          return  self.__projector.getSolution()
63    
64      def getValue(self, m):      def getValue(self, m):
65            """
66            """
67          A=0          A=0
68          if self._w0 is not None:          if self._w0 is not None:
69              A=(m-self.__m_ref)**2 * self._w0              A=(m-self.__m_ref)**2 * self._w0
# Line 66  class Regularization(object): Line 72  class Regularization(object):
72          return integrate(A)          return integrate(A)
73    
74      def getGradient(self, m):      def getGradient(self, m):
75            """
76            """
77          if not self._w0 == None:          if not self._w0 == None:
78              Y=2. * (m-self.__m_ref) * self._w0              Y=2. * (m-self.__m_ref) * self._w0
79          else:          else:
# Line 78  class Regularization(object): Line 86  class Regularization(object):
86          return Y, X          return Y, X
87    
88      def getArguments(self, m):      def getArguments(self, m):
89            """
90            """
91          return ()          return ()
92    

Legend:
Removed from v.3981  
changed lines
  Added in v.4007

  ViewVC Help
Powered by ViewVC 1.1.26