def __init__(self, xName, function, paramsNames, dFunc=False): self.xName = xName self.parameters = paramsNames paramsNamesList = paramsNames.split(",") self.fz = function self.fzOriginal = function self.checkFunction = True # Calculate the analytical derivatives # Return None if not available self.dFunc = dFunc if dFunc: self.dFunc = getDiff(xName, function, paramsNamesList) try: # Then try to compile them to be reused by NumExpr self.dFuncCompiled = map(ne.NumExpr, self.dFunc) except TypeError: print("Warning: one or more functions are undefined in NumExpr") self.dFuncCompiled = None
def __init__(self, xName, function, paramsNames, params0, analyDeriv=None): self.xName = xName self.parameters = paramsNames self.initialParams = params0 self.parStr = self.parameters.split(",") self.fz = function self.checkFunction = True self.analyDeriv = analyDeriv paramsNamesList = paramsNames.split(",") # Calculate the analytical derivatives # Return None if not available self.analyDeriv = getDiff(xName, function, paramsNamesList) try: # Then try to compile them to be reused by NumExpr self.derivsCompiled = map(ne.NumExpr, self.analyDeriv) except TypeError: print("Warning: one or more functions are undefined in NumExpr") self.derivsCompiled = None
def __init__(self, xName, function, paramsNames, dFunc=False): self.xName = xName self.parameters = paramsNames paramsNamesList = paramsNames.split(",") self.fz = function self.fzOriginal = function self.checkFunction = True # Calculate the analytical derivatives # Return None if not available self.dFunc = dFunc if dFunc: self.dFunc = getDiff(xName, function, paramsNamesList) try: # Then try to compile them to be reused by NumExpr self.dFuncCompiled = map(ne.NumExpr, self.dFunc) except TypeError: print( "Warning: one or more functions are undefined in NumExpr") self.dFuncCompiled = None