def facet_avg(self, o, a): # Facet average of a single function and differentiation commutes. f, fp = a o = self.reuse_if_possible(o, f) if isinstance(fp, ConstantValue): return (o, fp) # TODO: Necessary? Can't FacetAvg simplify directly instead? else: return (o, facet_avg(fp))
def facet_avg(self, o, a): # Facet average of a single function and differentiation commutes. f, fp = a o = self.reuse_if_possible(o, f) if isinstance(fp, ConstantValue): return ( o, fp ) # TODO: Necessary? Can't FacetAvg simplify directly instead? else: return (o, facet_avg(fp))
def facet_avg(self, o, fp): # Facet average of a single function and differentiation # commutes, D_f[v](facet_avg(f)) = facet_avg(v) return facet_avg(fp)