def cell_avg(self, o, a): # Cell 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 CellAvg simplify directly instead? else: return (o, cell_avg(fp))
def cell_avg(self, o, a): # Cell 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 CellAvg simplify directly instead? else: return (o, cell_avg(fp))
def cell_avg(self, o, fp): # Cell average of a single function and differentiation # commutes, D_f[v](cell_avg(f)) = cell_avg(v) return cell_avg(fp)