Exemplo n.º 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).
    """

    Interp1D.__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 = Interp1D(xv, log(self.gamma), verbose=0, \
                                     safety_factor=100)
Exemplo n.º 2
0
 def grad_coef(self, x, beta=None, gamma=None):
   """
   See Interp1D.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 Interp1D.grad_coef(self, x, beta, gamma)
Exemplo n.º 3
0
 def interp_matrices(self, x, beta=None, gamma=None):
   """
   See Interp1D.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 Interp1D.interp_matrices(self, x, beta, gamma)