/[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 4373 by gross, Mon Apr 22 03:16:24 2013 UTC revision 4387 by jfenwick, Thu May 2 00:46:49 2013 UTC
# Line 1  Line 1 
1    from __future__ import print_function
2  ##############################################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2013 by University of Queensland  # Copyright (c) 2003-2013 by University of Queensland
# Line 22  __url__="https://launchpad.net/escript-f Line 22  __url__="https://launchpad.net/escript-f
22    
23  __all__ = ['Regularization']  __all__ = ['Regularization']
24    
25    
26  from .costfunctions import CostFunction  from .costfunctions import CostFunction
27    
28  import numpy as np  import numpy as np
# Line 412  class Regularization(CostFunction): Line 413  class Regularization(CostFunction):
413                  A+=integrate(inner(grad_m**2, self.__w1))*mu                  A+=integrate(inner(grad_m**2, self.__w1))*mu
414              else:              else:
415                  for k in range(numLS):                  for k in range(numLS):
416                      print "C = ",integrate(inner(grad_m[k,:]**2,self.__w1[k,:]))                      print("C = ",integrate(inner(grad_m[k,:]**2,self.__w1[k,:])))
417                      A+=mu[k]*integrate(inner(grad_m[k,:]**2,self.__w1[k,:]))                      A+=mu[k]*integrate(inner(grad_m[k,:]**2,self.__w1[k,:]))
418    
419          if numLS > 1:          if numLS > 1:
# Line 421  class Regularization(CostFunction): Line 422  class Regularization(CostFunction):
422                  len_gk=length(gk)                  len_gk=length(gk)
423                  for l in range(k):                  for l in range(k):
424                      gl=grad_m[l,:]                      gl=grad_m[l,:]
425                      print "CC =",integrate( self.__wc[l,k] * ( len_gk * length(gl) )**2 - inner(gk, gl)**2 )                      print("CC =",integrate( self.__wc[l,k] * ( len_gk * length(gl) )**2 - inner(gk, gl)**2 ))
426                      A+= mu_c[l,k] * integrate( self.__wc[l,k] * ( len_gk * length(gl) )**2 - inner(gk, gl)**2 )                      A+= mu_c[l,k] * integrate( self.__wc[l,k] * ( len_gk * length(gl) )**2 - inner(gk, gl)**2 )
427          print "A =",A          print("A =",A)
428          return A/2          return A/2
429    
430      def getGradient(self, m,  grad_m):      def getGradient(self, m,  grad_m):

Legend:
Removed from v.4373  
changed lines
  Added in v.4387

  ViewVC Help
Powered by ViewVC 1.1.26