Beispiel #1
0
  def __init__(self, xv, fxv, dfxv=None, xg=None, fpxg=None, dfpxg=None, \
               N=None, l=1, verbose=1, safety_factor=1.0):
    """
    __init__(self, xv, fxv, dfxv=None, xg=None,
             fpxg=None, dfpxg=None, N=None, l=1)
    Instantiation function, see class documentation
      for arguments.
    fxv must has same size as xv.
    dfxv must has same size as xv, or None for default
      (all 0).
    fpxg must be None if xg is None, or has same size
      as xg if xg is not None.
    dfpxg must be None if xg is None; if xg is not
      None it must has same size as xg, or None for
      default (all 0).
    Note: beta and gamma cannot be user-specified.
      They are automatically computed at every point
      during initializtion (can take a while).
    """

    Interp2D.__init__(self, xv, fxv, dfxv, xg, fpxg, dfpxg, 1, 1, \
                      N, l, verbose, safety_factor)
    # calculate gammas and construct interpolation object for gamma
    self.beta = self.calc_beta()
    self.gamma = self.calc_gamma()
    self.log_gamma_interp = Interp2D(xv, log(self.gamma), verbose=0, \
                                     safety_factor=100)
Beispiel #2
0
 def grad_coef(self, x, beta=None, gamma=None):
   """
   See Interp2D.grad_coef.
   This is the variable gamma version.
   """
   if beta is None:
     beta = self.beta
   if gamma is None:
     gamma = exp(self.log_gamma_interp.interp(x))
   return Interp2D.grad_coef(self, x, beta, gamma)
Beispiel #3
0
 def interp_matrices(self, x, beta=None, gamma=None):
   """
   See Interp2D.interp_matrices.
   This is the variable gamma version.
   """
   if beta is None:
     beta = self.beta
   if gamma is None:
     gamma = exp(self.log_gamma_interp.interp(x))
   return Interp2D.interp_matrices(self, x, beta, gamma)