def abs(self, o, df): f, = o.ufl_operands # return conditional(eq(f, 0), 0, Product(sign(f), df)) abs is # not complex differentiable, so we workaround the case of a # real F in complex mode by defensively casting to real inside # the sign. return sign(Real(f)) * df
def abs(self, o, df): f, = o.ufl_operands # return conditional(eq(f, 0), 0, Product(sign(f), df)) return sign(f) * df
def abs(self, o, a): f, fprime = a o = self.reuse_if_possible(o, f) #oprime = conditional(eq(f, 0), 0, Product(sign(f), fprime)) oprime = sign(f)*fprime return (o, oprime)
def abs(self, f): r".. math:: \\frac{d}{dx} f(x) = \\frac{d}{dx} abs(x) = sign(x)" x, = f.operands() dx = sign(x) return (dx,)
def abs(self, o, a): f, fprime = a o = self.reuse_if_possible(o, f) #oprime = conditional(eq(f, 0), 0, Product(sign(f), fprime)) oprime = sign(f) * fprime return (o, oprime)